diff --git a/.editorconfig b/.editorconfig index 2287241..d41de40 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,5 +1,4 @@ - -[*] +[*] charset = utf-8-bom end_of_line = crlf trim_trailing_whitespace = false @@ -8,7 +7,7 @@ indent_style = space indent_size = 4 # Microsoft .NET properties -csharp_style_namespace_declarations=file_scoped:error +csharp_style_namespace_declarations = file_scoped:error csharp_new_line_before_members_in_object_initializers = false csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:warning csharp_style_prefer_utf8_string_literals = true:suggestion diff --git a/SPTInstaller/App.axaml b/SPTInstaller/App.axaml index 1c0a3d8..fc2db57 100644 --- a/SPTInstaller/App.axaml +++ b/SPTInstaller/App.axaml @@ -5,7 +5,7 @@ xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia" RequestedThemeVariant="Light"> - + @@ -13,38 +13,40 @@ - + - - #121212 - #FFC107 - #FFFFFF - #282828 - #323947 + + #121212 + #FFC107 + #FFFFFF + #282828 + #323947 #444259 - - - - - - - - + + + + + + + + - - - - - + + + + + - - + FillRule="NonZero" /> + + \ No newline at end of file diff --git a/SPTInstaller/App.axaml.cs b/SPTInstaller/App.axaml.cs index a43aaa9..c1e97d9 100644 --- a/SPTInstaller/App.axaml.cs +++ b/SPTInstaller/App.axaml.cs @@ -13,6 +13,7 @@ namespace SPTInstaller; public partial class App : Application { private readonly string _logPath = Path.Join(Environment.CurrentDirectory, "spt-aki-installer_.log"); + public override void Initialize() { AvaloniaXamlLoader.Load(this); @@ -24,14 +25,13 @@ public partial class App : Application restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Information, rollingInterval: RollingInterval.Day) .CreateLogger(); - + RxApp.DefaultExceptionHandler = Observer.Create((exception) => { Log.Error(exception, "An application exception occurred"); }); - } - + public override void OnFrameworkInitializationCompleted() { if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) @@ -57,7 +57,7 @@ public partial class App : Application DataContext = new MainWindowViewModel(debug), }; } - + base.OnFrameworkInitializationCompleted(); } } \ No newline at end of file diff --git a/SPTInstaller/Assets/Styles.axaml b/SPTInstaller/Assets/Styles.axaml index ce89e48..c1206e1 100644 --- a/SPTInstaller/Assets/Styles.axaml +++ b/SPTInstaller/Assets/Styles.axaml @@ -1,267 +1,268 @@  - - - - - - - + + + + - + - - + + - + - - - + + + - + - + - + - + - + - + - + - - - + + + - + - + - + - - - + + + - + - - - + + + - - - + + + - + - + - + - - + + - + - + - + - + - + - + + + - - - + + + - + - - + + - + \ No newline at end of file diff --git a/SPTInstaller/CustomControls/PreCheckItem.axaml.cs b/SPTInstaller/CustomControls/PreCheckItem.axaml.cs index 57ae999..f0efa91 100644 --- a/SPTInstaller/CustomControls/PreCheckItem.axaml.cs +++ b/SPTInstaller/CustomControls/PreCheckItem.axaml.cs @@ -10,47 +10,47 @@ public partial class PreCheckItem : UserControl { InitializeComponent(); } - + public string PreCheckName { get => GetValue(PreCheckNameProperty); set => SetValue(PreCheckNameProperty, value); } - + public static readonly StyledProperty PreCheckNameProperty = AvaloniaProperty.Register(nameof(PreCheckName)); - + public bool IsRequired { get => GetValue(IsRequiredProperty); set => SetValue(IsRequiredProperty, value); } - + public static readonly StyledProperty IsRequiredProperty = AvaloniaProperty.Register(nameof(IsRequired)); - + public StatusSpinner.SpinnerState State { get => GetValue(StateProperty); set => SetValue(StateProperty, value); } - + public static readonly StyledProperty StateProperty = AvaloniaProperty.Register(nameof(State)); - - + + public static readonly StyledProperty IsSelectedProperty = AvaloniaProperty.Register(nameof(IsSelected)); - + public bool IsSelected { get => GetValue(IsSelectedProperty); set => SetValue(IsSelectedProperty, value); } - + public static readonly StyledProperty SelectCommandProperty = AvaloniaProperty.Register(nameof(SelectCommand)); - + public ICommand SelectCommand { get => GetValue(SelectCommandProperty); diff --git a/SPTInstaller/CustomControls/ProgressableTaskItem.axaml b/SPTInstaller/CustomControls/ProgressableTaskItem.axaml index b96ece5..9b18c05 100644 --- a/SPTInstaller/CustomControls/ProgressableTaskItem.axaml +++ b/SPTInstaller/CustomControls/ProgressableTaskItem.axaml @@ -2,78 +2,83 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:vm="using:SPTInstaller.ViewModels" + xmlns:vm="using:SPTInstaller.ViewModels" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SPTInstaller.CustomControls.ProgressableTaskItem"> - - - - - - - + + + + + + + - - - - - - - - + + + + + + - - - - - + + + + + + + \ No newline at end of file diff --git a/SPTInstaller/CustomControls/ProgressableTaskItem.axaml.cs b/SPTInstaller/CustomControls/ProgressableTaskItem.axaml.cs index ceaf72c..6d27b11 100644 --- a/SPTInstaller/CustomControls/ProgressableTaskItem.axaml.cs +++ b/SPTInstaller/CustomControls/ProgressableTaskItem.axaml.cs @@ -10,67 +10,67 @@ public partial class ProgressableTaskItem : UserControl { InitializeComponent(); } - + public string TaskId { get => GetValue(TaskIdProperty); set => SetValue(TaskIdProperty, value); } - + public static readonly StyledProperty TaskIdProperty = AvaloniaProperty.Register(nameof(TaskId)); - + public string TaskName { get => GetValue(TaskNameProperty); set => SetValue(TaskNameProperty, value); } - + public static readonly StyledProperty TaskNameProperty = AvaloniaProperty.Register(nameof(TaskName)); - + public bool IsCompleted { get => GetValue(IsCompletedProperty); set => SetValue(IsCompletedProperty, value); } - + public static readonly StyledProperty IsCompletedProperty = AvaloniaProperty.Register(nameof(IsCompleted)); - + public bool IsRunning { get => GetValue(IsRunningProperty); set => SetValue(IsRunningProperty, value); } - + public static readonly StyledProperty IsRunningProperty = AvaloniaProperty.Register(nameof(IsRunning)); - + public IBrush PendingColor { get => GetValue(PendingColorProperty); set => SetValue(PendingColorProperty, value); } - + public static readonly StyledProperty PendingColorProperty = AvaloniaProperty.Register(nameof(PendingColor)); - + public IBrush RunningColor { get => GetValue(RunningColorProperty); set => SetValue(RunningColorProperty, value); } - + public static readonly StyledProperty RunningColorProperty = AvaloniaProperty.Register(nameof(PendingColor)); - + public IBrush CompletedColor { get => GetValue(CompletedColorProperty); set => SetValue(CompletedColorProperty, value); } - + public static readonly StyledProperty CompletedColorProperty = AvaloniaProperty.Register(nameof(PendingColor)); } \ No newline at end of file diff --git a/SPTInstaller/CustomControls/ProgressableTaskList.axaml b/SPTInstaller/CustomControls/ProgressableTaskList.axaml index 5ca8c06..97d8832 100644 --- a/SPTInstaller/CustomControls/ProgressableTaskList.axaml +++ b/SPTInstaller/CustomControls/ProgressableTaskList.axaml @@ -2,15 +2,14 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:cc="using:SPTInstaller.CustomControls" - xmlns:bh="using:SPTInstaller.Behaviors" - xmlns:convt="using:SPTInstaller.Converters" + xmlns:cc="using:SPTInstaller.CustomControls" + xmlns:bh="using:SPTInstaller.Behaviors" + xmlns:convt="using:SPTInstaller.Converters" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="SPTInstaller.CustomControls.ProgressableTaskList" - > - - - + x:Class="SPTInstaller.CustomControls.ProgressableTaskList"> + + + - + Margin="25 20" /> + - + @@ -36,10 +35,9 @@ IsCompleted="{Binding IsCompleted}" PendingColor="{Binding PendingColor, RelativeSource={RelativeSource AncestorType=UserControl}}" RunningColor="{Binding RunningColor, RelativeSource={RelativeSource AncestorType=UserControl}}" - CompletedColor="{Binding CompletedColor, RelativeSource={RelativeSource AncestorType=UserControl}}" - /> + CompletedColor="{Binding CompletedColor, RelativeSource={RelativeSource AncestorType=UserControl}}" /> - + \ No newline at end of file diff --git a/SPTInstaller/CustomControls/ProgressableTaskList.axaml.cs b/SPTInstaller/CustomControls/ProgressableTaskList.axaml.cs index 6d85212..1dc0d6d 100644 --- a/SPTInstaller/CustomControls/ProgressableTaskList.axaml.cs +++ b/SPTInstaller/CustomControls/ProgressableTaskList.axaml.cs @@ -15,76 +15,77 @@ public partial class ProgressableTaskList : UserControl public ProgressableTaskList() { InitializeComponent(); - + this.AttachedToVisualTree += ProgressableTaskList_AttachedToVisualTree; } - + private int _taskProgress; + public int TaskProgress { get => _taskProgress; set => SetAndRaise(ProgressableTaskList.TaskProgressProperty, ref _taskProgress, value); } - + public static readonly DirectProperty TaskProgressProperty = AvaloniaProperty.RegisterDirect(nameof(TaskProgress), o => o.TaskProgress); - + public ObservableCollection Tasks { get => GetValue(TasksProperty); set => SetValue(TasksProperty, value); } - + public static readonly StyledProperty> TasksProperty = AvaloniaProperty.Register>(nameof(Tasks)); - + public IBrush PendingColor { get => GetValue(PendingColorProperty); set => SetValue(PendingColorProperty, value); } - + public static readonly StyledProperty PendingColorProperty = AvaloniaProperty.Register(nameof(PendingColor)); - + public IBrush RunningColor { get => GetValue(RunningColorProperty); set => SetValue(RunningColorProperty, value); } - + public static readonly StyledProperty RunningColorProperty = AvaloniaProperty.Register(nameof(PendingColor)); - + public IBrush CompletedColor { get => GetValue(CompletedColorProperty); set => SetValue(CompletedColorProperty, value); } - + public static readonly StyledProperty CompletedColorProperty = AvaloniaProperty.Register(nameof(PendingColor)); - + private void UpdateTaskProgress() { Dispatcher.UIThread.InvokeAsync(async () => { var completedTasks = Tasks.Where(x => x.IsCompleted == true).Count(); - + var progress = (int)Math.Floor((double)completedTasks / (Tasks.Count - 1) * 100); - - for(; TaskProgress < progress;) + + for (; TaskProgress < progress;) { TaskProgress += 1; await Task.Delay(1); } }); } - + private void ProgressableTaskList_AttachedToVisualTree(object? sender, VisualTreeAttachmentEventArgs e) { if (Tasks == null) return; - + foreach (var task in Tasks) { task.WhenPropertyChanged(x => x.IsCompleted) diff --git a/SPTInstaller/CustomControls/StatusSpinner.axaml b/SPTInstaller/CustomControls/StatusSpinner.axaml index c10b421..2bea27d 100644 --- a/SPTInstaller/CustomControls/StatusSpinner.axaml +++ b/SPTInstaller/CustomControls/StatusSpinner.axaml @@ -4,56 +4,55 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:convt="using:SPTInstaller.Converters" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" - x:Class="SPTInstaller.CustomControls.StatusSpinner" - > + x:Class="SPTInstaller.CustomControls.StatusSpinner"> - - + + - + - + - + + ConverterParameter=Error}" /> + ConverterParameter=Running}" /> - + \ No newline at end of file diff --git a/SPTInstaller/CustomControls/StatusSpinner.axaml.cs b/SPTInstaller/CustomControls/StatusSpinner.axaml.cs index d845467..ce812cb 100644 --- a/SPTInstaller/CustomControls/StatusSpinner.axaml.cs +++ b/SPTInstaller/CustomControls/StatusSpinner.axaml.cs @@ -10,22 +10,22 @@ public partial class StatusSpinner : ReactiveUserControl { Pending = -1, Running = 0, - OK = 1, + OK = 1, Warning = 2, - Error = 3, + Error = 3, } - + public StatusSpinner() { InitializeComponent(); } - + public SpinnerState State { get => GetValue(StateProperty); set => SetValue(StateProperty, value); } - + public static readonly StyledProperty StateProperty = AvaloniaProperty.Register(nameof(State)); -} +} \ No newline at end of file diff --git a/SPTInstaller/CustomControls/TaskDetails.axaml b/SPTInstaller/CustomControls/TaskDetails.axaml index b4f7186..b79e0bd 100644 --- a/SPTInstaller/CustomControls/TaskDetails.axaml +++ b/SPTInstaller/CustomControls/TaskDetails.axaml @@ -4,37 +4,33 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SPTInstaller.CustomControls.TaskDetails"> - - - + + + + + + + \ No newline at end of file diff --git a/SPTInstaller/CustomControls/TaskDetails.axaml.cs b/SPTInstaller/CustomControls/TaskDetails.axaml.cs index 31132c4..0ca01fb 100644 --- a/SPTInstaller/CustomControls/TaskDetails.axaml.cs +++ b/SPTInstaller/CustomControls/TaskDetails.axaml.cs @@ -9,49 +9,49 @@ public partial class TaskDetails : UserControl { InitializeComponent(); } - + public string Message { get => GetValue(MessageProperty); set => SetValue(MessageProperty, value); } - + public static readonly StyledProperty MessageProperty = AvaloniaProperty.Register(nameof(Message)); - + public string Details { get => GetValue(DetailsProperty); set => SetValue(DetailsProperty, value); } - + public static readonly StyledProperty DetailsProperty = AvaloniaProperty.Register(nameof(Details)); - + public int Progress { get => GetValue(ProgressProperty); set => SetValue(ProgressProperty, value); } - + public static readonly StyledProperty ProgressProperty = AvaloniaProperty.Register(nameof(Progress)); - + public bool ShowProgress { get => GetValue(ShowProgressProperty); set => SetValue(ShowProgressProperty, value); } - + public static readonly StyledProperty ShowProgressProperty = AvaloniaProperty.Register(nameof(ShowProgress)); - + public bool IndeterminateProgress { get => GetValue(IndeterminateProgressProperty); set => SetValue(IndeterminateProgressProperty, value); } - + public static readonly StyledProperty IndeterminateProgressProperty = AvaloniaProperty.Register(nameof(IndeterminateProgress)); } \ No newline at end of file diff --git a/SPTInstaller/CustomControls/TitleBar.axaml b/SPTInstaller/CustomControls/TitleBar.axaml index e78e5c1..be6e3f4 100644 --- a/SPTInstaller/CustomControls/TitleBar.axaml +++ b/SPTInstaller/CustomControls/TitleBar.axaml @@ -5,72 +5,68 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SPTInstaller.CustomControls.TitleBar"> - + - + - + - + \ No newline at end of file diff --git a/SPTInstaller/CustomControls/TitleBar.axaml.cs b/SPTInstaller/CustomControls/TitleBar.axaml.cs index fc17d58..ff40a70 100644 --- a/SPTInstaller/CustomControls/TitleBar.axaml.cs +++ b/SPTInstaller/CustomControls/TitleBar.axaml.cs @@ -12,62 +12,62 @@ public partial class TitleBar : UserControl { InitializeComponent(); } - + private void InitializeComponent() { AvaloniaXamlLoader.Load(this); } - + public static readonly StyledProperty TitleProperty = AvaloniaProperty.Register(nameof(Title)); - + public string Title { get => GetValue(TitleProperty); set => SetValue(TitleProperty, value); } - + public static readonly StyledProperty ButtonForegroundProperty = AvaloniaProperty.Register(nameof(ButtonForeground)); - + public IBrush ButtonForeground { get => GetValue(ButtonForegroundProperty); set => SetValue(ButtonForegroundProperty, value); } - + public static new readonly StyledProperty ForegroundProperty = AvaloniaProperty.Register(nameof(Foreground)); - + public new IBrush Foreground { get => GetValue(ForegroundProperty); set => SetValue(ForegroundProperty, value); } - + public static new readonly StyledProperty BackgroundProperty = AvaloniaProperty.Register(nameof(Background)); - + public new IBrush Background { get => GetValue(BackgroundProperty); set => SetValue(BackgroundProperty, value); } - + //Close Button Command (X Button) Property public static readonly StyledProperty XButtonCommandProperty = AvaloniaProperty.Register(nameof(XButtonCommand)); - + public ICommand XButtonCommand { get => GetValue(XButtonCommandProperty); set => SetValue(XButtonCommandProperty, value); } - + //Minimize Button Command (- Button) Property public static readonly StyledProperty MinButtonCommandProperty = AvaloniaProperty.Register(nameof(MinButtonCommand)); - + public ICommand MinButtonCommand { get => GetValue(MinButtonCommandProperty); diff --git a/SPTInstaller/CustomControls/UpdateButton.axaml b/SPTInstaller/CustomControls/UpdateButton.axaml index 4b2f766..b2425a3 100644 --- a/SPTInstaller/CustomControls/UpdateButton.axaml +++ b/SPTInstaller/CustomControls/UpdateButton.axaml @@ -5,43 +5,43 @@ mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SPTInstaller.CustomControls.UpdateButton"> - + - + - - - - - - - - -