diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-12 19:00:36 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-12 19:00:36 +0300 |
| commit | 18fc4053deb06af6643f28a6bb4fd66c6a9a93e0 (patch) | |
| tree | db2e3b344e30a95a3a09d662930ce129246a57d9 /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels | |
| parent | bbbc155a96729050b9aa7d966055726df46696af (diff) | |
| download | Tango-18fc4053deb06af6643f28a6bb4fd66c6a9a93e0.tar.gz Tango-18fc4053deb06af6643f28a6bb4fd66c6a9a93e0.zip | |
Implemented temporary DB user login for machine service machine setup.
Implemented Tango updater!
Implemented support for software update on machine setup.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs | 33 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs | 33 |
2 files changed, 11 insertions, 55 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs index 2a76ba80f..77767d588 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -26,12 +26,8 @@ namespace Tango.PPC.UI.ViewModels /// Represents the PPC loading splash screen view model. /// </summary> /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> - public class LoadingViewVM : PPCViewModel, INavigationObjectReceiver<MachineSetupResult> + public class LoadingViewVM : PPCViewModel { - private bool _setup; - private SetupRequiredEventArgs _setupArgs; - private bool _post_setup; - /// <summary> /// Gets or sets the module loader. /// </summary> @@ -55,42 +51,17 @@ namespace Tango.PPC.UI.ViewModels { if (!DesignMode) { - applicationManager.SetupRequired += ApplicationManager_SetupRequired; Task.Delay(1000).ContinueWith((x) => { IsLoading = true; }); } } - private void ApplicationManager_SetupRequired(object sender, SetupRequiredEventArgs e) - { - _setupArgs = e; - _setup = true; - NavigationManager.NavigateTo(NavigationView.MachineSetupView); - } - /// <summary> /// Called when the application has been started. /// </summary> public override void OnApplicationStarted() { IsLoading = false; - - if (!_setup || _post_setup) - { - NavigationManager.NavigateTo(NavigationView.LoginView); - } - } - - public async void OnNavigatedToWithObject(MachineSetupResult machineSetupResult) - { - if (machineSetupResult.Completed) - { - _post_setup = true; - _setup = false; - IsLoading = true; - - await Task.Delay(500); - _setupArgs.Continue(); - } + NavigationManager.NavigateTo(NavigationView.LoginView); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs index 7b4016341..2877d52b3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Data.SqlClient; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core; using Tango.Core.Commands; +using Tango.Core.Helpers; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.MachineSetup; @@ -27,9 +29,7 @@ namespace Tango.PPC.UI.ViewModels Failed, } - private bool _postSetp; - - private SetupRequiredEventArgs _setupRequiredEventArgs; + private MachineSetupResult _setup_result; public IMachineSetupManager MachineSetupManager { get; set; } @@ -80,24 +80,9 @@ namespace Tango.PPC.UI.ViewModels applicationManager.SetupRequired += ApplicationManager_SetupRequired; } - private void ApplicationManager_SetupRequired(object sender, SetupRequiredEventArgs e) - { - _setupRequiredEventArgs = e; - } - - public override void OnApplicationStarted() - { - base.OnApplicationStarted(); - - if (_postSetp) - { - NavigationManager.NavigateTo(Common.Navigation.NavigationView.LoginView); - } - } - - public override void OnNavigatedTo() + private void ApplicationManager_SetupRequired(object sender, EventArgs e) { - base.OnNavigatedTo(); + NavigationManager.NavigateTo(NavigationView.MachineSetupView); } private void AppendLog(String msg) @@ -117,9 +102,8 @@ namespace Tango.PPC.UI.ViewModels try { - await MachineSetupManager.Setup(SerialNumber, HostAddress); - Settings.HasSetup = true; - _postSetp = true; + _setup_result = await MachineSetupManager.Setup(SerialNumber, HostAddress); + Settings.ApplicationState = ApplicationStates.SemiSetup; Settings.Save(); State = MachineSetupStates.Completed; } @@ -132,7 +116,8 @@ namespace Tango.PPC.UI.ViewModels private void CompleteSetup() { - NavigationManager.NavigateWithObject(NavigationView.LoadingView, new MachineSetupResult() { Completed = true }); + Process.Start(AssemblyHelper.GetCurrentAssemblyFolder() + "\\Tango.PPC.Updater.exe", _setup_result.UpdatePackagePath); + Environment.Exit(0); } } } |
