public LineModifiersEditorWindow(SpellLineModifiers modifiers, bool isEditMode = true) : this() { actionComboBox.SelectedItem = modifiers.Action; scopeComboBox.SelectedItem = modifiers.Scope; scopeNameTextBox.Text = modifiers.ScopeName; valueUpDown.Value = modifiers.Value; minThresholdUpDown.Value = modifiers.MinThreshold; maxThresholdUpDown.Value = modifiers.MaxThreshold; this.IsEditMode = isEditMode; if (this.IsEditMode) { this.Title = "Edit Modifiers"; } }
bool RemoveModifiers(SpellLineModifiers modifiers) { var staff = stavesListBox.SelectedItem as StaffMetadata; if (staff == null) { return(false); } var wasRemoved = staff.RemoveModifiers(modifiers); if (wasRemoved) { lineModifiersListBox.Items.Refresh(); } return(wasRemoved); }
void EditModifiers(StaffMetadata staff, SpellLineModifiers modifiers) { var modifiersWindow = new LineModifiersEditorWindow(modifiers); modifiersWindow.Owner = this; var result = modifiersWindow.ShowDialog(); if (!result.HasValue || !result.Value) { return; } staff.ChangeModifiers(modifiers, modifiersWindow.Modifiers); lineModifiersListBox.Items.Refresh(); lineModifiersListBox.SelectedItem = modifiers; lineModifiersListBox.ScrollIntoView(modifiers); }