diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-11-19 20:06:04 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-11-19 20:06:04 +0200 |
| commit | ff9195677a0bb9c31b7455f948f41a654010d3b1 (patch) | |
| tree | 2f42b8431516d55e39b72572efdba151ef34c5ab /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels | |
| parent | c4f90b0f6cee6414959e55f0dfc0d866b97a6036 (diff) | |
| parent | c534a40638a27932f756acaa14cb045ac571a40e (diff) | |
| download | Tango-ff9195677a0bb9c31b7455f948f41a654010d3b1.tar.gz Tango-ff9195677a0bb9c31b7455f948f41a654010d3b1.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs index 9c4c2281d..68c4b4ae2 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs @@ -28,6 +28,7 @@ using Tango.MachineStudio.RML.Models; using Tango.BL.ActionLogs; using Tango.MachineStudio.Common.Authentication; using Tango.BL.DTO; +using Tango.Core.Cryptography; namespace Tango.MachineStudio.MachineDesigner.ViewModels { @@ -504,6 +505,7 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.IsDeviceRegistered = false; ActiveMachine.DeviceId = null; ActiveMachine.DeviceName = null; + ActiveMachine.ActivationKey = null; ActiveMachineAdapter.Context.Machines.Add(ActiveMachine); } } @@ -642,6 +644,17 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels ActiveMachine.Configuration.HardwareVersionChanged += Configuration_HardwareVersionChanged; + while (ActiveMachine.ActivationKey == null) //Generate a random password and make sure no machine matches it. + { + ActiveMachine.ActivationKey = PasswordGenerator.Generate(8, PasswordGenerator.PasswordType.Alpha, PasswordGenerator.PasswordCasing.Upper); + if (await ActiveMachineAdapter.Context.Machines.Where(x => x.ActivationKey == ActiveMachine.ActivationKey).CountAsync() == 0) + { + break; + } + + ActiveMachine.ActivationKey = null; + } + View.NavigateTo(MachineDesignerNavigationView.MachineDetailsView); } catch (Exception ex) |
