Example #1
0
 public frmUnlock(string propPath, PublishedLock lockType, out string unlockSelection)
 {
     InitializeComponent();
     PrepareForm(propPath, lockType);
     ShowDialog();
     unlockSelection = UnlockSelection;
 }
Example #2
0
        private void PrepareForm(string propPath, PublishedLock pubLock)
        {
            string details = "";

            switch (pubLock)
            {
            case PublishedLock.Instructions:
                details = "Changing an item on the Instructions page will cause no problems for " +
                          "Pocket Pollster but you'll have to be the judge of whether the change(s) you make will adversely " +
                          "affect the integrity of the data.  For example, the precise wording of your instructions can affect the " +
                          "poll results.";
                break;

            case PublishedLock.QA_Basic:
                details = "It is for you to judge the overall effect of changing the wording of the Questions or Answers. " +
                          "If you're just correcting a spelling mistake or making the wording more clear, then that's no " +
                          "problem but if you're making major changes then you really should publish an entirely new poll.";
                break;

            case PublishedLock.AnswerFormat:
                details = "Some changes with the Answer Format pose no problem - eg. from Standard to List.  But " +
                          "changing from one format type to a radically different one can cause serious problems.";
                break;

            case PublishedLock.ChoiceStructure:
                details = "Changing the structure of the Answers is very risky.  You are strongly advised NOT to do this.";
                break;

            case PublishedLock.QuestionStructure:
                details = "Changing the structure of the Questions is very risky.  You are strongly advised NOT to do this.";
                break;

            default:
                Debug.Fail("Unknown PublishedLock", "frmUnlock.PrepareForm");
                break;
            }

            labelDetails.Text   = details;
            labelDetails.Height = Tools.GetLabelHeight(details, labelDetails.Font, labelDetails.Width);

            labelInstructions.Top = labelDetails.Bottom + 12;

            panelChoices.Top  = labelInstructions.Bottom + 18;
            panelChoices.Left = (this.Width - panelChoices.Width) / 2;

            if (propPath == null) // Only happens when Add/Remove buttons of Choices/Questions is pressed
            {
                int dist = panelChoices.Height - radioButtonAll.Bottom;
                radioButtonAll.Top         = radioButtonSameType.Top - 12;
                radioButtonSameType.Top    = radioButtonJustOne.Top;
                radioButtonJustOne.Visible = false;
                panelChoices.Height        = radioButtonAll.Bottom + dist;
            }
            else
            {
                radioButtonJustOne.Tag = propPath;      // Set tag of upper radio button (the 3rd one is already hard-coded to "ALL")
            }

            radioButtonSameType.Tag = pubLock.ToString(); // Set tag of [what is generally the] center radio button
            this.Height             = panelChoices.Bottom + 36 + buttonOK.Height + (this.Height - buttonOK.Bottom);

            buttonOK.Enabled = false;
        }