Пример #1
0
 private void PopulateCategoryFeatComboBox()
 {
     FeatCategoryNames = FeatCategoryModel.GetNames();
     CategoryFeatComboBox.Items.Add("");
     foreach (string name in FeatCategoryNames)
     {
         CategoryFeatComboBox.Items.Add(name);
     }
 }
        private void LoadData()
        {
            FeatCategoryModel model = new FeatCategoryModel();

            model.Initialize(_id);
            _name             = model.Name;
            _description      = model.Description;
            _parentCategoryId = model.ParentFeatCategoryId;
            _iconName         = model.IconName;
            IsLoaded          = true;
        }
Пример #3
0
        private void LoadFeatCategoryIds()
        {
            List <Guid> featCategoryIds;

            featCategoryIds = FeatCategoryModel.GetIds();
            FeatCategories  = new SortedDictionary <Guid, FeatCategoryDataClass>();
            foreach (Guid id in featCategoryIds)
            {
                FeatCategories.Add(id, new FeatCategoryDataClass(id));
            }
        }
Пример #4
0
        private void ComboBoxChange(object sender, InputType type)
        {
            string newValueString;
            Guid   newValueGuid;

            switch (type)
            {
            case InputType.FeatCategory:
            {
                newValueString = CategoryFeatComboBox.SelectedItem.ToString();
                if (newValueString == "")
                {
                    newValueGuid = Guid.Empty;
                }
                else
                {
                    newValueGuid = FeatCategoryModel.GetIdFromName(newValueString);
                }

                if (newValueGuid != Model.FeatCategoryId)
                {
                    Model.FeatCategoryId = newValueGuid;
                    RecordChanged        = true;
                }
                break;
            }

            case InputType.ParentFeat:
            {
                newValueString = ParentFeatComboBox.SelectedItem.ToString();
                if (newValueString == "")
                {
                    newValueGuid = Guid.Empty;
                }
                else
                {
                    newValueGuid = FeatModel.GetIdFromName(newValueString);
                }

                if (newValueGuid != Model.ParentFeat)
                {
                    Model.ParentFeat = newValueGuid;
                    RecordChanged    = true;
                }
                break;
            }

            case InputType.Stance:
            {
                newValueString = StanceComboBox.SelectedItem.ToString();
                if (newValueString == "")
                {
                    newValueGuid = Guid.Empty;
                }
                else
                {
                    newValueGuid = StanceModel.GetIdFromStanceName(newValueString);
                }

                if (newValueGuid != Model.StanceId)
                {
                    Model.StanceId = newValueGuid;
                    RecordChanged  = true;
                }
                break;
            }
            }
        }
Пример #5
0
        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();
        }