diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-11-19 13:56:28 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-11-19 13:56:28 +0200 |
| commit | dfd0c672c17e85a403ad6452e76ad9f0394b6dd3 (patch) | |
| tree | 248774a124982677b76bca9ae36e6531aa660b80 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels | |
| parent | acbe2b5dc89212a112ed9eec8f58a54803479f68 (diff) | |
| parent | 412f4e542d5c66399e958e7233d04574011af4b4 (diff) | |
| download | Tango-dfd0c672c17e85a403ad6452e76ad9f0394b6dd3.tar.gz Tango-dfd0c672c17e85a403ad6452e76ad9f0394b6dd3.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) |
