/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CreateNamedVar_Executed(object sender, ExecutedRoutedEventArgs e) { NewNamedVarWindow win = new NewNamedVarWindow(); win.Title = "New Named Variable"; win.InputName = "name of the variable"; win.IsValidInputNameCallback = NamedVariableManager.Instance.IsValidName; win.Owner = MainWindow.Instance; if (win.ShowDialog() == false) { return; } NamedVariableManager.Instance.Add( win.InputName, VariableTypeInspector.CreateDefaultValueFromType(Type.GetType(win.InputType))); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RenameNamedVar_Executed(object sender, ExecutedRoutedEventArgs e) { if (listBoxGraphNamedVars.SelectedItem != null && listBoxGraphNamedVars.SelectedItem is NamedVariable) { NamedVariable var = listBoxGraphNamedVars.SelectedItem as NamedVariable; NewNamedVarWindow win = new NewNamedVarWindow(var); win.Title = "Rename Named Variable"; win.IsValidInputNameCallback = NamedVariableManager.Instance.IsValidName; win.Owner = MainWindow.Instance; if (win.ShowDialog() == false) { return; } var.Name = win.InputName; } }