Example #1
0
        private void btnApplyObjectiveName_Click(object sender, EventArgs e)
        {
            ObjectiveXML objective = GetSelectedObjective();

            // Get proper name prefix
            string nameFixup = FixupNamePrefix(txtBoxObjectiveName.Text, objective.hasFlag("Required"));

            // See if name already exists
            if (FindObjectiveByName(nameFixup) != null)
            {
                MessageBox.Show("This name already exists in the list.  Please use a different name.", // Message
                                "Duplicate Name",                                                      // Caption
                                MessageBoxButtons.OK,                                                  // Buttons
                                MessageBoxIcon.Exclamation,                                            // Icons
                                MessageBoxDefaultButton.Button1);                                      // Default button

                return;
            }

            // See if name contains a space character
            if (nameFixup.Contains(" "))
            {
                MessageBox.Show("Please do not use spaces in the name.", // Message
                                "Invalid Characters",                    // Caption
                                MessageBoxButtons.OK,                    // Buttons
                                MessageBoxIcon.Exclamation,              // Icons
                                MessageBoxDefaultButton.Button1);        // Default button

                return;
            }

            // Set internal change flag
            mInternal = true;

            // Set local data to new name
            objective.mObjectiveName = nameFixup;

            // Set text box to new name
            txtBoxObjectiveName.Text = nameFixup;

            // Set internal change flag
            mInternal = false;

            // Update list box with new name
            ReplaceListBoxObjective(nameFixup);


            ObjectivesChanged();
        }
Example #2
0
        // Update all of the dependent controls
        private void UpdateControls()
        {
            if (listBoxObjectives.SelectedItem == null)
            {
                BlankControls();
                return;
            }

            // Grab local objective data
            ObjectiveXML objective = GetSelectedObjective();

            if (objective == null)
            {
                //Halwes - 12/1/2006 -  This is a problem handle it.
                BlankControls();
                return;
            }

            // Set internal changes flag
            mInternal = true;

            // Enable controls
            EnableControls(true);

            // Update objective name text box
            txtBoxObjectiveName.Text = listBoxObjectives.SelectedItem.ToString();

            // Disable objective name apply button and score apply button
            btnApplyObjectiveName.Enabled = false;
            btnApplyScore.Enabled         = false;

            // Update check boxes
            chkBoxPlayer1.Checked           = objective.hasFlag("Player1");
            chkBoxPlayer2.Checked           = objective.hasFlag("Player2");
            chkBoxPlayer3.Checked           = objective.hasFlag("Player3");
            chkBoxPlayer4.Checked           = objective.hasFlag("Player4");
            chkBoxPlayer5.Checked           = objective.hasFlag("Player5");
            chkBoxPlayer6.Checked           = objective.hasFlag("Player6");
            chkBoxRequiredObjective.Checked = objective.hasFlag("Required");

            // Update objective description text box
            int locID = DecodeLocStringID(objective.mDescription);

            // if (IsStringID(objective.mDescription))
            if ((locID >= 0) && IsStringID(locID))
            {
                SetObjectiveDescription(locID.ToString(), GetLocString(locID.ToString()));
            }
            else
            {
                if (objective.mHint.Length > 0)
                {
                    mLblStatusDescription.Text = "Please replace this with a Loc String ID !";
                }

                SetObjectiveDescription("", objective.mDescription);
            }

            // Update objective tracker text box
            locID = DecodeLocStringID(objective.mTrackerText);
            if ((locID > 0) && IsStringID(locID))
            {
                SetObjectiveTrackerText(locID.ToString(), GetLocString(locID.ToString()));
            }
            else
            {
                if (objective.mTrackerText.Length > 0)
                {
                    textTrackerText.Text = "Please replace this with a Loc String ID !";
                }

                SetObjectiveTrackerText("", objective.mTrackerText);
            }

            trackerDuration.Value     = objective.mTrackerDuration;
            minTrackerIncrement.Value = objective.mMinTrackerIncrement;

            // Update objective hint text box
            locID = DecodeLocStringID(objective.mHint);
            //if (IsStringID(objective.mHint))
            if ((locID > 0) && IsStringID(locID))
            {
                SetObjectiveHint(locID.ToString(), GetLocString(locID.ToString()));
            }
            else
            {
                if (objective.mHint.Length > 0)
                {
                    mLblStatusHint.Text = "Please replace this with a Loc String ID !";
                }

                SetObjectiveHint("", objective.mHint);
            }

            // Update score text box
            txtBoxScore.Text = objective.mScore.ToString();

            CountNeeded.Value = objective.mFinalCount;

            // Set internal changes flag
            mInternal = false;
        }