mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
96d4150d26
* remove dotnet-tool.json because the project does not rely on any dotnet tools. * remove Directory.Build.props because the solution has only one project. * move src/SourceGit to src. It's not needed to put all sources into a subfolder of src since there's only one project.
58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using System;
|
|
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Data.Converters;
|
|
using Avalonia.Media;
|
|
|
|
namespace SourceGit.Converters
|
|
{
|
|
public static class WindowStateConverters
|
|
{
|
|
public static readonly FuncValueConverter<WindowState, Thickness> ToContentMargin =
|
|
new FuncValueConverter<WindowState, Thickness>(state =>
|
|
{
|
|
if (OperatingSystem.IsWindows() && state == WindowState.Maximized)
|
|
{
|
|
return new Thickness(6);
|
|
}
|
|
else if (OperatingSystem.IsLinux() && state != WindowState.Maximized)
|
|
{
|
|
return new Thickness(6);
|
|
}
|
|
else
|
|
{
|
|
return new Thickness(0);
|
|
}
|
|
});
|
|
|
|
public static readonly FuncValueConverter<WindowState, GridLength> ToTitleBarHeight =
|
|
new FuncValueConverter<WindowState, GridLength>(state =>
|
|
{
|
|
if (state == WindowState.Maximized)
|
|
{
|
|
return new GridLength(30);
|
|
}
|
|
else
|
|
{
|
|
return new GridLength(38);
|
|
}
|
|
});
|
|
|
|
public static readonly FuncValueConverter<WindowState, StreamGeometry> ToMaxOrRestoreIcon =
|
|
new FuncValueConverter<WindowState, StreamGeometry>(state =>
|
|
{
|
|
if (state == WindowState.Maximized)
|
|
{
|
|
return Application.Current?.FindResource("Icons.Window.Restore") as StreamGeometry;
|
|
}
|
|
else
|
|
{
|
|
return Application.Current?.FindResource("Icons.Window.Maximize") as StreamGeometry;
|
|
}
|
|
});
|
|
|
|
public static readonly FuncValueConverter<WindowState, bool> IsNormal =
|
|
new FuncValueConverter<WindowState, bool>(state => state == WindowState.Normal);
|
|
}
|
|
}
|