diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-05-23 12:04:55 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2021-05-23 12:04:55 +0300 |
| commit | b2d8f58efc111777678513f879827c2cea4fc6a6 (patch) | |
| tree | 57be4889c333b06f159bc889569cb363e87f6da1 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels | |
| parent | c7071e23d1891983c2faef40107a165787229872 (diff) | |
| download | Tango-b2d8f58efc111777678513f879827c2cea4fc6a6.tar.gz Tango-b2d8f58efc111777678513f879827c2cea4fc6a6.zip | |
Fixed issue with RML creation name validation on MS.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index 272316b02..2a1bc1bbb 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -276,7 +276,7 @@ namespace Tango.MachineStudio.RML.ViewModels public override void OnApplicationReady() { - + } private async Task LoadRmls() @@ -490,10 +490,13 @@ namespace Tango.MachineStudio.RML.ViewModels if (!String.IsNullOrWhiteSpace(name)) { - if (Rmls.ToList().Exists(x => x.Name == name)) + using (ObservablesContext db = ObservablesContext.CreateDefault()) { - _notification.ShowError("The specified RML name already exists. Please select a different name."); - return; + if (await db.Rmls.AnyAsync(x => x.Name == name)) + { + _notification.ShowError("The specified RML name already exists. Please select a different name."); + return; + } } using (_notification.PushTaskItem("Creating new RML...")) @@ -638,6 +641,13 @@ namespace Tango.MachineStudio.RML.ViewModels using (var context = ObservablesContext.CreateDefault()) { + if (await context.Rmls.AnyAsync(x => x.Name == name)) + { + _notification.ShowError("The specified RML name already exists. Please select a different name."); + IsFree = true; + return; + } + var rml = await new RmlBuilder(context).Set(SelectedRML.Guid).WithActiveParametersGroup().WithLiquidFactors().WithSpools().BuildAsync(); Rml cloned = new Rml(); |
