private void PopulateControls()
        {
            Guid featId;

            featId = Guid.Empty;

            for (int i = 0; i < RecordCount; i++)
            {
                switch (MainScreen)
                {
                case ScreenType.Character:
                {
                    featId = CharacterFeatModel[i].FeatId;
                    LevelComboBox[i].Text            = CharacterFeatModel[i].Level.ToString();
                    IgnorePreReqsCheckBox[i].Checked = CharacterFeatModel[i].IgnorePreRequirements;
                    break;
                }

                case ScreenType.Class:
                {
                    featId = ClassFeatModel[i].FeatId;
                    LevelComboBox[i].Text            = ClassFeatModel[i].Level.ToString();
                    IgnorePreReqsCheckBox[i].Checked = ClassFeatModel[i].HasPreRequirements;
                    break;
                }

                case ScreenType.Race:
                {
                    featId = RaceFeatModel[i].FeatId;
                    LevelComboBox[i].Text            = RaceFeatModel[i].Level.ToString();
                    IgnorePreReqsCheckBox[i].Checked = RaceFeatModel[i].HasPreRequirements;
                    break;
                }
                }
                ModelofFeat.Initialize(featId);
                FeatNameComboBox[i].SelectedItem = ModelofFeat.Name.ToString();
            }
        }
示例#2
0
        private void LoadData()
        {
            FeatModel model;

            model = new FeatModel();
            model.Initialize(_FeatId);
            _FeatName       = model.Name;
            _FeatCategoryId = model.FeatCategoryId;
            _isParentFeat   = model.IsParentFeat;
            _parentFeatId   = model.ParentFeat;
            _iconName       = model.ImageFileName;
            _description    = model.Description;
            _multiple       = model.Multiple;
            _duration       = model.Duration;
            _stanceId       = model.StanceId;
            _featTypeIds    = FeatFeatTypeModel.GetIdsByFeatId(_FeatId);
            IsLoaded        = true;
        }
示例#3
0
        /// <summary>
        /// Temporary method to strip our current feat Description of the HTML tags that are no longer needed.
        /// </summary>
        public static void FixFeatDescriptions()
        {
            int           count;
            FeatModel     model;
            List <string> featNames;
            string        newDescription;

            featNames = FeatModel.GetNames();
            count     = featNames.Count();
            //count = 1;
            for (int i = 0; i < count; i++)
            {
                model = new FeatModel();
                model.Initialize(featNames[i]);
                if (model.Description != null)
                {
                    newDescription    = StripHTMLfromOldDescriptions(model.Description);
                    model.Description = newDescription;
                    model.Save();
                }
            }
        }
        private void ComboBoxChange(object sender, InputType type)
        {
            ComboBox changedBox;
            string   boxIndexString;
            int      boxIndex;
            string   newValueString;
            int      newValueInt;
            Guid     newValueGuid;

            //extract the index value of the cotnrol sending this message
            changedBox     = new ComboBox();
            changedBox     = (ComboBox)sender;
            boxIndexString = Regex.Match(changedBox.Name, @"\d+").Value;
            boxIndex       = Int32.Parse(boxIndexString);

            //grab the new value
            newValueString = changedBox.SelectedItem.ToString();

            switch (type)
            {
            case InputType.Level:
            {
                if (newValueString.Length == 0)
                {
                    newValueInt = 0;
                }
                else
                {
                    newValueInt = Int32.Parse(newValueString);
                }
                switch (MainScreen)
                {
                case ScreenType.Character:
                {
                    if (newValueInt != CharacterFeatModel[boxIndex].Level)
                    {
                        CharacterFeatModel[boxIndex].Level = newValueInt;
                        HasDataChanged[boxIndex]           = true;
                    }
                    break;
                }

                case ScreenType.Class:
                {
                    if (newValueInt != ClassFeatModel[boxIndex].Level)
                    {
                        ClassFeatModel[boxIndex].Level = newValueInt;
                        HasDataChanged[boxIndex]       = true;
                    }
                    break;
                }

                case ScreenType.Race:
                {
                    if (newValueInt != RaceFeatModel[boxIndex].Level)
                    {
                        RaceFeatModel[boxIndex].Level = newValueInt;
                        HasDataChanged[boxIndex]      = true;
                    }
                    break;
                }
                }
                break;
            }

            case InputType.FeatName:
            {
                ModelofFeat = new FeatModel();
                ModelofFeat.Initialize(newValueString);
                newValueGuid = ModelofFeat.Id;
                switch (MainScreen)
                {
                case ScreenType.Character:
                {
                    if (newValueGuid != CharacterFeatModel[boxIndex].FeatId)
                    {
                        CharacterFeatModel[boxIndex].FeatId = newValueGuid;
                        HasDataChanged[boxIndex]            = true;
                    }
                    break;
                }

                case ScreenType.Class:
                {
                    if (newValueGuid != ClassFeatModel[boxIndex].FeatId)
                    {
                        ClassFeatModel[boxIndex].FeatId = newValueGuid;
                        HasDataChanged[boxIndex]        = true;
                    }
                    break;
                }

                case ScreenType.Race:
                {
                    if (newValueGuid != RaceFeatModel[boxIndex].FeatId)
                    {
                        RaceFeatModel[boxIndex].FeatId = newValueGuid;
                        HasDataChanged[boxIndex]       = true;
                    }
                    break;
                }
                }
                break;
            }

            default:
            {
                Debug.WriteLine("Error: Unknown InputType in ComboBoxChange");
                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();
        }
示例#6
0
        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;
            }
            }
        }