Пример #1
0
        public TestQuestionData(TestQuestionData rhs)
        {
            // the guid shouldn't be replicated
            guid = Guid.NewGuid().ToString();               // rhs.guid;

            IsVisible               = rhs.IsVisible;
            QuestionVernacular      = new StringTransfer(rhs.QuestionVernacular.ToString());
            QuestionNationalBT      = new StringTransfer(rhs.QuestionNationalBT.ToString());
            QuestionInternationalBT = new StringTransfer(rhs.QuestionInternationalBT.ToString());
            Answers = new AnswersData(rhs.Answers);
        }
Пример #2
0
        protected void InitTestQuestion(StoryEditor theSE, int i, TestQuestionData aTQData, int nLayoutRow, bool bShowHeader)
        {
            TestingQuestionControl aTestingQuestionCtrl = new TestingQuestionControl(theSE, this, aTQData, bShowHeader);

            aTestingQuestionCtrl.ParentControl = this;
            aTestingQuestionCtrl.Name          = CstrFieldNameTestQuestions + nLayoutRow.ToString();

            int nRowIndex = nLayoutRow + i;

            InsertRow(nRowIndex);
            tableLayoutPanel.SetColumnSpan(aTestingQuestionCtrl, 2);
            tableLayoutPanel.Controls.Add(aTestingQuestionCtrl, 0, nRowIndex);
        }
Пример #3
0
        void remTQ_Click(object sender, EventArgs e)
        {
            StoryEditor theSE;

            if (!CheckForProperEditToken(out theSE))
            {
                return;
            }

            ToolStripMenuItem tsm    = (ToolStripMenuItem)sender;
            TestQuestionData  theTQD = (TestQuestionData)tsm.Tag;

            _verseData.TestQuestions.Remove(theTQD);
            UpdateViewOfThisVerse(theSE);
        }
Пример #4
0
        protected void AddRemTQSubmenu(ToolStripMenuItem tsm, TestQuestionData theTQ, int nIndex)
        {
            ToolStripMenuItem tsmSub     = new ToolStripMenuItem();
            string            strPrimary = (theTQ.QuestionVernacular.HasData) ? theTQ.QuestionVernacular.ToString() :
                                           (theTQ.QuestionNationalBT.HasData) ? theTQ.QuestionNationalBT.ToString() : theTQ.QuestionInternationalBT.ToString();
            string strSecondary = (theTQ.QuestionInternationalBT.HasData) ? theTQ.QuestionInternationalBT.ToString() :
                                  (theTQ.QuestionNationalBT.HasData) ? theTQ.QuestionNationalBT.ToString() : theTQ.QuestionVernacular.ToString();

            tsmSub.Name        = strSecondary;
            tsmSub.Text        = strPrimary;
            tsmSub.ToolTipText = strSecondary;
            tsmSub.Tag         = theTQ;
            tsmSub.Click      += remTQ_Click;
            tsm.DropDown.Items.Add(tsmSub);
        }
        public TestingQuestionControl(StoryEditor theSE, VerseBtControl ctrlVerse,
                                      TestQuestionData aTQData, bool bShowHeader)
            : base(theSE.theCurrentStory.ProjStage)
        {
            _aTQData = aTQData;

            InitializeComponent();

            tableLayoutPanel.SuspendLayout();
            SuspendLayout();

            // clobber the base class table layout panel's configuration. We're 'column-oriented' instead
            // first add another row so that we have two rows (row(0)=label, row(1)=text)
            System.Diagnostics.Debug.Assert(tableLayoutPanel.RowCount == 1, "otherwise, adjust assumption here: TestingQuestionControl.cs.34");
            InsertRow(1);

            // remove all but the left-most (autosize) column, because we're going to add them back as equal sizes.
            while (tableLayoutPanel.ColumnCount > 1)
            {
                RemoveColumn(tableLayoutPanel.ColumnCount - 1);
            }

            // show the row label
            Label label = new Label
            {
                Anchor   = AnchorStyles.Left,
                AutoSize = true,
                Name     = CstrFieldNameTestQuestionsLabel,
                Text     = CstrTestQuestionsLabelFormat
            };

            tableLayoutPanel.Controls.Add(label, 0, 1);

            int nNumColumns = 1;

            // insert the vernacular representation of the testing question
            if (theSE.viewVernacularLangFieldMenuItem.Checked)
            {
                InsertColumn(nNumColumns);
                if (bShowHeader)
                {
                    InitColumnLabel(theSE.StoryProject.ProjSettings.Vernacular.LangName, nNumColumns);
                }
                _aTQData.QuestionVernacular.Transliterator = ctrlVerse.TransliteratorVernacular;
                InitTextBox(ctrlVerse, CstrFieldNameVernacular, _aTQData.QuestionVernacular,
                            theSE.StoryProject.ProjSettings.Vernacular, nNumColumns);
                nNumColumns++;
            }

            // the only time we show the National BT is if there's an "other" English BTr (who will
            //  do the EnglishBT from the NationalBT) OR there's no vernacular
            if (theSE.StoryProject.ProjSettings.NationalBT.HasData &&
                (theSE.StoryProject.TeamMembers.HasOutsideEnglishBTer ||
                 (theSE.viewNationalLangFieldMenuItem.Checked && !theSE.StoryProject.ProjSettings.Vernacular.HasData)))
            {
                InsertColumn(nNumColumns);
                if (bShowHeader)
                {
                    InitColumnLabel(theSE.StoryProject.ProjSettings.NationalBT.LangName, nNumColumns);
                }
                _aTQData.QuestionNationalBT.Transliterator = ctrlVerse.TransliteratorNationalBT;
                InitTextBox(ctrlVerse, CstrFieldNameNationalBt, _aTQData.QuestionNationalBT,
                            theSE.StoryProject.ProjSettings.NationalBT, nNumColumns);
                nNumColumns++;
            }

            if (theSE.viewEnglishBTFieldMenuItem.Checked &&
                (!theSE.StoryProject.TeamMembers.HasOutsideEnglishBTer ||
                 (StageLogic.MemberTypeWithEditToken !=
                  TeamMemberData.UserTypes.eProjectFacilitator) ||
                 (theSE.LoggedOnMember.MemberType != TeamMemberData.UserTypes.eProjectFacilitator)))
            {
                InsertColumn(nNumColumns);
                if (bShowHeader)
                {
                    InitColumnLabel(theSE.StoryProject.ProjSettings.InternationalBT.LangName, nNumColumns);
                }
                InitTextBox(ctrlVerse, CstrFieldNameVernacular, _aTQData.QuestionInternationalBT,
                            theSE.StoryProject.ProjSettings.InternationalBT, nNumColumns);
                nNumColumns++;
            }

            // add a row so we can display a multiple line control with the answers
            if ((_aTQData.Answers != null) && (_aTQData.Answers.Count > 0))
            {
                System.Diagnostics.Debug.Assert(theSE.theCurrentStory.CraftingInfo.Testors.Count >= _aTQData.Answers.Count);
                MultiLineControl aAnswersCtrl = new MultiLineControl(ctrlVerse, StageLogic,
                                                                     _aTQData.Answers, theSE.StoryProject.ProjSettings.InternationalBT.FontToUse,
                                                                     theSE.theCurrentStory.CraftingInfo.Testors);
                aAnswersCtrl.Name          = CstrFieldNameAnswers;
                aAnswersCtrl.ParentControl = this;

                const int nLayoutRow = 2;
                InsertRow(nLayoutRow);
                if (nNumColumns > 2)
                {
                    tableLayoutPanel.SetColumnSpan(aAnswersCtrl, nNumColumns - 1);
                }
                tableLayoutPanel.Controls.Add(aAnswersCtrl, 1, nLayoutRow);
                tableLayoutPanel.DumpTable();
            }

            tableLayoutPanel.ResumeLayout(false);
            ResumeLayout(false);
        }