private void OnAddNewOutputCoordinate(object obj) { var outputCoordItem = obj as OutputCoordinateModel; if (outputCoordItem == null) return; var dlg = new EditOutputCoordinateView(this.DefaultFormatList, GetInUseNames(), new OutputCoordinateModel() { CType = outputCoordItem.CType, Format = outputCoordItem.Format, Name= outputCoordItem.Name, SRName = outputCoordItem.SRName, SRFactoryCode = outputCoordItem.SRFactoryCode }); var vm = dlg.DataContext as EditOutputCoordinateViewModel; vm.WindowTitle = "Add New Output Coordinate"; if (dlg.ShowDialog() == true) { outputCoordItem.Format = vm.Format; CoordinateType type; if (Enum.TryParse<CoordinateType>(vm.CategorySelection, out type)) { outputCoordItem.CType = type; } outputCoordItem.Name = vm.OutputCoordItem.Name; outputCoordItem.SRFactoryCode = vm.OutputCoordItem.SRFactoryCode; outputCoordItem.SRName = vm.OutputCoordItem.SRName; OutputCoordinateList.Add(outputCoordItem); Mediator.NotifyColleagues(CoordinateToolLibrary.Constants.RequestOutputUpdate, null); SaveOutputConfiguration(); } }
private void OnConfigCommand(object obj) { var outputCoordItem = GetOCMByName(obj as string); var InUseNames = GetInUseNames(); InUseNames.Remove(outputCoordItem.Name); var dlg = new EditOutputCoordinateView(this.DefaultFormatList, InUseNames, new OutputCoordinateModel() { CType = outputCoordItem.CType, Format = outputCoordItem.Format, Name = outputCoordItem.Name, SRName = outputCoordItem.SRName, SRFactoryCode = outputCoordItem.SRFactoryCode}); var vm = dlg.DataContext as EditOutputCoordinateViewModel; vm.WindowTitle = "Edit Output Coordinate"; if (dlg.ShowDialog() == true) { outputCoordItem.Name = vm.OutputCoordItem.Name; outputCoordItem.Format = vm.Format; outputCoordItem.SRFactoryCode = vm.OutputCoordItem.SRFactoryCode; outputCoordItem.SRName = vm.OutputCoordItem.SRName; CoordinateType type; if (Enum.TryParse<CoordinateType>(vm.CategorySelection, out type)) { outputCoordItem.CType = type; } Mediator.NotifyColleagues(CoordinateToolLibrary.Constants.RequestOutputUpdate, null); } SaveOutputConfiguration(); }