diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
| commit | 520e878bf98efcec9c75abcfe483175ff72620a2 (patch) | |
| tree | 62a7221e3c22187821f6a5e399eca0f7bd31168a /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs | |
| parent | 30574fe4a6e1bb4f60a43e9000acaf919811689a (diff) | |
| parent | 25f5e6ddef7ef2fa0a747305847eeb4ceee5a2c9 (diff) | |
| download | Tango-520e878bf98efcec9c75abcfe483175ff72620a2.tar.gz Tango-520e878bf98efcec9c75abcfe483175ff72620a2.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs | 70 |
1 files changed, 67 insertions, 3 deletions
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 16b1c05bc..f5c6f43b9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs @@ -17,11 +17,13 @@ using Tango.PPC.Common.Application; using Tango.PPC.Common.Connection; using Tango.PPC.Common.MachineSetup; using Tango.PPC.Common.Navigation; +using Tango.PPC.Common.OS; using Tango.PPC.UI.ViewsContracts; using Tango.Settings; using Tango.SharedUI.Helpers; using Tango.SQLExaminer; using Tango.Transport.Adapters; +using Tango.Web; namespace Tango.PPC.UI.ViewModels { @@ -47,6 +49,8 @@ namespace Tango.PPC.UI.ViewModels WelcomeView, WiFiSelectionView, WiFiTestView, + TimeZoneView, + EnvironmentView, SetupWelcomeView, SetupProgressView, SetupCompletedView, @@ -54,6 +58,7 @@ namespace Tango.PPC.UI.ViewModels } private MachineSetupResult _setup_result; + private IOperationSystemManager _operationSystemManager; #region Properties @@ -102,6 +107,41 @@ namespace Tango.PPC.UI.ViewModels set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private String _failedError; + /// <summary> + /// Gets or sets the setup failed error. + /// </summary> + public String FailedError + { + get { return _failedError; } + set { _failedError = value; RaisePropertyChangedAuto(); } + } + + /// <summary> + /// Gets or sets the available time zones. + /// </summary> + public List<TimeZoneInfo> TimeZones { get; set; } + + private TimeZoneInfo _selectedTimeZone; + /// <summary> + /// Gets or sets the selected time zone. + /// </summary> + public TimeZoneInfo SelectedTimeZone + { + get { return _selectedTimeZone; } + set { _selectedTimeZone = value; RaisePropertyChangedAuto(); } + } + + private DeploymentSlot _deploymentSlot; + /// <summary> + /// Gets or sets the deployment slot. + /// </summary> + public DeploymentSlot DeploymentSlot + { + get { return _deploymentSlot; } + set { _deploymentSlot = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -126,6 +166,15 @@ namespace Tango.PPC.UI.ViewModels /// </summary> public RelayCommand RestartCommand { get; set; } + /// <summary> + /// Gets or sets the time zone selected command. + /// </summary> + public RelayCommand TimeZoneSelectedCommand { get; set; } + + /// <summary> + /// Gets or sets the environment selected command. + /// </summary> + public RelayCommand EnvironmentSelectedCommand { get; set; } #endregion #region Constructors @@ -135,11 +184,12 @@ namespace Tango.PPC.UI.ViewModels /// </summary> /// <param name="applicationManager">The application manager.</param> /// <param name="machineSetupManager">The machine setup manager.</param> - public MachineSetupViewVM(IPPCApplicationManager applicationManager, IMachineSetupManager machineSetupManager) + public MachineSetupViewVM(IPPCApplicationManager applicationManager, IMachineSetupManager machineSetupManager, IOperationSystemManager operationSystemManager) { MachineSetupManager = machineSetupManager; - HostAddress = Settings.MachineServiceAddress; + DeploymentSlot = Settings.DeploymentSlot; + SerialNumber = ""; CompleteCommand = new RelayCommand(CompleteSetup, () => State == MachineSetupStates.Completed); @@ -150,6 +200,18 @@ namespace Tango.PPC.UI.ViewModels InstallCommand = new RelayCommand(Install); RestartCommand = new RelayCommand(() => { NavigateTo(MachineSetupView.WelcomeView); }); + TimeZoneSelectedCommand = new RelayCommand(() => { NavigateTo(MachineSetupView.EnvironmentView); }); + EnvironmentSelectedCommand = new RelayCommand(() => + { + NavigateTo(MachineSetupView.SetupWelcomeView); + Settings.DeploymentSlot = DeploymentSlot; + HostAddress = Settings.GetMachineServiceAddress(); + }); + + _operationSystemManager = operationSystemManager; + + TimeZones = _operationSystemManager.GetAvailableTimeZones().ToList(); + SelectedTimeZone = TimeZones.SingleOrDefault(x => x.ToString() == "(UTC+02:00) Jerusalem"); } #endregion @@ -239,7 +301,7 @@ namespace Tango.PPC.UI.ViewModels if (connected) { - await NavigateTo(MachineSetupView.SetupWelcomeView); + await NavigateTo(MachineSetupView.TimeZoneView); } else { @@ -273,6 +335,7 @@ namespace Tango.PPC.UI.ViewModels try { + await _operationSystemManager.ChangeTimeZone(SelectedTimeZone); _setup_result = await MachineSetupManager.Setup(SerialNumber, HostAddress); State = MachineSetupStates.Completed; LogManager.Log("Machine setup completed."); @@ -281,6 +344,7 @@ namespace Tango.PPC.UI.ViewModels catch (Exception ex) { LogManager.Log(ex, "Machine setup failed."); + FailedError = ex.FlattenMessage(); State = MachineSetupStates.Failed; await NavigateTo(MachineSetupView.SetupFailedView); } |
