private void rotationRenameButton_Click(object sender, RoutedEventArgs e) { if (m_loadingCalculationOptions) { return; } Rotation rotation = m_calcOpts.GetActiveRotation(); TextInputDialog d = new TextInputDialog("Rename Rotation", "Rename to:", rotation.Name, m_calcOpts.Rotations.Select(x => x.Name).Where(x => x != rotation.Name)); d.Closed += new EventHandler((a, b) => { if (d.DialogResult.GetValueOrDefault()) { rotation.Name = d.Result; RefreshRotationPanel(); Character.OnCalculationsInvalidated(); } }); d.Show(); }
private void newRotationButton_Click(object sender, RoutedEventArgs e) { if (m_loadingCalculationOptions) { return; } TextInputDialog d = new TextInputDialog("New Rotation", "Choose a name:", "", m_calcOpts.Rotations.Select(x => x.Name)); d.Closed += new EventHandler((a, b) => { if (d.DialogResult.GetValueOrDefault()) { m_calcOpts.Rotations.Add(new Rotation(d.Result, "Shadow Bolt", null)); m_calcOpts.ActiveRotationIndex = m_calcOpts.Rotations.Count - 1; RefreshRotationPanel(); Character.OnCalculationsInvalidated(); } }); d.Show(); }
private string PromptForRotationName(string title, string start) { string error = null; while (true) { string message = "Choose a name:"; if (error != null) { message = error + message; } string name = TextInputDialog.Show(title, message, start); if (name == null) { return(null); } if (name.Length == 0) { error = "The name cannot be blank. "; continue; } error = null; foreach (Rotation rotation in _options.Rotations) { if (rotation.Name == name) { error = "There is already a rotation by that name. "; break; } } if (error == null) { return(name); } } }
public static void Show(string title, string message, string start) { d = new TextInputDialog(title, message, start); d.Closed += new EventHandler(Dialog_Closed); d.Show(); }