private void AddInterface_Executed(object sender, ExecutedRoutedEventArgs e) { AddInterfaceDialog dialog = new AddInterfaceDialog(Profile); dialog.Owner = this; try { Nullable <bool> result = dialog.ShowDialog(); if (result == true && dialog.SelectedInterface != null) { string name = dialog.SelectedInterface.Name; int count = 0; while (Profile.Interfaces.ContainsKey(name)) { name = dialog.SelectedInterface.Name + " " + ++count; } dialog.SelectedInterface.Name = name; ConfigManager.UndoManager.AddUndoItem(new InterfaceAddUndoEvent(Profile, dialog.SelectedInterface)); Profile.Interfaces.Add(dialog.SelectedInterface); AddNewDocument(dialog.SelectedInterface); } } catch (Exception ex) { ConfigManager.LogManager.LogError("AddInterface - Error during add Interface dialog or creation", ex); } }
private static void SelectedInterfaceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args) { AddInterfaceDialog dialog = obj as AddInterfaceDialog; if (dialog != null) { dialog.AddButton.IsEnabled = (args.NewValue != null); } }
private void AddInterface_Executed(object sender, ExecutedRoutedEventArgs e) { AddInterfaceDialog dialog = new AddInterfaceDialog(Profile); dialog.Owner = this; try { Nullable<bool> result = dialog.ShowDialog(); if (result == true && dialog.SelectedInterface != null) { string name = dialog.SelectedInterface.Name; int count = 0; while (Profile.Interfaces.ContainsKey(name)) { name = dialog.SelectedInterface.Name + " " + ++count; } dialog.SelectedInterface.Name = name; ConfigManager.UndoManager.AddUndoItem(new InterfaceAddUndoEvent(Profile, dialog.SelectedInterface)); Profile.Interfaces.Add(dialog.SelectedInterface); AddNewDocument(dialog.SelectedInterface); } } catch (Exception ex) { ConfigManager.LogManager.LogError("AddInterface - Error during add Interface dialog or creation", ex); } }