From f3fc87dd10b3d55591a84ecbfb0612769f0c09b9 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 28 Aug 2018 16:35:16 +0300 Subject: Working on BL Builders ! Working on making PPC work with builders.. --- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 12 ----------- .../PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs | 24 ++++++++++++---------- 2 files changed, 13 insertions(+), 23 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 3bcacc989..28692cdfa 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -192,7 +192,6 @@ namespace Tango.PPC.UI.ViewModels public override void OnApplicationStarted() { base.OnApplicationStarted(); - ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded; MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; } @@ -218,17 +217,6 @@ namespace Tango.PPC.UI.ViewModels _jobHandler = e.JobHandler; } - /// - /// Handles the ModulesLoaded event of the ModuleLoader. - /// - /// The source of the event. - /// The instance containing the event data. - private void ModuleLoader_ModulesLoaded(object sender, EventArgs e) - { - LogManager.Log("Modules loaded. Applying modules to main navigation control..."); - View.ApplyModules(ModuleLoader.UserModules); - } - #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs index 812f10121..9d17a4a76 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoginViewVM.cs @@ -84,6 +84,16 @@ namespace Tango.PPC.UI.ViewModels AuthenticationProvider.CurrentUserChanged += AuthenticationProvider_CurrentUserChanged; } + public override async void OnApplicationReady() + { + base.OnApplicationReady(); + + await Task.Delay(500); + LogManager.Log("Application is ready! Navigating to home module..."); + await NavigationManager.NavigateTo(NavigationView.HomeModule); + IsLoading = false; + } + #endregion #region Event Handlers @@ -108,7 +118,7 @@ namespace Tango.PPC.UI.ViewModels /// /// Login to the application using the user name and password. /// - private void Login() + private async void Login() { LogManager.Log("Login command pressed."); @@ -117,21 +127,13 @@ namespace Tango.PPC.UI.ViewModels IsLoading = true; UIHelper.DoEvents(); - var user = AuthenticationProvider.Login(Email, Password); + var user = await AuthenticationProvider.Login(Email, Password); if (user == null) { IsLoading = false; - NotificationProvider.ShowWarning("Email or password are incorrect."); + await NotificationProvider.ShowWarning("Email or password are incorrect."); } - - ApplicationManager.ModulesInitialized += async (_, __) => - { - await Task.Delay(500); - LogManager.Log("Modules initialized. Navigating to home module..."); - await NavigationManager.NavigateTo(NavigationView.HomeModule); - IsLoading = false; - }; } else { -- cgit v1.3.1