private void OnNewClassButtonClick(object sender, EventArgs e) { Model = new ClassModel(); PopulateFields(Model.Name); AutoGrantedFeatsPanel.Clear(); AutoGrantedFeatsPanel.Initialize("Class", Model.Id); }
private void OnClassListBoxSelectedIndexChanged(object sender, EventArgs e) { if (ClassListBox.SelectedIndex == -1) { return; } if (DataChangeWarning() == false) { return; } Model = new ClassModel(); Model.Initialize(ClassListBox.SelectedItem.ToString()); PopulateFields(Model.Name); AutoGrantedFeatsPanel.Clear(); AutoGrantedFeatsPanel.Initialize("Class", Model.Id); }
public DataInputClassScreenClass() { string controlName; ComboBox bonusFeatTypeCombo; AllowChangeEvents = false; InitializeComponent(); Model = new ClassModel(); ClassNames = ClassModel.GetNames(); foreach (string Name in ClassNames) { ClassListBox.Items.Add(Name); } FeatTypeNames = FeatTypeModel.GetNames(); //selections for the bonus feat box selectors for (int i = 1; i <= Constant.NumHeroicLevels; i++) { controlName = "BonusFeatComboBox" + i; bonusFeatTypeCombo = Controls[controlName] as ComboBox; bonusFeatTypeCombo.Items.Add(""); foreach (string Name in FeatTypeNames) { bonusFeatTypeCombo.Items.Add(Name); } } PopulateFields(ClassNames[0]); ClassListBox.SelectedIndex = 0; AutoGrantedFeatsPanel.Initialize("Class", Model.Id); DataHasChanged = false; AllowChangeEvents = true; }
/// <summary> /// Save the data from the model into the database /// </summary> private void SaveScreen() { int selected; SaveLabel.ForeColor = Color.Green; SaveLabel.Text = "Saving Record..."; SaveLabel.Refresh(); Model.Save(); //Autogranted feats AutoGrantedFeatsPanel.UpdateMainRecordId(Model.Id); AutoGrantedFeatsPanel.SaveAutoGrantedFeats(); DataHasChanged = false; //repopulate the class list (in case any of the names have changed or new ones added) selected = ClassListBox.SelectedIndex; ClassListBox.Items.Clear(); ClassNames = ClassModel.GetNames(SortDisplayOrderRadioButton.Checked == true); foreach (string Name in ClassNames) { ClassListBox.Items.Add(Name); } ClassListBox.SelectedIndex = selected; //update the modification fields ModDateLabel.Text = Model.LastUpdatedDate.ToString(); ModVersionLabel.Text = Model.LastUpdatedVersion; //cache the name and abbreviation strings for later comparisons // (we have now updated the databse, so update these as well) DatabaseName = Model.Name; DatabaseAbbreviation = Model.Abbreviation; SaveLabel.ForeColor = Color.Green; SaveLabel.Text = "Record Saved"; }