public virtual void OnConfigCommand(object obj) { if (obj == null || string.IsNullOrWhiteSpace(obj as string)) { return; } var outputCoordItem = GetOCMByName(obj as string); var InUseNames = GetInUseNames(); InUseNames.Remove(outputCoordItem.Name); var dlg = new EditOutputCoordinateView(CoordinateConversionLibraryConfig.AddInConfig.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; if (vm == null) { return; } vm.WindowTitle = Properties.Resources.TitleEditOutputCoordinate; 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; } UpdateOutputs(); } CoordinateConversionLibraryConfig.AddInConfig.SaveConfiguration(); }
private void OnConfigCommand(object obj) { if (obj == null || string.IsNullOrWhiteSpace(obj as string)) { return; } var outputCoordItem = GetOCMByName(obj as string); var InUseNames = GetInUseNames(); InUseNames.Remove(outputCoordItem.Name); var dlg = new EditOutputCoordinateView(CoordinateConversionViewModel.AddInConfig.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(CoordinateConversionLibrary.Constants.RequestOutputUpdate, null); } CoordinateConversionViewModel.AddInConfig.SaveConfiguration(); }
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 OnAddNewOutputCoordinate(object obj) { var outputCoordItem = obj as OutputCoordinateModel; if (outputCoordItem == null) { return; } var dlg = new EditOutputCoordinateView(CoordinateConversionLibraryConfig.AddInConfig.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 = Properties.Resources.TitleAddNewOutputCoordinate; 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; CoordinateConversionLibraryConfig.AddInConfig.OutputCoordinateList.Add(outputCoordItem); UpdateOutputs(); CoordinateConversionLibraryConfig.AddInConfig.SaveConfiguration(); } }