diff options
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs')
| -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(); |
