示例#1
0
        private void popUpGenerate(popups sender, object sender2)
        {
            //Generates the popup controls on a simpleItem panel when the popup checkbox is checked
            //If the box is unchecked, remove the popup controls
            popups   popupObj = sender;
            CheckBox popup    = (CheckBox)sender2;

            //Create popup elements
            Label popupTitle = new Label();

            popupTitle.Location = new Point(4, 53);
            popupTitle.Text     = "Popup Title:";
            popupTitle.Size     = new Size(64, 13);
            popupTitle.Name     = "popupTitle";
            TextBox popupTitleTextBox = new TextBox();

            popupTitleTextBox.Name = "popupTitleTextBox";
            if (popupObj != null)
            {
                popupTitleTextBox.Text = popupObj.popupTitle;
            }
            else
            {
                popupTitleTextBox.Text = "";
            }
            popupTitleTextBox.Location  = new Point(71, 50);
            popupTitleTextBox.Size      = new Size(215, 20);
            popupTitleTextBox.MaxLength = 100;

            Label popupBody = new Label();

            popupBody.Location = new Point(4, 76);
            popupBody.Text     = "Popup Body:";
            popupBody.Size     = new Size(64, 13);
            popupBody.Name     = "popupBody";
            TextBox popupBodyTextBox = new TextBox();

            popupBodyTextBox.Name = "popupBodyTextBox";
            if (popupObj != null)
            {
                popupBodyTextBox.Text = popupObj.popupBody;
            }
            popupBodyTextBox.Location  = new Point(71, 73);
            popupBodyTextBox.Size      = new Size(215, 20);
            popupBodyTextBox.MaxLength = 1500;

            if (popup.Checked == true)
            {
                popup.Parent.Controls.Add(popupTitle);
                popup.Parent.Controls.Add(popupTitleTextBox);
                popup.Parent.Controls.Add(popupBody);
                popup.Parent.Controls.Add(popupBodyTextBox);
                popup.Parent.Size = new Size(320, 96);
            }
            else
            {
                popup.Parent.Controls.Remove(popupTitle);
                popup.Parent.Controls.Remove(popupTitleTextBox);
                popup.Parent.Controls.Remove(popupBody);
                popup.Parent.Controls.Remove(popupBodyTextBox);
                popup.Parent.Size = new Size(320, 46);
            }
        }
示例#2
0
        private void popUpGenerate(popups sender, object sender2)
        {
            //Generates the popup controls on a simpleItem panel when the popup checkbox is checked
            //If the box is unchecked, remove the popup controls
            popups popupObj = sender;
            CheckBox popup = (CheckBox)sender2;

            //Create popup elements
            Label popupTitle = new Label();
            popupTitle.Location = new Point(4, 53);
            popupTitle.Text = "Popup Title:";
            popupTitle.Size = new Size(64, 13);
            popupTitle.Name = "popupTitle";
            TextBox popupTitleTextBox = new TextBox();
            if (popupObj != null)
            {
                popupTitleTextBox.Text = popupObj.popupTitle;
            }
            else
            {
                popupTitleTextBox.Text = "";
            }
            popupTitleTextBox.Location = new Point(71, 50);
            popupTitleTextBox.Size = new Size(215, 20);
            popupTitleTextBox.MaxLength = 100;

            Label popupBody = new Label();
            popupBody.Location = new Point(4, 76);
            popupBody.Text = "Popup Body:";
            popupBody.Size = new Size(64, 13);
            popupBody.Name = "popupBody";
            TextBox popupBodyTextBox = new TextBox();
            popupBodyTextBox.Name = "popupBodyTextBox";
            if (popupObj != null)
            {
                popupBodyTextBox.Text = popupObj.popupBody;
            }
            popupBodyTextBox.Location = new Point(71, 73);
            popupBodyTextBox.Size = new Size(215, 20);
            popupBodyTextBox.MaxLength = 100;

            if (popup.Enabled == true)
            {
                popup.Parent.Controls.Add(popupTitle);
                popup.Parent.Controls.Add(popupTitleTextBox);
                popup.Parent.Controls.Add(popupBody);
                popup.Parent.Controls.Add(popupBodyTextBox);
                popup.Parent.Size = new Size(320, 96);
            }
            else
            {
                popup.Parent.Controls.Remove(popupTitle);
                popup.Parent.Controls.Remove(popupTitleTextBox);
                popup.Parent.Controls.Remove(popupBody);
                popup.Parent.Controls.Remove(popupBodyTextBox);
                popup.Parent.Size = new Size(320, 46);
            }
        }
示例#3
0
        private void loadSimpleQuestion()
        {
            questionObjectSimple question = game[(int)lastSelected.Tag] as questionObjectSimple;
            //Go through the game list, recreate the item boxes and their items in the ui for editting.
            var tempCount = question.questionItems.Count;

            for (int i = 0; i < tempCount; i++)
            {
                //itemCount++;
                Panel pnlItem = new Panel();
                pnlItem.Name      = itemCount.ToString();
                pnlItem.Size      = new Size(320, 46);
                pnlItem.BackColor = System.Drawing.Color.DarkGray;

                //User can enter the items text
                Label itemNum = new Label();
                itemNum.Location = new Point(4, 10);
                itemNum.Text     = "#" + (i + 1);
                itemNum.Name     = "itemNum";
                itemNum.Size     = new Size(29, 13);
                TextBox itemTextBox = new TextBox();
                itemTextBox.Name      = "itemText";
                itemTextBox.Location  = new Point(33, 7);
                itemTextBox.Size      = new Size(253, 20);
                itemTextBox.MaxLength = 100;
                itemTextBox.Text      = question.questionItems[i].itemText;

                //Configure deleteItem
                Button deleteItem = new Button();
                deleteItem.Name      = "deleteItem";
                deleteItem.Text      = "X";
                deleteItem.Location  = new Point(292, 7);
                deleteItem.Size      = new Size(20, 20);
                deleteItem.FlatStyle = FlatStyle.Flat;
                deleteItem.FlatAppearance.BorderSize  = 0;
                deleteItem.FlatAppearance.BorderColor = System.Drawing.Color.Red;
                deleteItem.BackColor = System.Drawing.Color.Black;
                deleteItem.ForeColor = System.Drawing.Color.White;
                deleteItem.Click    += deleteASimpleItem;

                CheckBox correct = new CheckBox();
                correct.Name     = "correct";
                correct.Text     = "Correct";
                correct.Location = new Point(8, 27);
                correct.Size     = new Size(60, 17);

                CheckBox popup = new CheckBox();
                popup.Name     = "popup";
                popup.Text     = "Popup";
                popup.Location = new Point(74, 27);
                popup.Size     = new Size(60, 17);
                popup.Click   += popup_Click;

                if (question != null)
                {
                    if (question.questionItems[i] != null)
                    {
                        if (question.questionItems[i].correct == true)
                        {
                            correct.Checked = true;
                        }

                        if (question.questionItems[i].popups == null)
                        {
                            question.questionItems[i].popups = new popups();
                        }
                        if (question.questionItems[i].popups.popupEnabled == true)
                        {
                            popup.Checked = true;
                            pnlItem.Controls.Add(popup);

                            popups popupObj = new popups();
                            popupObj.popupEnabled = true;
                            popupObj.popupTitle   = question.questionItems[i].popups.popupTitle;
                            popupObj.popupBody    = question.questionItems[i].popups.popupBody;
                            popUpGenerate(popupObj, popup);
                        }
                    }
                    else
                    {
                        errorHandle("Item could not be added. Please try again.");
                        return;
                    }
                }

                pnlItem.Controls.Add(itemNum);
                pnlItem.Controls.Add(itemTextBox);
                pnlItem.Controls.Add(deleteItem);
                pnlItem.Controls.Add(correct);
                pnlItem.Controls.Add(popup);
                pnlQuestionDetails.Controls.Add(pnlItem);
                itemCount = i;
            }
        }
示例#4
0
        private void loadSimpleQuestion()
        {
            questionObjectSimple question = game[(int)lastSelected.Tag] as questionObjectSimple;
            //Go through the game list, recreate the item boxes and their items in the ui for editting.
            var tempCount = question.questionItems.Count;
            for (int i = 0; i < tempCount; i++)
            {
                //itemCount++;
                Panel pnlItem = new Panel();
                pnlItem.Name = itemCount.ToString();
                pnlItem.Size = new Size(320, 46);
                pnlItem.BackColor = System.Drawing.Color.DarkGray;

                //User can enter the items text
                Label itemNum = new Label();
                itemNum.Location = new Point(4, 10);
                itemNum.Text = "#" + (i + 1);
                itemNum.Name = "itemNum";
                itemNum.Size = new Size(29, 13);
                TextBox itemTextBox = new TextBox();
                itemTextBox.Name = "itemText";
                itemTextBox.Location = new Point(33, 7);
                itemTextBox.Size = new Size(253, 20);
                itemTextBox.MaxLength = 100;
                itemTextBox.Text = question.questionItems[i].itemText;

                //Configure deleteItem
                Button deleteItem = new Button();
                deleteItem.Name = "deleteItem";
                deleteItem.Text = "X";
                deleteItem.Location = new Point(292, 7);
                deleteItem.Size = new Size(20, 20);
                deleteItem.FlatStyle = FlatStyle.Flat;
                deleteItem.FlatAppearance.BorderSize = 0;
                deleteItem.FlatAppearance.BorderColor = System.Drawing.Color.Red;
                deleteItem.BackColor = System.Drawing.Color.Black;
                deleteItem.ForeColor = System.Drawing.Color.White;
                deleteItem.Click += deleteASimpleItem;

                CheckBox correct = new CheckBox();
                correct.Name = "correct";
                correct.Text = "Correct";
                correct.Location = new Point(8, 27);
                correct.Size = new Size(60, 17);

                CheckBox popup = new CheckBox();
                popup.Name = "popup";
                popup.Text = "Popups";
                popup.Location = new Point(74, 27);
                popup.Size = new Size(60, 17);
                popup.Click += popup_Click;

                if (question != null)
                {
                    if (question.questionItems[i] != null)
                    {
                        if (question.questionItems[i].correct == true)
                        {
                            correct.Checked = true;
                        }

                        if (question.questionItems[i].popups == null)
                        {
                            question.questionItems[i].popups = new popups();
                        }
                        if (question.questionItems[i].popups.popupEnabled == true)
                        {
                            popup.Checked = true;
                            pnlItem.Controls.Add(popup);

                            popups popupObj = new popups();
                            popupObj.popupEnabled = true;
                            popupObj.popupTitle = question.questionItems[i].popups.popupTitle;
                            popupObj.popupBody = question.questionItems[i].popups.popupBody;
                            popUpGenerate(popupObj, popup);
                        }
                    }
                    else
                    {
                        errorHandle("Item could not be added. Please try again.");
                    }
                }

                pnlItem.Controls.Add(itemNum);
                pnlItem.Controls.Add(itemTextBox);
                pnlItem.Controls.Add(deleteItem);
                pnlItem.Controls.Add(correct);
                pnlItem.Controls.Add(popup);
                pnlQuestionDetails.Controls.Add(pnlItem);
                itemCount = i;
            }
        }