private void ComboBoxChange(object sender) { ComboBox changedBox; string boxIndexString; int boxIndex; string newValueString; Guid newValue; //extract the index value of the control sending this message changedBox = new ComboBox(); changedBox = (ComboBox)sender; boxIndexString = Regex.Match(changedBox.Name, @"\d+").Value; boxIndex = Int32.Parse(boxIndexString) - 1; //grab the new value //newValueString = Regex.Match(changedBox.SelectedItem, @"\d+").Value; newValueString = changedBox.SelectedItem.ToString(); ModelofFeatType = new FeatTypeModel(); ModelofFeatType.Initialize(newValueString); newValue = ModelofFeatType.Id; if (newValue != ModelofCharacter[boxIndex].FeatTypeId) { ModelofCharacter[boxIndex].FeatTypeId = newValue; LevelDataHasChanged[boxIndex] = true; } }
public DataInputCharacterScreenClass() { InitializeComponent(); Model = new CharacterModel(); ModelofCharacter = new CharacterModel[Constant.MaxLevels]; ModelofFeatType = new FeatTypeModel(); FeatTypeNames = FeatTypeModel.GetNames(); CharacterLevels = CharacterModel.GetLevels(); LevelDataHasChanged = new bool[Constant.MaxLevels]; for (int i = 1; i <= Constant.MaxLevels; i++) { ModelofCharacter[i - 1] = new CharacterModel(); ModelofCharacter[i - 1].Intialize(i); } PopulateFeatTypeChoiceList(); PopulateFields(); autoGrantedFeatsPanel1.Initialize("Character", Guid.Empty); for (int i = 0; i < Constant.MaxLevels; i++) { LevelDataHasChanged[i] = false; } }
private void PopulateFeatTypeCheckedListBox() { FeatTypeNames = FeatTypeModel.GetNames(); foreach (string name in FeatTypeNames) { FeatTypesCheckedListBox.Items.Add(name); } }
private void PopulateBonusFeatChoiceComboBoxesList() { string controlName; ComboBox controlBox; FeatTypeNames = FeatTypeModel.GetNames(); for (int i = 1; i <= Constant.NumHeroicLevels; i++) { controlName = "BonusFeatChoiceCombo" + i; controlBox = (ComboBox)this.LevelDetailsPanel.Controls[controlName]; controlBox.Items.Add(""); foreach (string name in FeatTypeNames) { controlBox.Items.Add(name); } } }
/// <summary> /// Populate the fields with the appropriate Character data. /// </summary> private void PopulateFields() { string featTypeName; for (int i = 1; i <= Constant.MaxLevels; i++) { featTypeName = ""; ControlName = "HitPointsInputBox" + i; HitPointsInputBox = (TextBox)this.Controls[ControlName]; HitPointsInputBox.Text = ModelofCharacter[i - 1].HitPoints.ToString(); ControlName = "FortitudeSave" + i + "InputBox"; FortitudeSaveInputBox = (TextBox)this.Controls[ControlName]; FortitudeSaveInputBox.Text = ModelofCharacter[i - 1].FortitudeSave.ToString(); ControlName = "ReflexSaveInputBox" + i; ReflexSaveInputBox = (TextBox)this.Controls[ControlName]; ReflexSaveInputBox.Text = ModelofCharacter[i - 1].ReflexSave.ToString(); ControlName = "WillSaveInputBox" + i; WillSaveInputBox = (TextBox)this.Controls[ControlName]; WillSaveInputBox.Text = ModelofCharacter[i - 1].WillSave.ToString(); ControlName = "BaseAttackBonusInputbox" + i; BaseAttackBonusInputBox = (TextBox)this.Controls[ControlName]; BaseAttackBonusInputBox.Text = ModelofCharacter[i - 1].BaseAttackBonus.ToString(); ControlName = "BonusFeatCombo" + i; ModelofFeatType = new FeatTypeModel(); ModelofFeatType.Initialize(ModelofCharacter[i - 1].FeatTypeId); BonusFeatTypeCombo = (ComboBox)this.Controls[ControlName]; if (ModelofFeatType.Name != null) { featTypeName = ModelofFeatType.Name.ToString(); if (featTypeName != "") { BonusFeatTypeCombo.SelectedItem = ModelofFeatType.Name.ToString(); } } //Need to set these to false since we are just populating the fields and haven't changed that data. LevelDataHasChanged[i - 1] = false; } }
private void ArrayComboBoxChange(object sender, InputType Type) { ComboBox changedBox; string boxIndexString; int boxIndex; string newValueString; FeatTypeModel modelofFeatType; //extract the index value of the control sending this message changedBox = new ComboBox(); changedBox = sender as ComboBox; boxIndexString = Regex.Match(changedBox.Name, @"\d+").Value; boxIndex = Int32.Parse(boxIndexString) - 1; switch (Type) { case InputType.BonusFeat: { if (changedBox.SelectedIndex == 0) { Model.LevelDetails[boxIndex].FeatTypeId = Guid.Empty; } else { //grab the selection's guid newValueString = changedBox.SelectedItem.ToString(); modelofFeatType = new FeatTypeModel(); modelofFeatType.Initialize(newValueString); Model.LevelDetails[boxIndex].FeatTypeId = modelofFeatType.Id; } DataHasChanged = true; break; } default: { Debug.WriteLine("Error: Unknown Type in Array Combo Box Change"); break; } } }
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; }
private void CheckedListBoxChange(object sender, InputType type, ItemCheckEventArgs e) { switch (type) { case InputType.FeatTargets: { if (e.NewValue == CheckState.Unchecked) { foreach (FeatTargetSelection selection in FeatTargetsSelected) { if (TargetModel.GetNameFromId(selection.Model.TargetId) == FeatTargetsCheckedListBox.Items[e.Index].ToString()) { selection.DeleteRecord = true; RecordChanged = true; return; } } } else { //let see if model exist already, if not then we need to add one otherwise set deleterecord to false. foreach (FeatTargetSelection selection in FeatTargetsSelected) { if (TargetModel.GetNameFromId(selection.Model.TargetId) == FeatTargetsCheckedListBox.Items[e.Index].ToString()) { selection.DeleteRecord = false; RecordChanged = true; return; } } // we made it this far, so we need to add a model FeatTargetsSelected.Add(new FeatTargetSelection()); FeatTargetsSelected[FeatTargetsSelected.Count - 1].Model = new FeatTargetModel(); FeatTargetsSelected[FeatTargetsSelected.Count - 1].Model.FeatId = Model.Id; FeatTargetsSelected[FeatTargetsSelected.Count - 1].Model.TargetId = TargetModel.GetIdFromName(FeatTargetsCheckedListBox.Items[e.Index].ToString()); FeatTargetsSelected[FeatTargetsSelected.Count - 1].DeleteRecord = false; RecordChanged = true; } break; } case InputType.FeatTypes: { if (e.NewValue == CheckState.Unchecked) { foreach (FeatTypeSelection selection in FeatTypesSelected) { if (FeatTypeModel.GetNameFromId(selection.Model.FeatTypeId) == FeatTypesCheckedListBox.Items[e.Index].ToString()) { selection.DeleteRecord = true; RecordChanged = true; return; } } } else { //let see if model exist already, if not then we need to add one otherwise set deleterecord to false. foreach (FeatTypeSelection selection in FeatTypesSelected) { if (FeatTypeModel.GetNameFromId(selection.Model.FeatTypeId) == FeatTypesCheckedListBox.Items[e.Index].ToString()) { selection.DeleteRecord = false; RecordChanged = true; return; } } // we made it this far, so we need to add a model FeatTypesSelected.Add(new FeatTypeSelection()); FeatTypesSelected[FeatTypesSelected.Count - 1].Model = new FeatFeatTypeModel(); FeatTypesSelected[FeatTypesSelected.Count - 1].Model.FeatId = Model.Id; FeatTypesSelected[FeatTypesSelected.Count - 1].Model.FeatTypeId = FeatTypeModel.GetIdFromName(FeatTypesCheckedListBox.Items[e.Index].ToString()); FeatTypesSelected[FeatTypesSelected.Count - 1].DeleteRecord = false; RecordChanged = true; } break; } } }
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 ComboBoxChange(object sender, InputType type) { ComboBox changedBox; string boxIndexString; int boxIndex; string newValueString; Guid newValueGuid; ClassModel modelofClass; FeatModel modelofFeat; FeatTypeModel modelofFeatType; switch (type) { case InputType.StrMin: { newValueString = StrengthMinimumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.StrengthMinimum.ToString()) { ModelofRace.StrengthMinimum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.StrMax: { newValueString = StrengthMaximumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.StrengthMaximum.ToString()) { ModelofRace.StrengthMaximum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.DexMin: { newValueString = DexterityMinimumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.DexterityMinimum.ToString()) { ModelofRace.DexterityMinimum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.DexMax: { newValueString = DexterityMaximumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.DexterityMaximum.ToString()) { ModelofRace.DexterityMaximum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.ConMin: { newValueString = ConstitutionMinimumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.ConstitutionMinimum.ToString()) { ModelofRace.ConstitutionMinimum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.ConMax: { newValueString = ConstitutionMaximumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.ConstitutionMaximum.ToString()) { ModelofRace.ConstitutionMaximum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.IntMin: { newValueString = IntelligenceMinimumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.IntelligenceMinimum.ToString()) { ModelofRace.IntelligenceMinimum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.IntMax: { newValueString = IntelligenceMaximumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.IntelligenceMaximum.ToString()) { ModelofRace.IntelligenceMaximum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.WisMin: { newValueString = WisdomMinimumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.WisdomMinimum.ToString()) { ModelofRace.WisdomMinimum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.WisMax: { newValueString = WisdomMaximumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.WisdomMaximum.ToString()) { ModelofRace.WisdomMaximum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.ChaMin: { newValueString = CharismaMinimumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.CharismaMinimum.ToString()) { ModelofRace.CharismaMinimum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.ChaMax: { newValueString = CharismaMaximumBox.SelectedItem.ToString(); if (newValueString != ModelofRace.CharismaMaximum.ToString()) { ModelofRace.CharismaMaximum = Int32.Parse(newValueString); HasRaceDataChanged = true; } break; } case InputType.StartingClass: { newValueString = StartingClassComboBox.SelectedItem.ToString(); if (newValueString == "") { newValueGuid = Guid.Empty; } else { modelofClass = new ClassModel(); modelofClass.Initialize(newValueString); newValueGuid = modelofClass.Id; } if (newValueGuid != ModelofRace.StartingClassId) { ModelofRace.StartingClassId = newValueGuid; HasRaceDataChanged = true; } break; } case InputType.PastLifeFeat: { newValueString = PastLifeFeatCombo.SelectedItem.ToString(); if (newValueString == "") { newValueGuid = Guid.Empty; } else { modelofFeat = new FeatModel(); modelofFeat.Initialize(newValueString); newValueGuid = modelofFeat.Id; } if (newValueGuid != ModelofRace.PastLifeFeatId) { ModelofRace.PastLifeFeatId = newValueGuid; HasRaceDataChanged = true; } break; } case InputType.BonusFeatChoice: { changedBox = new ComboBox(); changedBox = (ComboBox)sender; boxIndexString = Regex.Match(changedBox.Name, @"\d+").Value; boxIndex = Int32.Parse(boxIndexString) - 1; newValueString = changedBox.SelectedItem.ToString(); modelofFeatType = new FeatTypeModel(); modelofFeatType.Initialize(newValueString); newValueGuid = modelofFeatType.Id; if (newValueGuid != ModelofRaceDetail[boxIndex].FeatTypeId) { ModelofRaceDetail[boxIndex].FeatTypeId = newValueGuid; HasRaceDetailsChanged[boxIndex] = true; } break; } } }
private void PopulateFields(string raceName) { string controlName; TextBox skillPointsBox; ComboBox bonusFeatChoiceBox; ModelofRace = new RaceModel(); ModelofRace.Initialize(raceName); //set our Original values for error checking unique values. DatabaseName = ModelofRace.Name; DatabaseAbbreviation = ModelofRace.Abbreviation; //Set the Main Control Values NameInputBox.Text = ModelofRace.Name; AbbreviationInputBox.Text = ModelofRace.Abbreviation; PastLifeFeatCombo.SelectedItem = FeatModel.GetNameFromId(ModelofRace.PastLifeFeatId); StartingClassComboBox.SelectedItem = ClassModel.GetNameFromId(ModelofRace.StartingClassId); IconicCheckBox.Checked = ModelofRace.Iconic; DescriptionWebBrowser.Navigate("about:blank"); DescriptionWebBrowser.Document.OpenNew(false); DescriptionWebBrowser.Document.Write(ModelofRace.Description); DescriptionWebBrowser.Refresh(); MaleIconNameInputBox.Text = ModelofRace.MaleImageFileName; FemaleIconNameInputBox.Text = ModelofRace.FemaleImageFileName; MaleIcon = new IconClass(ModelofRace.MaleImageFileName); MaleIcon.SetLocation(this.Width, this.Height, MaleIconLocation); FemaleIcon = new IconClass(ModelofRace.FemaleImageFileName); FemaleIcon.SetLocation(this.Width, this.Height, FemaleIconLocation); //Starting Stat Boxes StrengthMinimumBox.SelectedItem = ModelofRace.StrengthMinimum.ToString(); StrengthMaximumBox.SelectedItem = ModelofRace.StrengthMaximum.ToString(); DexterityMinimumBox.SelectedItem = ModelofRace.DexterityMinimum.ToString(); DexterityMaximumBox.SelectedItem = ModelofRace.DexterityMaximum.ToString(); ConstitutionMinimumBox.SelectedItem = ModelofRace.ConstitutionMinimum.ToString(); ConstitutionMaximumBox.SelectedItem = ModelofRace.ConstitutionMaximum.ToString(); IntelligenceMinimumBox.SelectedItem = ModelofRace.IntelligenceMinimum.ToString(); IntelligenceMaximumBox.SelectedItem = ModelofRace.IntelligenceMaximum.ToString(); WisdomMinimumBox.SelectedItem = ModelofRace.WisdomMinimum.ToString(); WisdomMaximumBox.SelectedItem = ModelofRace.WisdomMaximum.ToString(); CharismaMinimumBox.SelectedItem = ModelofRace.CharismaMinimum.ToString(); CharismaMaximumBox.SelectedItem = ModelofRace.CharismaMaximum.ToString(); //System Boxes GuidLabel.Text = ModelofRace.Id.ToString(); LastUpdatedDateLabel.Text = ModelofRace.LastUpdatedDate.ToString(); LastUpdatedVersionLabel.Text = ModelofRace.LastUpdatedVersion; //LevelDetails Information ModelofRaceDetail = RaceLevelDetailModel.GetAll(ModelofRace.Id); if (ModelofRaceDetail == null) { //no detail records exist for this race, so we need to create them ModelofRaceDetail = new List <RaceLevelDetailModel>(); for (int i = 0; i < Constant.NumHeroicLevels; i++) { ModelofRaceDetail.Add(new RaceLevelDetailModel()); ModelofRaceDetail[i].Level = i + 1; } NewRecord = true; } //now lets fill in our Level Detail Controls for (int i = 0; i < Constant.NumHeroicLevels; i++) { controlName = "SkillPointsInputBox" + (i + 1); skillPointsBox = (TextBox)this.LevelDetailsPanel.Controls[controlName]; skillPointsBox.Text = ModelofRaceDetail[i].BonusSkillPoints.ToString(); controlName = "BonusFeatChoiceCombo" + (i + 1); bonusFeatChoiceBox = (ComboBox)this.LevelDetailsPanel.Controls[controlName]; bonusFeatChoiceBox.SelectedItem = FeatTypeModel.GetNameFromId(ModelofRaceDetail[i].FeatTypeId); } }
/// <summary> /// for a given selected record, show its data in the appropriate fields /// </summary> /// <param name="recordName">The name of the record to show</param> private void PopulateFields(string recordName) { string controlName; ComboBox bonusFeatComboBox; FeatTypeModel featType; List <string> destinyName; DestinySphereModel currentDestiny; Model.Initialize(recordName); //cache the name and abbreviation strings for later comparisons DatabaseName = Model.Name; DatabaseAbbreviation = Model.Abbreviation; ClassNameInputBox.Text = Model.Name; DescriptionPreview.Navigate("about:blank"); DescriptionPreview.Document.OpenNew(false); DescriptionPreview.Document.Write(Model.Description); DescriptionPreview.Refresh(); HitDieInputBox.Text = Model.HitDie.ToString(); ClassNameAbbreviationInputBox.Text = Model.Abbreviation; SkillPointsInputBox.Text = Model.SkillPoints.ToString(); IconNameInputBox.Text = Model.ImageFilename; ClassIcon = new IconClass(Model.ImageFilename); ClassIcon.SetLocation(this.Width, this.Height, IconLocation); for (int i = 1; i <= Constant.NumHeroicLevels; i++) { controlName = "FortSaveInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].FortitudeSave.ToString(); controlName = "ReflexSaveInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].ReflexSave.ToString(); controlName = "WillSaveInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].WillSave.ToString(); controlName = "BABInputBox" + i; Controls[controlName].Text = Model.LevelDetails[i - 1].BaseAttackBonus.ToString(); controlName = "BonusFeatComboBox" + i; bonusFeatComboBox = Controls[controlName] as ComboBox; if (Model.LevelDetails[i - 1].FeatTypeId == Guid.Empty) { bonusFeatComboBox.SelectedIndex = 0; } else { featType = new FeatTypeModel(); featType.Initialize(Model.LevelDetails[i - 1].FeatTypeId); bonusFeatComboBox.SelectedIndex = bonusFeatComboBox.FindStringExact(featType.Name); } } AlignmentsAllowedListBox.Items.Clear(); if (Model.AllowedAlignments != null) { foreach (AlignmentModel alignment in Model.AllowedAlignments) { AlignmentsAllowedListBox.Items.Add(alignment.Name); } } ClassSkillsListBox.Items.Clear(); if (Model.ClassSkills != null) { foreach (SkillModel skill in Model.ClassSkills) { ClassSkillsListBox.Items.Add(skill.Name); } } RecordGUIDLabel.Text = Model.Id.ToString(); ModDateLabel.Text = Model.LastUpdatedDate.ToString(); ModVersionLabel.Text = Model.LastUpdatedVersion; destinyName = DestinySphereModel.GetNames(); StartingDestinySphereComboBox.Items.Clear(); foreach (string name in destinyName) { StartingDestinySphereComboBox.Items.Add(name); } MaxSpellLevelComboBox.Items.Clear(); for (int i = 0; i <= 9; i++) { MaxSpellLevelComboBox.Items.Add(i.ToString()); } MaxSpellLevelComboBox.SelectedIndex = Model.MaxSpellLevel; currentDestiny = new DestinySphereModel(); currentDestiny.Initialize(Model.StartingDestinySphereId); StartingDestinySphereComboBox.SelectedIndex = StartingDestinySphereComboBox.FindStringExact(currentDestiny.Name); //make sure we haven't changed the data (Populating data from the database doesn't count as a change!) DataHasChanged = false; }