diff --git a/NebulaAuth/Core/DialogsController.cs b/NebulaAuth/Core/DialogsController.cs index 349f7d8..fb9e70d 100644 --- a/NebulaAuth/Core/DialogsController.cs +++ b/NebulaAuth/Core/DialogsController.cs @@ -1,9 +1,11 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; using MaterialDesignThemes.Wpf; using NebulaAuth.Model.Entities; using NebulaAuth.View; using NebulaAuth.View.Dialogs; using NebulaAuth.ViewModel.Other; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel; namespace NebulaAuth.Core; @@ -36,7 +38,23 @@ public static async Task ShowConfirmCancelDialog(string? msg = null) { UserName = username }; - var content = new LoginAgainDialog() + var content = new LoginAgainDialog + { + DataContext = vm + }; + var result = await DialogHost.Show(content); + if (result is true) + { + return vm; + } + + return null; + } + + public static async Task ShowLoginAgainOnImportDialog(Mafile mafile, IEnumerable proxies) + { + var vm = new LoginAgainOnImportVM(mafile, proxies); + var content = new LoginAgainOnImportDialog() { DataContext = vm }; diff --git a/NebulaAuth/Core/UpdateManager.cs b/NebulaAuth/Core/UpdateManager.cs index d6424ef..784fbec 100644 --- a/NebulaAuth/Core/UpdateManager.cs +++ b/NebulaAuth/Core/UpdateManager.cs @@ -1,7 +1,14 @@ using AutoUpdaterDotNET; +using MaterialDesignThemes.Wpf; using NebulaAuth.Model; +using NebulaAuth.View; +using NebulaAuth.ViewModel.Other; using System; using System.IO; +using System.Net; +using System.Windows.Forms; +using System.Windows.Threading; +using Application = System.Windows.Application; namespace NebulaAuth.Core; @@ -17,8 +24,60 @@ public static void CheckForUpdates() if (Settings.Instance.AllowAutoUpdate) AutoUpdater.UpdateMode = Mode.ForcedDownload; AutoUpdater.Start(UPDATE_URL); - + } + + static UpdateManager() + { + //AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent; + + } + + private static async void AutoUpdaterOnCheckForUpdateEvent(UpdateInfoEventArgs args) + { + if (args.Error == null) + { + if (args.IsUpdateAvailable) + { + DialogResult dialogResult; + var dialog = new UpdaterView() + { + DataContext = new UpdaterVM(args) + }; + + await DialogHost.Show(dialog); + Application.Current.Shutdown(); + + } + else + { + + } + } + else + { + if (args.Error is WebException) + { + + } + else + { + + } + } + + } + + private static void RunUpdate(UpdateInfoEventArgs args) + { + Application.Current.Dispatcher.Invoke(() => + { + if (AutoUpdater.DownloadUpdate(args)) + { + Application.Current.Shutdown(); + } + }, DispatcherPriority.ContextIdle); + } } \ No newline at end of file diff --git a/NebulaAuth/MainWindow.xaml b/NebulaAuth/MainWindow.xaml index be104af..45b9b22 100644 --- a/NebulaAuth/MainWindow.xaml +++ b/NebulaAuth/MainWindow.xaml @@ -71,7 +71,7 @@ - @@ -109,8 +109,8 @@ - - + + diff --git a/NebulaAuth/NebulaAuth.csproj b/NebulaAuth/NebulaAuth.csproj index a0fbbec..3a955b5 100644 --- a/NebulaAuth/NebulaAuth.csproj +++ b/NebulaAuth/NebulaAuth.csproj @@ -10,7 +10,7 @@ en;ru;ua Theme\nebula lock.ico 7.0 - 1.4.5 + 1.4.6 @@ -26,7 +26,7 @@ - + @@ -43,7 +43,6 @@ - @@ -51,6 +50,12 @@ + + + Code + + + diff --git a/NebulaAuth/Theme/lock small-detailed.png b/NebulaAuth/Theme/lock small-detailed.png new file mode 100644 index 0000000..a88ff31 Binary files /dev/null and b/NebulaAuth/Theme/lock small-detailed.png differ diff --git a/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml b/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml index 464abce..00af367 100644 --- a/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml +++ b/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml @@ -7,6 +7,7 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other" xmlns:model="clr-namespace:NebulaAuth.Model" + xmlns:entities="clr-namespace:NebulaAuth.Model.Entities" mc:Ignorable="d" d:DesignHeight="250" d:DesignWidth="800" theme:FontScaleWindow.Scale="0.9" theme:FontScaleWindow.ResizeFont="True" @@ -15,25 +16,25 @@ Background="{DynamicResource WindowBackground}"> - - - - - - + + + + + + - - - + + + -