コード例 #1
0
        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);
            }
        }
コード例 #2
0
        private static void SelectedInterfaceChanged(DependencyObject obj, DependencyPropertyChangedEventArgs args)
        {
            AddInterfaceDialog dialog = obj as AddInterfaceDialog;

            if (dialog != null)
            {
                dialog.AddButton.IsEnabled = (args.NewValue != null);
            }
        }
コード例 #3
0
ファイル: MainWindow.xaml.cs プロジェクト: Heliflyer/helios
        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);
            }
        }