private void ModifierDialogClass_Load(object sender, EventArgs e) { //Lets fill our ComboBoxes that don't change FillcomboBonusType(); FillcomboCategory(); FillcomboModifierMethod(); FillcomboStance(); if (SelectedModifierType == 0) { radioPassive.Checked = true; } else { radioStance.Checked = true; } comboModifierMethod.SelectedItem = ModifierMethodModel.GetMethodNameFromId(SelectedModifierMethodId); if (isNewRecord == true) { comboCategory.SelectedIndex = -1; buttonOk.Enabled = false; } else { comboCategory.SelectedItem = GetCategoryName(SelectedModifierId); } if (isNewRecord == false && SelectedStanceId != Guid.Empty) { comboStance.SelectedItem = StanceModel.GetStanceNameFromId(SelectedStanceId); } }
private string GetRequirementString(Guid requirementId, string comparison, double requirementValue, Guid stanceId) { string text = ""; if (requirementId != Guid.Empty) { text = RequirementModel.GetNameFromId(requirementId) + " " + comparison + " " + requirementValue.ToString(); } if (stanceId != Guid.Empty) { if (requirementId != Guid.Empty) { text += ", "; } text += "while in " + StanceModel.GetStanceNameFromId(stanceId) + " stance"; } return(text); }
private void PopulateFields(string featName) { List <FeatFeatTypeModel> featTypeModels; List <FeatTargetModel> featTargetModels; Model = new FeatModel(); Model.Initialize(featName); featTypeModels = FeatFeatTypeModel.GetAllByFeatId(Model.Id); featTargetModels = FeatTargetModel.GetAllByFeatId(Model.Id); //set our Database values for Error checkign unique values. DatabaseName = Model.Name; //set the main control values NameInputBox.Text = Model.Name; CategoryFeatComboBox.SelectedItem = FeatCategoryModel.GetNameFromId(Model.FeatCategoryId); ParentFeatCheckBox.Checked = Model.IsParentFeat; MultiplesCheckBox.Checked = Model.Multiple; ParentFeatComboBox.SelectedItem = FeatModel.GetNameFromId(Model.ParentFeat); StanceComboBox.SelectedItem = StanceModel.GetStanceNameFromId(Model.StanceId); IconFileNameInputBox.Text = Model.ImageFileName; FeatIcon = new IconClass("Feats\\" + Model.ImageFileName); FeatIcon.SetLocation(this.Width, this.Height, FeatIconLocation); DurationTextBox.Text = Model.Duration; //System tracking labels RecordGUIDLabel.Text = Model.Id.ToString(); ModDateLabel.Text = Model.LastUpdatedDate.ToString(); ModVersionLabel.Text = Model.LastUpdatedVersion; //DescriptionWebBrowser control DescriptionHtmlEditor.Text = Model.Description; //Set the FeatTypes //clear previous values if any. FeatTypesSelected = new List <FeatTypeSelection>(); foreach (int i in FeatTypesCheckedListBox.CheckedIndices) { FeatTypesCheckedListBox.SetItemChecked(i, false); } if (featTypeModels != null) { foreach (FeatFeatTypeModel ftmodel in featTypeModels) { FeatTypesSelected.Add(new FeatTypeSelection()); FeatTypesSelected[FeatTypesSelected.Count - 1].Model = ftmodel; FeatTypesSelected[FeatTypesSelected.Count - 1].DeleteRecord = false; FeatTypesCheckedListBox.SetItemChecked(FeatTypesCheckedListBox.FindStringExact(FeatTypeModel.GetNameFromId(ftmodel.FeatTypeId)), true); } } //Set the FeatTargets, clear previous values if any. FeatTargetsSelected = new List <FeatTargetSelection>(); foreach (int i in FeatTargetsCheckedListBox.CheckedIndices) { FeatTargetsCheckedListBox.SetItemChecked(i, false); } if (featTargetModels != null) { foreach (FeatTargetModel ftmodel in featTargetModels) { FeatTargetsSelected.Add(new FeatTargetSelection()); FeatTargetsSelected[FeatTargetsSelected.Count - 1].Model = ftmodel; FeatTargetsSelected[FeatTargetsSelected.Count - 1].DeleteRecord = false; FeatTargetsCheckedListBox.SetItemChecked(FeatTargetsCheckedListBox.FindStringExact(TargetModel.GetNameFromId(ftmodel.TargetId)), true); } } //Set the the requirements panel FeatRequirementsRP2.Clear(); FeatRequirementsRP2.RecordId = Model.Id; FeatRequirementsRP2.Initialize(); //Set the modifiers panel MP2Modifiers.Clear(); MP2Modifiers.RecordId = Model.Id; MP2Modifiers.Initialize(); //Invalidate the screen to update graphics Invalidate(); }
private void EditModifierDialogClass_Load(object sender, EventArgs e) { string methodName; methodName = ""; AllowEvents = false; //Fill our standard ComboBoxes FillModifierMethodComboBox(); FillModifierComboBox(); FillBonusTypeComboBox(); FillRequirementComboBox(); FillStanceComboBox(); //Set values based on how dialog was opened (Add or Edit) if (NewFlag == true) { //Creating a new modifier StanceComboBox.Visible = false; StanceLabel.Visible = false; PullFromComboBox.Visible = false; PullFromLabel.Visible = false; PassiveRadioButton.Checked = true; ModifierMethodComboBox.SelectedItem = "Normal"; } else { //editing an existing modifier if (SelectedModifierType == 0) { PassiveRadioButton.Checked = true; } else { StanceRadioButton.Checked = true; StanceComboBox.Visible = true; StanceLabel.Visible = true; StanceComboBox.SelectedItem = StanceModel.GetStanceNameFromId(SelectedStanceId).ToString(); } methodName = ModifierMethodModel.GetMethodNameFromId(SelectedModifierMethodId).ToString(); ModifierMethodComboBox.SelectedItem = methodName; if (methodName == "AbilityBonus" || methodName == "Attribute" || methodName == "AbilitySwap") { FillPullFromComboBox(); PullFromComboBox.Visible = true; PullFromLabel.Visible = true; if (methodName == "AbilityBonus" || methodName == "AbilitySwap") { PullFromComboBox.SelectedItem = AbilityModel.GetNameFromId(SelectedPullFromId).ToString(); } if (methodName == "Attribute") { PullFromComboBox.SelectedItem = AttributeModel.GetNameFromId(SelectedPullFromId).ToString(); } } ModifierComboBox.SelectedItem = ModifierModel.GetNameFromId(SelectedModifierId).ToString(); BonusTypeCombo.SelectedItem = BonusTypeModel.GetNameFromId(SelectedBonusTypeId).ToString(); ModifierValueNumUpDown.Value = (decimal)SelectedModifierValue; RequirementComboBox.SelectedItem = RequirementModel.GetNameFromId(SelectedRequirementId).ToString(); ComparisonComboBox.SelectedItem = SelectedComparison; RequirementValueNumUpDown.Value = (decimal)SelectedRequirementValue; } OKButton.Enabled = false; AllowEvents = true; }