From 5dc4a9c2296c09c838c75069f65161005bdf86fd Mon Sep 17 00:00:00 2001 From: Misha <106913236+MishaProductions@users.noreply.github.com> Date: Tue, 28 Nov 2023 16:57:04 -0500 Subject: [PATCH 1/8] updates --- .../Cosmos.Build.Builder.csproj | 56 ++++---- .../ViewModels/MainWindowViewModel.cs | 3 +- .../DependencyInstallationDialog.xaml.cs | 4 - .../Views/MainWindow.xaml | 6 +- .../Views/MainWindow.xaml.cs | 35 ++--- .../Views/MessageBox.xaml | 2 +- .../Views/MessageBox.xaml.cs | 4 - .../Views/OptionsDialog.xaml | 58 +++++++++ .../Views/OptionsDialog.xaml.cs | 27 ++++ .../Views/VisualStudioInstanceDialog.xaml.cs | 4 - source/Cosmos.Build.Builder/app.manifest | 77 +++++++++++ .../Cosmos.Build.Builder/packages.lock.json | 122 +++++++++--------- 12 files changed, 264 insertions(+), 134 deletions(-) create mode 100644 source/Cosmos.Build.Builder/Views/OptionsDialog.xaml create mode 100644 source/Cosmos.Build.Builder/Views/OptionsDialog.xaml.cs create mode 100644 source/Cosmos.Build.Builder/app.manifest diff --git a/source/Cosmos.Build.Builder/Cosmos.Build.Builder.csproj b/source/Cosmos.Build.Builder/Cosmos.Build.Builder.csproj index d07ceb22a6..f228926884 100644 --- a/source/Cosmos.Build.Builder/Cosmos.Build.Builder.csproj +++ b/source/Cosmos.Build.Builder/Cosmos.Build.Builder.csproj @@ -1,34 +1,22 @@ - - - - net472 - WinExe - Resources\Cosmos.ico - True - False - False - - - - - - - - - - - - - - - - - - - - - - - - - + + + net6.0-windows7.0 + WinExe + Resources\Cosmos.ico + True + False + app.manifest + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/Cosmos.Build.Builder/ViewModels/MainWindowViewModel.cs b/source/Cosmos.Build.Builder/ViewModels/MainWindowViewModel.cs index 376c15fc43..779433ac96 100644 --- a/source/Cosmos.Build.Builder/ViewModels/MainWindowViewModel.cs +++ b/source/Cosmos.Build.Builder/ViewModels/MainWindowViewModel.cs @@ -82,7 +82,8 @@ private void RetryBuildCommand(object obj) MainWindow win = new(); win.Show(); _dependencyInstallationDialogService.SetAnotherOwner(win); - Window.AppShutdown = false; + Window.AppShutdown = false; + Window.ShowCloseBuilderDialog = false; Window.Close(); win.DataContext = new MainWindowViewModel(_dependencyInstallationDialogService, _buildDefinition, win); } diff --git a/source/Cosmos.Build.Builder/Views/DependencyInstallationDialog.xaml.cs b/source/Cosmos.Build.Builder/Views/DependencyInstallationDialog.xaml.cs index cfd596ef05..bd693c611c 100644 --- a/source/Cosmos.Build.Builder/Views/DependencyInstallationDialog.xaml.cs +++ b/source/Cosmos.Build.Builder/Views/DependencyInstallationDialog.xaml.cs @@ -8,10 +8,6 @@ public partial class DependencyInstallationDialog : Window public DependencyInstallationDialog() { InitializeComponent(); - Loaded += (sender, args) => - { - Wpf.Ui.Appearance.Watcher.Watch(this, Wpf.Ui.Appearance.BackgroundType.Mica, true); - }; } } } diff --git a/source/Cosmos.Build.Builder/Views/MainWindow.xaml b/source/Cosmos.Build.Builder/Views/MainWindow.xaml index 18510af8f8..8a613aab62 100644 --- a/source/Cosmos.Build.Builder/Views/MainWindow.xaml +++ b/source/Cosmos.Build.Builder/Views/MainWindow.xaml @@ -1,11 +1,11 @@ - - + diff --git a/source/Cosmos.Build.Builder/Views/MainWindow.xaml.cs b/source/Cosmos.Build.Builder/Views/MainWindow.xaml.cs index c61b724ee7..82e0c7e708 100644 --- a/source/Cosmos.Build.Builder/Views/MainWindow.xaml.cs +++ b/source/Cosmos.Build.Builder/Views/MainWindow.xaml.cs @@ -2,23 +2,21 @@ using System.ComponentModel; using System.Windows; using System.Windows.Controls; -using Wpf.Ui.Common; -using Wpf.Ui.Controls; using Clipboard = System.Windows.Clipboard; namespace Cosmos.Build.Builder.Views { - public partial class MainWindow : UiWindow + public partial class MainWindow : Wpf.Ui.Controls.FluentWindow { public bool AppShutdown = true; - public bool AllTasksCompleted; + public bool AllTasksCompleted; + + public bool ShowCloseBuilderDialog = true; public MainWindow() { InitializeComponent(); - - Loaded += (_, _) => Wpf.Ui.Appearance.Watcher.Watch(this); } private void SectionTextCopyHandler(object sender, System.Windows.Input.MouseButtonEventArgs e) @@ -26,30 +24,25 @@ private void SectionTextCopyHandler(object sender, System.Windows.Input.MouseBut Clipboard.SetText(((TextBlock)sender).Text); } - protected override void OnClosing(CancelEventArgs e) + protected override async void OnClosing(CancelEventArgs e) { base.OnClosing(e); - if (!AllTasksCompleted) + if (!AllTasksCompleted && ShowCloseBuilderDialog) { e.Cancel = true; Wpf.Ui.Controls.MessageBox messageBox = new() - { - Content = "You're about to close the builder, however tasks are still running. Do you wish to continue?", - SizeToContent = SizeToContent.Width, - ButtonLeftAppearance = ControlAppearance.Secondary, - ButtonLeftName = "Yes", - ButtonRightAppearance = ControlAppearance.Primary, - ButtonRightName = "No" + { + Title = "Warning", + Content = $"You're about to close the builder, however tasks are still running.{Environment.NewLine}Do you wish to continue?", + PrimaryButtonText = "Yes", + CloseButtonText = "No" }; - messageBox.ButtonLeftClick += (_, _) => + if (await messageBox.ShowDialogAsync() == Wpf.Ui.Controls.MessageBoxResult.Primary) { - messageBox.Close(); - Application.Current.Dispatcher.Invoke(() => Application.Current?.MainWindow?.Close()); - }; - messageBox.ButtonRightClick += (_, _) => messageBox.Close(); - messageBox.ShowDialog(); + e.Cancel = false; + } } } diff --git a/source/Cosmos.Build.Builder/Views/MessageBox.xaml b/source/Cosmos.Build.Builder/Views/MessageBox.xaml index dd610e3e79..ed190b8201 100644 --- a/source/Cosmos.Build.Builder/Views/MessageBox.xaml +++ b/source/Cosmos.Build.Builder/Views/MessageBox.xaml @@ -1,4 +1,4 @@ - - { - Wpf.Ui.Appearance.Watcher.Watch(this, Wpf.Ui.Appearance.BackgroundType.Mica, true); - }; if (Content.StartsWith("link:")) { diff --git a/source/Cosmos.Build.Builder/Views/OptionsDialog.xaml b/source/Cosmos.Build.Builder/Views/OptionsDialog.xaml new file mode 100644 index 0000000000..e83ddbbc11 --- /dev/null +++ b/source/Cosmos.Build.Builder/Views/OptionsDialog.xaml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + +