From 998cc8d4d91a7f85389cd0918f127257576c2c13 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 13 Aug 2018 16:12:45 +0300 Subject: Logs and comments for PPC.UI ! --- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 92 ++++++++++++++++------ 1 file changed, 66 insertions(+), 26 deletions(-) (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs') 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 268f42ce9..3bcacc989 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -28,6 +28,8 @@ namespace Tango.PPC.UI.ViewModels [TangoInject] public IPPCModuleLoader ModuleLoader { get; set; } + #region Properties + private bool _isMenuOpened; /// /// Gets or sets a value indicating whether the side menu is opened. @@ -48,6 +50,10 @@ namespace Tango.PPC.UI.ViewModels set { _isNotificationsOpened = value; RaisePropertyChangedAuto(); } } + #endregion + + #region Commands + /// /// Gets or sets the module navigation command. /// @@ -78,6 +84,10 @@ namespace Tango.PPC.UI.ViewModels /// public RelayCommand SignOutCommand { get; set; } + #endregion + + #region Constructors + /// /// Initializes a new instance of the class. /// @@ -92,8 +102,17 @@ namespace Tango.PPC.UI.ViewModels SignOutCommand = new RelayCommand(SignOut); } + #endregion + + #region Private Methods + + /// + /// Stops the printing. + /// private void StopPrinting() { + LogManager.Log("Stop printing layout command pressed!"); + if (_jobHandler != null) { _jobHandler.Cancel(); @@ -107,10 +126,12 @@ namespace Tango.PPC.UI.ViewModels { if (NavigationManager.CanNavigateBack) { + LogManager.Log("Back command pressed."); NavigationManager.NavigateBack(); } else { + LogManager.Log("Menu command pressed."); IsMenuOpened = true; } } @@ -121,6 +142,7 @@ namespace Tango.PPC.UI.ViewModels /// Name of the module. private void NavigateToModule(string moduleName) { + LogManager.Log("Navigate to module command pressed."); IsMenuOpened = false; NavigationManager.NavigateTo(moduleName); } @@ -130,33 +152,48 @@ namespace Tango.PPC.UI.ViewModels /// private void NavigateHome() { + LogManager.Log("Navigate home command pressed."); IsMenuOpened = false; NavigationManager.NavigateTo(NavigationView.HomeModule); } /// - /// Called when the application has been started. + /// Represents an event that is raised when the sign-out operation is complete. /// - public override void OnApplicationStarted() + private void SignOut() { - base.OnApplicationStarted(); - ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded; - MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; + LogManager.Log("SignOut command pressed."); + AuthenticationProvider.LogOut(); + IsMenuOpened = false; } - private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) + /// + /// Opens the first notification or display all. + /// + private void OpenFirstNotificationOrDisplayAll() { - _jobHandler = e.JobHandler; + if (NotificationProvider.NotificationItems.Count == 1) + { + //Open first + } + else + { + IsNotificationsOpened = true; + } } + #endregion + + #region Override Methods + /// - /// Handles the ModulesLoaded event of the ModuleLoader. + /// Called when the application has been started. /// - /// The source of the event. - /// The instance containing the event data. - private void ModuleLoader_ModulesLoaded(object sender, EventArgs e) + public override void OnApplicationStarted() { - View.ApplyModules(ModuleLoader.UserModules); + base.OnApplicationStarted(); + ModuleLoader.ModulesLoaded += ModuleLoader_ModulesLoaded; + MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; } /// @@ -167,28 +204,31 @@ namespace Tango.PPC.UI.ViewModels } + #endregion + + #region Event Handlers + /// - /// Represents an event that is raised when the sign-out operation is complete. + /// Handles the PrintingStarted event of the MachineOperator. /// - private void SignOut() + /// The source of the event. + /// The instance containing the event data. + private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { - AuthenticationProvider.LogOut(); - IsMenuOpened = false; + _jobHandler = e.JobHandler; } /// - /// Opens the first notification or display all. + /// Handles the ModulesLoaded event of the ModuleLoader. /// - private void OpenFirstNotificationOrDisplayAll() + /// The source of the event. + /// The instance containing the event data. + private void ModuleLoader_ModulesLoaded(object sender, EventArgs e) { - if (NotificationProvider.NotificationItems.Count == 1) - { - //Open first - } - else - { - IsNotificationsOpened = true; - } + LogManager.Log("Modules loaded. Applying modules to main navigation control..."); + View.ApplyModules(ModuleLoader.UserModules); } + + #endregion } } -- cgit v1.3.1