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 ToContentMargin = new FuncValueConverter(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 ToTitleBarHeight = new FuncValueConverter(state => { if (state == WindowState.Maximized) { return new GridLength(30); } else { return new GridLength(38); } }); public static readonly FuncValueConverter ToMaxOrRestoreIcon = new FuncValueConverter(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 IsNormal = new FuncValueConverter(state => state == WindowState.Normal); } }