diff --git a/BeWoLauncher/BeWoLauncher.csproj b/BeWoLauncher/BeWoLauncher.csproj index a6defc59b..043d7ae0a 100644 --- a/BeWoLauncher/BeWoLauncher.csproj +++ b/BeWoLauncher/BeWoLauncher.csproj @@ -96,15 +96,6 @@ MSBuild:Compile Designer - - - - - - - LoginView.xaml - - ConfirmDemoDialog.xaml @@ -141,29 +132,30 @@ - - InfoScreen.xaml + + + InfoFrame.xaml - - LoadingScreen.xaml + + LoadingFrame.xaml - - - - - GenericProgressInfo.xaml + + + + + GenericProgressFrame.xaml - - BeWoLoginBorder.xaml + + FrameView.xaml - - InstallInfo.xaml + + InstallInfoFrame.xaml - - UpdateInfo.xaml + + UpdateInfoFrame.xaml - - UninstallInfo.xaml + + UninstallInfoFrame.xaml @@ -173,13 +165,9 @@ PasswortAenderungsView.xaml - + PopUpWindow.xaml - - MSBuild:Compile - Designer - MSBuild:Compile Designer @@ -204,7 +192,7 @@ Designer MSBuild:Compile - + MSBuild:Compile Designer @@ -220,15 +208,15 @@ MSBuild:Compile Designer - + Designer MSBuild:Compile - + MSBuild:Compile Designer - + Designer MSBuild:Compile @@ -236,23 +224,23 @@ Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + Designer MSBuild:Compile - + MSBuild:Compile Designer @@ -278,8 +266,8 @@ ExceptionMessageBox.xaml - - 01 LoginPage.xaml + + LoginView.xaml ProxyLoginView.xaml @@ -290,11 +278,11 @@ WaitLayer2.xaml - + LauncherWindow.xaml Code - + Designer MSBuild:Compile @@ -318,7 +306,6 @@ ResXFileCodeGenerator Resources.Designer.cs - @@ -474,10 +461,6 @@ - - - - - + \ No newline at end of file diff --git a/BeWoLauncher/BeWoLauncher_1_TemporaryKey.pfx b/BeWoLauncher/BeWoLauncher_1_TemporaryKey.pfx deleted file mode 100644 index 3a18e2374..000000000 Binary files a/BeWoLauncher/BeWoLauncher_1_TemporaryKey.pfx and /dev/null differ diff --git a/BeWoLauncher/LauncherApp.xaml b/BeWoLauncher/LauncherApp.xaml index a360f8211..964c727df 100644 --- a/BeWoLauncher/LauncherApp.xaml +++ b/BeWoLauncher/LauncherApp.xaml @@ -3,18 +3,12 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:BeWoLauncher" - xmlns:viewModel="clr-namespace:BeWoLauncher.MVVM.ViewModels" - xmlns:view="clr-namespace:BeWoLauncher.MVVM.View" - StartupUri="View/WindowImp/LauncherWindow.xaml" Exit="Application_Exit"> + Exit="Application_Exit"> - - - - diff --git a/BeWoLauncher/LauncherApp.xaml.cs b/BeWoLauncher/LauncherApp.xaml.cs index d246f971a..034822460 100644 --- a/BeWoLauncher/LauncherApp.xaml.cs +++ b/BeWoLauncher/LauncherApp.xaml.cs @@ -2,7 +2,6 @@ using BeWoLauncher.Logic; using BeWoLauncher.Logic.Controller; using BeWoLauncher.ServiceProxy; -using BeWoLauncher.Store; using BeWoLauncher.WindowImp; using BS.SharedLauncher; using BS.SharedLauncher.Information; @@ -34,18 +33,19 @@ namespace BeWoLauncher /// public partial class LauncherApp : Application { - private readonly NavigationStore _navigationStore; - public static string ShortVersion => "3"; public static string Version => "Version 3.0"; public LauncherApp() { - _navigationStore = new NavigationStore(); + } protected override void OnStartup(StartupEventArgs e) { + MainWindow = new LauncherWindow(); + MainWindow.Show(); + base.OnStartup(e); ProcessController.CheckForOtherInstance(); @@ -85,22 +85,17 @@ namespace BeWoLauncher } public static void ShowError(string message, string ex, bool showDetails) { - if (ViewController.LauncherWindow is null) + if (ViewController.CurrentWindow is null) { MessageBox.Show(ex, message); } else { - ViewController.LauncherWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => - ViewController.LauncherWindow.ShowControlAsModalPopUp(new ExceptionMessageBox(message, ex, showDetails)))); + ViewController.CurrentWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() => + ViewController.CurrentWindow.ShowControlAsModalPopUp(new ExceptionMessageBox(message, ex, showDetails)))); } } #endregion - - - - - } } diff --git a/BeWoLauncher/View/WindowImp/LauncherWindow.xaml b/BeWoLauncher/LauncherWindow.xaml similarity index 93% rename from BeWoLauncher/View/WindowImp/LauncherWindow.xaml rename to BeWoLauncher/LauncherWindow.xaml index 6a85140a4..1e1ff1339 100644 --- a/BeWoLauncher/View/WindowImp/LauncherWindow.xaml +++ b/BeWoLauncher/LauncherWindow.xaml @@ -1,4 +1,4 @@ -(); - ViewController.LauncherWindow = this; + ViewController.CurrentWindow = this; ViewController.StartView(); diff --git a/BeWoLauncher/Logic/Controller/ProcessController.cs b/BeWoLauncher/Logic/Controller/ProcessController.cs index 865b0f714..101c1bbaa 100644 --- a/BeWoLauncher/Logic/Controller/ProcessController.cs +++ b/BeWoLauncher/Logic/Controller/ProcessController.cs @@ -136,7 +136,7 @@ namespace BeWoLauncher.Logic.Controller if (data == "GUI geladen") { - ViewController.LauncherWindow.Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => ViewController.LauncherWindow.Hide())); + ViewController.CurrentWindow.Dispatcher.BeginInvoke(DispatcherPriority.Render, (Action)(() => ViewController.CurrentWindow.Hide())); } } } diff --git a/BeWoLauncher/Logic/Controller/ViewController.cs b/BeWoLauncher/Logic/Controller/ViewController.cs index 5120f3eb2..71668aa2e 100644 --- a/BeWoLauncher/Logic/Controller/ViewController.cs +++ b/BeWoLauncher/Logic/Controller/ViewController.cs @@ -1,6 +1,7 @@ using BeWoLauncher.Logic.Controller; using BeWoLauncher.Utils; -using BeWoLauncher.View.Pages; +using BeWoLauncher.View; +using BeWoLauncher.View.Frames; using BeWoLauncher.WindowImp; using BS.SharedLauncher.Extensions; using BS.SharedLauncher.Information; @@ -19,11 +20,9 @@ namespace BeWoLauncher.Logic.Controller { public static class ViewController { - static bool isBeWoLoginBorderPresent = false; - static BeWoLoginBorder BeWoLoginBorder = null; - static LauncherPageType currentPage; - - private static Exception error; + private static UserControl _currentView; + private static FrameBase _currentFrame; + private static Exception error; public enum LauncherPageType { @@ -42,11 +41,39 @@ namespace BeWoLauncher.Logic.Controller NoPermissionInfo } - + public static LauncherWindow CurrentWindow { get; set; } + public static UserControl CurrentView + { + get => _currentView; + set + { + _currentView = value; - public static LauncherWindow LauncherWindow { get; set; } + Dispatcher.BeginInvoke(DispatcherPriority.Render, + (Action)delegate + { + CurrentWindow.SetMainContent(value); + }); + } + } + public static FrameBase CurrentFrame + { + get => _currentFrame; set + { + _currentFrame = value; - public static Dispatcher Dispatcher => LauncherWindow.Dispatcher; + if (CurrentView is FrameView frameview) + Dispatcher.BeginInvoke(DispatcherPriority.Render, + (Action)delegate + { + frameview.SetFrame(value); + }); + else + CurrentView = new FrameView(value); + } + } + + public static Dispatcher Dispatcher => CurrentWindow.Dispatcher; public static void StartView() { @@ -55,12 +82,12 @@ namespace BeWoLauncher.Logic.Controller public static void RestartView() { ShowPage(LauncherPageType.Login); - LauncherWindow.Show(); - LauncherWindow.Activate(); + CurrentWindow.Show(); + CurrentWindow.Activate(); } - public static void StartWaiting() => LauncherWindow.StartWaiting(); - public static void EndWaiting() => LauncherWindow.EndWaiting(); + public static void StartWaiting() => CurrentWindow.StartWaiting(); + public static void EndWaiting() => CurrentWindow.EndWaiting(); public static bool CheckForPermissions(string path) { @@ -119,7 +146,7 @@ namespace BeWoLauncher.Logic.Controller var autologin = bool.TryParse(ConfigurationManager.AppSettings.Get("AutoLogin"), out bool c) && c; if (autologin) - if (sender is LoginPage loginPage) + if (sender is LoginView loginPage) loginPage.ClickLogin(); } public static void LoginSuccessful(object sender, EventArgs e) @@ -144,28 +171,28 @@ namespace BeWoLauncher.Logic.Controller if (BeWoPaths.ActualPlanerLocation is object && !CheckForPermissions(BeWoPaths.ActualPlanerLocation)) { - ShowPage(LauncherPageType.NoPermissionInfo); + ShowPage(LauncherPageType.NoPermissionInfo); } else { CheckForNewestVersion(); } } - + private static UserControl GetNewPage(LauncherPageType type) { switch (type) { case LauncherPageType.Login: - var login = new LoginPage(); + var login = new LoginView(); login.Loaded += CheckForAutoLogin; login.LoginSuccessful += LoginSuccessful; return login; - + case LauncherPageType.InstallInfo: - var install = new InstallInfo(); + var install = new InstallInfoFrame(); install.Accept += (s, e) => { @@ -182,10 +209,10 @@ namespace BeWoLauncher.Logic.Controller }; install.Abort += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(install); - + return GetControlInFrameView(install); + case LauncherPageType.InstallProgress: - var installprogress = new InstallProgressInfo(); + var installprogress = new InstallProgressInfoFrame(); installprogress.InstallSuccessful += (s, e) => { @@ -193,77 +220,77 @@ namespace BeWoLauncher.Logic.Controller ProcessController.StartPlanerProcess(); }; - return GetControlInBorder(installprogress); + return GetControlInFrameView(installprogress); case LauncherPageType.InstallFailed: - var installError = new InfoScreen(); + var installError = new InfoFrame(); installError.Title = "Installation fehlgeschlagen!"; installError.Text = error.ToString(); installError.Button1Click += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(installError); + return GetControlInFrameView(installError); case LauncherPageType.UpdateInfo: - var update = new UpdateInfo(); + var update = new UpdateInfoFrame(); update.Accept += (s, e) => { ShowPage(LauncherPageType.UpdateProgress); }; update.Abort += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(update); - + return GetControlInFrameView(update); + case LauncherPageType.UpdateProgress: - var updateProgress = new UpdateProgressInfo(); + var updateProgress = new UpdateProgressInfoFrame(); updateProgress.UpdateSuccessful += (s, e) => { ShowPage(LauncherPageType.LoadingScreen); }; - return GetControlInBorder(updateProgress); + return GetControlInFrameView(updateProgress); case LauncherPageType.UpdateFailed: - var updateError = new InfoScreen(); + var updateError = new InfoFrame(); updateError.Title = "Update fehlgeschlagen!"; updateError.Text = error.ToString(); updateError.Button1Click += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(updateError); + return GetControlInFrameView(updateError); case LauncherPageType.UninstallInfo: - var uninstall = new UninstallInfo(); + var uninstall = new UninstallInfoFrame(); uninstall.Accept += (s, e) => { ShowPage(LauncherPageType.UpdateProgress); }; uninstall.Abort += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(uninstall); + return GetControlInFrameView(uninstall); case LauncherPageType.UninstallProgress: - var uninstallProgress = new UninstallProgressInfo(); + var uninstallProgress = new UninstallProgressInfoFrame(); uninstallProgress.UninstallSuccessful += (s, e) => { ShowPage(LauncherPageType.UninstallSuccessful); }; - return GetControlInBorder(uninstallProgress); + return GetControlInFrameView(uninstallProgress); case LauncherPageType.UninstallFailed: - var uninstallFailed = new InfoScreen(); + var uninstallFailed = new InfoFrame(); uninstallFailed.Title = "Deinstallation fehlgeschlagen!"; uninstallFailed.Text = error.ToString(); uninstallFailed.Button1Click += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(uninstallFailed); + return GetControlInFrameView(uninstallFailed); case LauncherPageType.UninstallSuccessful: - var uninstallSuccessful = new InfoScreen(); + var uninstallSuccessful = new InfoFrame(); uninstallSuccessful.Title = "Deinstallation erfolgreich!"; uninstallSuccessful.Text = "Kehre zum Login zurück..."; @@ -272,7 +299,7 @@ namespace BeWoLauncher.Logic.Controller uninstallSuccessful.Button1Click += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(uninstallSuccessful); + return GetControlInFrameView(uninstallSuccessful); case LauncherPageType.LoadingScreen: @@ -283,76 +310,52 @@ namespace BeWoLauncher.Logic.Controller Task.Run(() => ProcessController.StartPlanerProcess()); }; - return GetControlInBorder(loading); + return GetControlInFrameView(loading); case LauncherPageType.NoPermissionInfo: - var noper = new InfoScreen(); + var noper = new InfoFrame(); noper.Title = "Keine Rechte auf Speicherort!"; noper.Text = "Es liegt eine neue Version. Sie besitzen aber nicht die benötigten Rechte, um diese anzuwenden. Bitte wenden Sie sich an Ihren System-Administrator!"; noper.Button1Click += (s, e) => { ShowPage(LauncherPageType.Login); }; - return GetControlInBorder(noper); + return GetControlInFrameView(noper); } throw new NotImplementedException(); } - private static UserControl GetControlInBorder(UserControl uc) + private static UserControl GetControlInFrameView(UserControl uc) { - if (isBeWoLoginBorderPresent) + if (CurrentView is FrameView) return uc; - BeWoLoginBorder = new BeWoLoginBorder(); - isBeWoLoginBorderPresent = true; + var frame = uc as FrameBase; - BeWoLoginBorder.contentGrid.Children.Clear(); - BeWoLoginBorder.contentGrid.Children.Add(uc); + if (frame is null) + { + throw new NotImplementedException("uc ist kein Frame"); + } - return BeWoLoginBorder; + var view = new FrameView(); + + view.SetFrame(frame); + + return view; } private static void ShowPage(LauncherPageType type) { - bool before = isBeWoLoginBorderPresent; - var page = GetNewPage(type); if (type == LauncherPageType.Login) { - isBeWoLoginBorderPresent = false; - BeWoLoginBorder = null; - - Dispatcher.BeginInvoke(DispatcherPriority.Render, - (Action)delegate - { - LauncherWindow.SetMainContent(page); - }); + CurrentView = page; } - else + else if(page is FrameBase frame) { - // Neu Laden - if (!before) - { - Dispatcher.BeginInvoke(DispatcherPriority.Render, - (Action)delegate - { - LauncherWindow.SetMainContent(page); - }); - } - // Bereits geladen - else - { - Dispatcher.BeginInvoke(DispatcherPriority.Render, - (Action)delegate - { - BeWoLoginBorder.contentGrid.Children.Clear(); - BeWoLoginBorder.contentGrid.Children.Add(page); - }); - } + CurrentFrame = frame; } - - currentPage = type; } } } diff --git a/BeWoLauncher/Logic/Utils/Download/DownloadManager.cs b/BeWoLauncher/Logic/Utils/Download/DownloadManager.cs index 9e4ad20b1..ba5dd3d6b 100644 --- a/BeWoLauncher/Logic/Utils/Download/DownloadManager.cs +++ b/BeWoLauncher/Logic/Utils/Download/DownloadManager.cs @@ -149,7 +149,12 @@ namespace BeWoLauncher.Utils.Download Thread.Sleep(500); - FileController.RemoveFiles(BeWoPaths.ActualPlanerLocation); + var t = new PlanerPackageInfoDC() + { + Files = new List() + }; + + FileController.RemoveUnsuedFiles(t, BeWoPaths.ActualPlanerLocation, apply); } } } diff --git a/BeWoLauncher/View/Components/ExceptionMessageBox.xaml.cs b/BeWoLauncher/View/Components/ExceptionMessageBox.xaml.cs index 883fde3f4..4aba2dbb1 100644 --- a/BeWoLauncher/View/Components/ExceptionMessageBox.xaml.cs +++ b/BeWoLauncher/View/Components/ExceptionMessageBox.xaml.cs @@ -42,9 +42,9 @@ namespace BeWoLauncher.Components private void Button_Click(object sender, RoutedEventArgs e) { - if(ViewController.LauncherWindow != null) + if(ViewController.CurrentWindow != null) { - ViewController.LauncherWindow.CloseCurrentPopUp(); + ViewController.CurrentWindow.CloseCurrentPopUp(); } } } diff --git a/BeWoLauncher/View/Pages/BeWoLoginBorder.xaml b/BeWoLauncher/View/FrameView.xaml similarity index 95% rename from BeWoLauncher/View/Pages/BeWoLoginBorder.xaml rename to BeWoLauncher/View/FrameView.xaml index 23df27dd8..98c31b4a3 100644 --- a/BeWoLauncher/View/Pages/BeWoLoginBorder.xaml +++ b/BeWoLauncher/View/FrameView.xaml @@ -1,4 +1,4 @@ - + diff --git a/BeWoLauncher/View/Pages/GenericProgressInfo.xaml.cs b/BeWoLauncher/View/Frames/GenericProgressFrame.xaml.cs similarity index 58% rename from BeWoLauncher/View/Pages/GenericProgressInfo.xaml.cs rename to BeWoLauncher/View/Frames/GenericProgressFrame.xaml.cs index 4aef2535e..84a3fb603 100644 --- a/BeWoLauncher/View/Pages/GenericProgressInfo.xaml.cs +++ b/BeWoLauncher/View/Frames/GenericProgressFrame.xaml.cs @@ -29,15 +29,17 @@ using BS.SharedLauncher.Information; using BS.SharedLauncher.Update; using Path = System.IO.Path; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { /// /// Interaktionslogik für UpdateView.xaml /// - public abstract partial class GenericProgressInfo : UserControl + public abstract partial class GenericProgressInfo : FrameBase { public readonly BackgroundWorker Worker = new BackgroundWorker(); + private int lastStep = -1; + public GenericProgressInfo() { InitializeComponent(); @@ -46,6 +48,9 @@ namespace BeWoLauncher.View.Pages proBar1.Minimum = 0; proBar1.Maximum = 100; + proBar2.IsIndeterminate = true; + proBar2.Minimum = 0; + Loaded += (s, e) => Start(); } @@ -62,11 +67,25 @@ namespace BeWoLauncher.View.Pages public abstract void Start(); - public void BarActivate() => proBar1.IsIndeterminate = false; - public void BarDeactivate() => proBar1.IsIndeterminate = true; - public void BarSetLimit(int max) => proBar1.Maximum = max; - public void BarMakeStep() => proBar1.Value++; - public void BarHide() => proBar1.Visibility = Visibility.Collapsed; - public void BarShow() => proBar1.Visibility = Visibility.Visible; + public void Bar1Activate() => proBar1.IsIndeterminate = false; + public void Bar1Deactivate() => proBar1.IsIndeterminate = true; + public void Bar1SetLimit(int max) => proBar1.Maximum = max; + public void Bar1MakeStep() => proBar1.Value++; + public void Bar1Hide() => proBar1.Visibility = Visibility.Collapsed; + public void Bar1Show() => proBar1.Visibility = Visibility.Visible; + + public void Bar2Activate() => proBar2.IsIndeterminate = false; + public void Bar2Deactivate() => proBar2.IsIndeterminate = true; + public void Bar2SetLimit(int max) => proBar2.Maximum = max; + public void Bar2MakeStep(int step) + { + if(step > lastStep) + { + lastStep = step; + proBar2.Value++; + } + } + public void Bar2Hide() => proBar2.Visibility = Visibility.Collapsed; + public void Bar2Show() => proBar2.Visibility = Visibility.Visible; } } diff --git a/BeWoLauncher/View/Pages/InfoScreen.xaml b/BeWoLauncher/View/Frames/InfoFrame.xaml similarity index 89% rename from BeWoLauncher/View/Pages/InfoScreen.xaml rename to BeWoLauncher/View/Frames/InfoFrame.xaml index 31fe0e54d..e46e1c8d1 100644 --- a/BeWoLauncher/View/Pages/InfoScreen.xaml +++ b/BeWoLauncher/View/Frames/InfoFrame.xaml @@ -1,9 +1,9 @@ - @@ -17,4 +17,4 @@ - + diff --git a/BeWoLauncher/View/Pages/InfoScreen.xaml.cs b/BeWoLauncher/View/Frames/InfoFrame.xaml.cs similarity index 91% rename from BeWoLauncher/View/Pages/InfoScreen.xaml.cs rename to BeWoLauncher/View/Frames/InfoFrame.xaml.cs index 60efe02c4..a23a79ae0 100644 --- a/BeWoLauncher/View/Pages/InfoScreen.xaml.cs +++ b/BeWoLauncher/View/Frames/InfoFrame.xaml.cs @@ -13,16 +13,16 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { /// /// Interaktionslogik für ErrorScreen.xaml /// - public partial class InfoScreen : UserControl + public partial class InfoFrame : FrameBase { public event EventHandler Button1Click; - public InfoScreen() + public InfoFrame() { InitializeComponent(); } diff --git a/BeWoLauncher/View/Pages/InstallInfo.xaml b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml similarity index 94% rename from BeWoLauncher/View/Pages/InstallInfo.xaml rename to BeWoLauncher/View/Frames/InstallInfoFrame.xaml index 4eb727d8f..feb75db1f 100644 --- a/BeWoLauncher/View/Pages/InstallInfo.xaml +++ b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml @@ -1,4 +1,6 @@ - - + diff --git a/BeWoLauncher/View/Pages/InstallInfo.xaml.cs b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml.cs similarity index 96% rename from BeWoLauncher/View/Pages/InstallInfo.xaml.cs rename to BeWoLauncher/View/Frames/InstallInfoFrame.xaml.cs index b8a362df4..e6e29eda0 100644 --- a/BeWoLauncher/View/Pages/InstallInfo.xaml.cs +++ b/BeWoLauncher/View/Frames/InstallInfoFrame.xaml.cs @@ -21,17 +21,17 @@ using System.Windows.Navigation; using System.Windows.Shapes; using Path = System.IO.Path; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { /// /// Interaktionslogik für UpdateInfo1.xaml /// - public partial class InstallInfo : UserControl + public partial class InstallInfoFrame : FrameBase { public event EventHandler Accept; public event EventHandler Abort; - public InstallInfo() + public InstallInfoFrame() { InitializeComponent(); diff --git a/BeWoLauncher/View/Pages/InstallProgressInfo.cs b/BeWoLauncher/View/Frames/InstallProgressInfoFrame.cs similarity index 82% rename from BeWoLauncher/View/Pages/InstallProgressInfo.cs rename to BeWoLauncher/View/Frames/InstallProgressInfoFrame.cs index 9423df641..70b51086e 100644 --- a/BeWoLauncher/View/Pages/InstallProgressInfo.cs +++ b/BeWoLauncher/View/Frames/InstallProgressInfoFrame.cs @@ -12,20 +12,20 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { - public class InstallProgressInfo : GenericProgressInfo + public class InstallProgressInfoFrame : GenericProgressInfo { public event EventHandler InstallSuccessful; public event EventHandler InstallFailed; public DownloadManager Manager => DownloadController.Manager; - public InstallProgressInfo() + public InstallProgressInfoFrame() : base() { - BarSetLimit(Manager.ResponseInfo.FileCount); + Bar1SetLimit(Manager.ResponseInfo.FileCount); - BarDeactivate(); + Bar1Deactivate(); } public override void Start() @@ -78,36 +78,48 @@ namespace BeWoLauncher.View.Pages private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { + Bar2SetLimit(5); + if (e.ProgressPercentage == 0) { Message = "Installation wird vorbereitet..."; SubMessage = "Lade benötigte Pakete herunter..."; + + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 1) { Message = "Installiere Pakete..."; SubMessage = ""; - BarActivate(); + Bar1Activate(); + + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 2) { var args = e.UserState as FileEventArgs; SubMessage = $"{args.Name} wurde erfolgreich von {args.AbsolutePath} installiert!"; - BarMakeStep(); + Bar1MakeStep(); + + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 3) { - BarDeactivate(); + Bar1Deactivate(); Message = "Alte Dateien werden entfernt."; SubMessage = ""; + + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 4) { var args = e.UserState as string; SubMessage = $"{args} wurde entfernt!"; + + Bar2MakeStep(e.ProgressPercentage); } } } diff --git a/BeWoLauncher/View/Pages/LoadingScreen.xaml b/BeWoLauncher/View/Frames/LoadingFrame.xaml similarity index 82% rename from BeWoLauncher/View/Pages/LoadingScreen.xaml rename to BeWoLauncher/View/Frames/LoadingFrame.xaml index b6952fd93..11ff9f3dc 100644 --- a/BeWoLauncher/View/Pages/LoadingScreen.xaml +++ b/BeWoLauncher/View/Frames/LoadingFrame.xaml @@ -1,9 +1,9 @@ - @@ -12,4 +12,4 @@ - + diff --git a/BeWoLauncher/View/Pages/LoadingScreen.xaml.cs b/BeWoLauncher/View/Frames/LoadingFrame.xaml.cs similarity index 88% rename from BeWoLauncher/View/Pages/LoadingScreen.xaml.cs rename to BeWoLauncher/View/Frames/LoadingFrame.xaml.cs index 7642bf920..90bcc89cc 100644 --- a/BeWoLauncher/View/Pages/LoadingScreen.xaml.cs +++ b/BeWoLauncher/View/Frames/LoadingFrame.xaml.cs @@ -13,12 +13,12 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { /// /// Interaktionslogik für LoadingScreen.xaml /// - public partial class LoadingScreen : UserControl + public partial class LoadingScreen : FrameBase { public LoadingScreen() { diff --git a/BeWoLauncher/View/Pages/UninstallInfo.xaml b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml similarity index 87% rename from BeWoLauncher/View/Pages/UninstallInfo.xaml rename to BeWoLauncher/View/Frames/UninstallInfoFrame.xaml index be8c5f56e..6eff23561 100644 --- a/BeWoLauncher/View/Pages/UninstallInfo.xaml +++ b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml @@ -1,8 +1,9 @@ - @@ -16,4 +17,4 @@ - + diff --git a/BeWoLauncher/View/Pages/UninstallInfo.xaml.cs b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml.cs similarity index 87% rename from BeWoLauncher/View/Pages/UninstallInfo.xaml.cs rename to BeWoLauncher/View/Frames/UninstallInfoFrame.xaml.cs index a8cf1b65a..898d450b6 100644 --- a/BeWoLauncher/View/Pages/UninstallInfo.xaml.cs +++ b/BeWoLauncher/View/Frames/UninstallInfoFrame.xaml.cs @@ -13,17 +13,17 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { /// /// Interaktionslogik für UpdateInfo3.xaml /// - public partial class UninstallInfo : UserControl + public partial class UninstallInfoFrame : FrameBase { public event EventHandler Accept; public event EventHandler Abort; - public UninstallInfo() + public UninstallInfoFrame() { InitializeComponent(); } diff --git a/BeWoLauncher/View/Pages/UninstallProgressInfo.cs b/BeWoLauncher/View/Frames/UninstallProgressInfoFrame.cs similarity index 63% rename from BeWoLauncher/View/Pages/UninstallProgressInfo.cs rename to BeWoLauncher/View/Frames/UninstallProgressInfoFrame.cs index aebc739a2..7b0675802 100644 --- a/BeWoLauncher/View/Pages/UninstallProgressInfo.cs +++ b/BeWoLauncher/View/Frames/UninstallProgressInfoFrame.cs @@ -1,4 +1,5 @@ using BeWoLauncher.Logic.Controller; +using BS.SharedLauncher.Update; using System; using System.Collections.Generic; using System.ComponentModel; @@ -7,15 +8,16 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { - public class UninstallProgressInfo : GenericProgressInfo + public class UninstallProgressInfoFrame : GenericProgressInfo { public event EventHandler UninstallSuccessful; - public UninstallProgressInfo() + public UninstallProgressInfoFrame() { - BarDeactivate(); + Bar1Deactivate(); + Bar2Hide(); } public override void Start() @@ -32,7 +34,7 @@ namespace BeWoLauncher.View.Pages void worker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker worker = sender as BackgroundWorker; - + DownloadController.Manager.StartUninstall(worker.ReportProgress); } @@ -50,28 +52,9 @@ namespace BeWoLauncher.View.Pages private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { - if (e.ProgressPercentage == 0) + if (e.ProgressPercentage == 3) { - Message = "Installation wird vorbereitet..."; - SubMessage = "Lade benötigte Pakete herunter..."; - } - else if (e.ProgressPercentage == 1) - { - Message = "Installiere Pakete..."; - SubMessage = ""; - - BarActivate(); - } - else if (e.ProgressPercentage == 2) - { - var args = e.UserState as FileEventArgs; - SubMessage = $"{args.Name} wurde erfolgreich von {args.AbsolutePath} installiert!"; - - BarMakeStep(); - } - else if (e.ProgressPercentage == 3) - { - BarDeactivate(); + Bar1Deactivate(); Message = "Alte Dateien werden entfernt."; SubMessage = ""; diff --git a/BeWoLauncher/View/Pages/UpdateInfo.xaml b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml similarity index 93% rename from BeWoLauncher/View/Pages/UpdateInfo.xaml rename to BeWoLauncher/View/Frames/UpdateInfoFrame.xaml index 5be99e98b..60fd59c63 100644 --- a/BeWoLauncher/View/Pages/UpdateInfo.xaml +++ b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml @@ -1,4 +1,6 @@ - - + diff --git a/BeWoLauncher/View/Pages/UpdateInfo.xaml.cs b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml.cs similarity index 92% rename from BeWoLauncher/View/Pages/UpdateInfo.xaml.cs rename to BeWoLauncher/View/Frames/UpdateInfoFrame.xaml.cs index 617869794..68480b8da 100644 --- a/BeWoLauncher/View/Pages/UpdateInfo.xaml.cs +++ b/BeWoLauncher/View/Frames/UpdateInfoFrame.xaml.cs @@ -17,17 +17,17 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { /// /// Interaktionslogik für UpdateInfo2.xaml /// - public partial class UpdateInfo : UserControl + public partial class UpdateInfoFrame : FrameBase { public event EventHandler Accept; public event EventHandler Abort; - public UpdateInfo() + public UpdateInfoFrame() { InitializeComponent(); diff --git a/BeWoLauncher/View/Pages/UpdateProgressInfo.cs b/BeWoLauncher/View/Frames/UpdateProgressInfoFrame.cs similarity index 82% rename from BeWoLauncher/View/Pages/UpdateProgressInfo.cs rename to BeWoLauncher/View/Frames/UpdateProgressInfoFrame.cs index 0dd76487c..cc3ebf3df 100644 --- a/BeWoLauncher/View/Pages/UpdateProgressInfo.cs +++ b/BeWoLauncher/View/Frames/UpdateProgressInfoFrame.cs @@ -12,19 +12,19 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -namespace BeWoLauncher.View.Pages +namespace BeWoLauncher.View.Frames { - public class UpdateProgressInfo : GenericProgressInfo + public class UpdateProgressInfoFrame : GenericProgressInfo { public event EventHandler UpdateSuccessful; public DownloadManager Manager => DownloadController.Manager; - public UpdateProgressInfo() + public UpdateProgressInfoFrame() { - BarSetLimit(Manager.ResponseInfo.FileCount); + Bar1SetLimit(Manager.ResponseInfo.FileCount); - BarDeactivate(); + Bar1Deactivate(); } public override void Start() @@ -77,36 +77,46 @@ namespace BeWoLauncher.View.Pages private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { + Bar2SetLimit(5); + if (e.ProgressPercentage == 0) { Message = "Update wird vorbereitet..."; SubMessage = "Lade benötigte Pakete herunter..."; + + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 1) { Message = "Aktualisiere Pakete..."; SubMessage = ""; - BarActivate(); + Bar1Activate(); + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 2) { var args = e.UserState as FileEventArgs; SubMessage = $"{args.Name} wurde erfolgreich von {args.AbsolutePath} installiert!"; - BarMakeStep(); + Bar1MakeStep(); + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 3) { - BarDeactivate(); + Bar2Deactivate(); Message = "Alte Dateien werden entfernt."; SubMessage = ""; + + Bar2MakeStep(e.ProgressPercentage); } else if (e.ProgressPercentage == 4) { var args = e.UserState as string; SubMessage = $"{args} wurde entfernt!"; + + Bar2MakeStep(e.ProgressPercentage); } } } diff --git a/BeWoLauncher/View/Pages/01 LoginPage.xaml b/BeWoLauncher/View/LoginView.xaml similarity index 99% rename from BeWoLauncher/View/Pages/01 LoginPage.xaml rename to BeWoLauncher/View/LoginView.xaml index 9eab15aa5..d531b0366 100644 --- a/BeWoLauncher/View/Pages/01 LoginPage.xaml +++ b/BeWoLauncher/View/LoginView.xaml @@ -1,4 +1,4 @@ - /// Interaktionslogik für LoginView.xaml /// - public partial class LoginPage : UserControl, INotifyPropertyChanged + public partial class LoginView : UserControl, INotifyPropertyChanged { public event EventHandler LoginSuccessful; public event PropertyChangedEventHandler PropertyChanged; @@ -66,7 +66,7 @@ namespace BeWoLauncher.View.Pages private string GETSTATUSMESSAGE_URL = "https://support.bewoplaner.de/api/getstate.php?k={0}&t=1&v={1}"; private string GETNETMESSAGE_URL = "https://support.bewoplaner.de/api/getxmlstate.php?k={0}&t=1"; - public LoginPage() + public LoginView() { InitializeComponent(); @@ -195,7 +195,7 @@ namespace BeWoLauncher.View.Pages } private void PasswordBox_Password_OnGotFocus(object sender, RoutedEventArgs e) { - PasswordBox_Password.SelectAll(); + PasswordBox_Password.SelectAll(); } private void button_addProfile_Click(object sender, RoutedEventArgs rea) { diff --git a/BeWoLauncher/View/WindowImp/PopUpWindow.xaml b/BeWoLauncher/View/Windows/PopUpWindow.xaml similarity index 100% rename from BeWoLauncher/View/WindowImp/PopUpWindow.xaml rename to BeWoLauncher/View/Windows/PopUpWindow.xaml diff --git a/BeWoLauncher/View/WindowImp/PopUpWindow.xaml.cs b/BeWoLauncher/View/Windows/PopUpWindow.xaml.cs similarity index 100% rename from BeWoLauncher/View/WindowImp/PopUpWindow.xaml.cs rename to BeWoLauncher/View/Windows/PopUpWindow.xaml.cs diff --git a/SharedLauncher/Logic/FileController.cs b/SharedLauncher/Logic/FileController.cs index 85456eea2..daa9ff677 100644 --- a/SharedLauncher/Logic/FileController.cs +++ b/SharedLauncher/Logic/FileController.cs @@ -66,7 +66,7 @@ namespace BS.SharedLauncher.Logic public static void RemoveFiles(string folder) { - folder.ClearFolder(); + } public static List GetValidDZipPaths(string path)