示例#1
0
        private static bool ConfirmDownload(Version releaseVersion)
        {
            var question = string.Format("A new version ({0}) has been released.{1}{1}Do you want to download and install it?", releaseVersion, Environment.NewLine);
            var result   = QuestionBox.Show(question, false);

            return(result == MessageBoxResult.Yes);
        }
示例#2
0
    void UpdateAction()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            OnActionPressed();
        }
        else if (QuestionBox.IsVisible())
        {
            if (Input.GetKeyDown(KeyCode.DownArrow))
            {
                QuestionBox.LowerSelection();
            }

            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                QuestionBox.GoUpSelection();
            }
        }
        else if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (isPaused)
            {
                ResumeGame();
            }
            else
            {
                GameObject.FindGameObjectWithTag("MainCamera").GetComponent <FMODUnity.StudioEventEmitter> ().SetParameter("paused", 1f);
                isPaused = true;
                pausePannel.SetActive(true);
                pausePannel.GetComponent <PauseUI>().Select();
                pauseFrozen = isFrozen;
                setFrozen(true, true);
            }
        }
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        // ammonite event
        if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= eventVisitCount && VisitFriend.GetComponent <Image>().enabled&& !IsAlreadyShow)
        {
            IsAlreadyShow = true;
            SceneManager.LoadScene("Ammonite Event");
        }


        if (!DialogPanel.activeSelf)
        {
            if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= openVisitCount)
            {
                buyButton.GetComponent <Button> ().enabled = true;
                ShopItem.GetComponent <Button> ().enabled  = true;
                QuestionBox.SetActive(false);
                if (!IsAlreadyOpen)
                {
                    PopUpText.text = "이제 상점에서 <쿠션>을 구입할 수 있습니다!";
                    PopUpClose.SetActive(true);
                    PopUp.SetActive(true);
                    IsAlreadyOpen = true;
                }
            }
        }
        save();
    }
        public static String Ask(String key, String question)
        {
            if (question == null)
            {
                throw new ArgumentNullException(nameof(question));
            }
            if (key == null)
            {
                throw new ArgumentNullException(nameof(key));
            }
            Object value;

            while (!Settings.TryGetValue(key, out value))
            {
                var questionBox = new QuestionBox(question);
                var result      = questionBox.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Settings[key] = questionBox.Response;
                }
                else
                {
                    if (ThreadingExtensions.IsRunningFromNUnit)
                    {
                        throw new NotImplementedException();
                    }
                }
            }
            return(value as String);
        }
示例#5
0
文件: plate.cs 项目: SNUGDC/HomeAlone
    // Update is called once per frame
    void Update()
    {
        if (!DialogPanel.activeSelf)
        {
            //event
            if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= lionEventVisitNumber && !IsAlreadyShow)
            {
                IsAlreadyShow = true;
                SceneManager.LoadScene("Lion Event");
                PlayerPrefs.SetString("LionEvent", IsAlreadyShow.ToString());
            }

            //event2 - sheep&lion
            else if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= lionEventVisitNumber2 && !IsAlreadyShow2)
            {
                IsAlreadyShow2 = true;
                SceneManager.LoadScene("Sheep Event2");
            }

            if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= openVisitCount)
            {
                ShopItem.GetComponent <Button> ().enabled  = true;
                buyButton.GetComponent <Button> ().enabled = true;
                QuestionBox.SetActive(false);
                if (!IsAlreadyOpen)
                {
                    PopUpText.text = "이제 상점에서 <접시 세트>를 구입할 수 있습니다!";
                    PopUpClose.SetActive(true);
                    PopUp.SetActive(true);
                    IsAlreadyOpen = true;
                }
            }
        }
        save();
    }
示例#6
0
 private void NewDialog_Click(object sender, EventArgs e)//сделано
 {
     SourceBox.Clear();
     QuestionBox.Clear();
     AnswersGrid.Rows.Clear();
     NEW = true;
 }
示例#7
0
 // Returns true if text existed
 public static bool Continue()
 {
     // Set up static instances if we haven't yet
     if (gameObject == null)
     {
         Setup();
     }
     if (showingQuestion)
     {
         QuestionBox question = gameObject.GetComponent <QuestionBox>();
         if (question != null)
         {
             question.Select();
             NextTextbox();
             return(true);
         }
     }
     else
     {
         Textbox textbox = gameObject.GetComponent <Textbox>();
         if (textbox != null)
         {
             if (textbox.Blocking)
             {
                 // If this textbox is done, start the next one
                 if (textbox.Continue())
                 {
                     NextTextbox();
                 }
                 return(true);
             }
         }
     }
     return(false);
 }
示例#8
0
    // Update is called once per frame
    void Update()
    {
        hour = PlayerPrefs.GetInt("Hour");
        //	hour = PlayerPrefs.GetInt("Min");

        if (!DialogPanel.activeSelf && (Ammonite.GetComponent <Friend>().HowFriendly() >= 1))
        {
            if (!IsAlreadyOpen)
            {
                PopUpText.text = "이제 상점에서 <버드미사일>을 구입할 수 있습니다!";
                PopUpClose.SetActive(true);
                PopUp.SetActive(true);
                IsAlreadyOpen = true;
            }

            if ((StartHour <= hour) || (hour < EndHour))
            {
                buyButton.GetComponent <Button> ().enabled = true;
                ShopItem.GetComponent <Button> ().enabled  = true;
                QuestionBox.SetActive(false);
            }
            else
            {
                buyButton.GetComponent <Button> ().enabled = false;
                if (IsAlreadyOpen)
                {
                    ShopItem.GetComponent <Button> ().enabled = true;
                    QuestionBox.SetActive(false);
                }
            }
        }
        save();
    }
示例#9
0
        void btnAddQuestion_Click(object sender, EventArgs e)
        {
            QuestionData newQuestion  = new QuestionData(0);
            frmQuestion  questionForm = new frmQuestion(newQuestion);

            questionForm.ShowDialog();

            //check to see the question is valid ie user didnt cancel
            if (newQuestion.Answers.Count > 0)
            {
                //add question to display
                QuestionBox questionBox = new QuestionBox(newQuestion, questionBoxes.Count + 1, myObjective);
                questionBox.Disposed += new EventHandler(questionBox_Disposed);
                questionBoxes.Add(questionBox);
                pnlMain.Controls.Add(questionBox);

                //add question to currentQuiz we are editing
                GlobalData.currentQuiz.addQuestion(newQuestion);

                //set locations via resize
                pnlMain_Resize(null, null);

                pnlMain.ScrollControlIntoView(questionBox);
            }
        }
示例#10
0
文件: cake.cs 项目: SNUGDC/HomeAlone
    // Update is called once per frame
    void Update()
    {
        month = PlayerPrefs.GetInt("Month");
        day   = PlayerPrefs.GetInt("Day");

        if (!DialogPanel.activeSelf)
        {
            if (((StartMonth1 <= month) && (StartDay1 <= day) && (month <= EndMonth1) && (day <= EndDay1)) || ((StartMonth2 <= month) && (StartDay2 <= day) && (month <= EndMonth2) && (day <= EndDay2)))
            {
                buyButton.GetComponent <Button> ().enabled = true;
                ShopItem.GetComponent <Button> ().enabled  = true;
                QuestionBox.SetActive(false);
                if (!IsAlreadyOpen)
                {
                    PopUpText.text = "특정 기간에만 나오는 케이크를 지금 상점에서 구입할 수 있습니다!";
                    PopUpClose.SetActive(true);
                    PopUp.SetActive(true);
                    IsAlreadyOpen = true;
                }
            }
            else
            {
                buyButton.GetComponent <Button> ().enabled = false;
                if (IsAlreadyOpen)
                {
                    ShopItem.GetComponent <Button> ().enabled = true;
                    QuestionBox.SetActive(false);
                }
            }
        }
        save();
    }
示例#11
0
    // Update is called once per frame
    void Update()
    {
        if (!DialogPanel.activeSelf)
        {
            if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= EventExecuteVisit && !IsAlreadyShow)
            {
                IsAlreadyShow = true;
                SceneManager.LoadScene("Owl Event");
            }

            if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= openVisitCount)
            {
                ShopItem.GetComponent <Button> ().enabled  = true;
                buyButton.GetComponent <Button> ().enabled = true;
                QuestionBox.SetActive(false);
                if (!IsAlreadyOpen)
                {
                    PopUpText.text = "이제 상점에서 <빨래건조대>를 구입할 수 있습니다!";
                    PopUpClose.SetActive(true);
                    PopUp.SetActive(true);
                    IsAlreadyOpen = true;
                }
            }
        }
        save();
    }
 public override void OnInteract(Character character)
 {
     if (QuestionBox.IsVisible())
     {
         if (isChecked)
         {
             QuestionBox.Hide();
         }
         else
         {
             isChecked = true;
             QuestionBox.CheckAnswer();
         }
     }
     else
     {
         if (!isSeen)
         {
             QuestionBox.Uncheck();
         }
         isSeen = true;
         QuestionBox.ShowQuestion(myText);
         character.Behavior.setFrozen(true, true);
     }
 }
示例#13
0
    // Update is called once per frame
    void Update()
    {
        //soda event
        ShopItem.GetComponent <Item> ().load();
        if (ShopItem.GetComponent <Item> ().haveItem() && Croco.enabled && !IsAlreadyShow)
        {
            IsAlreadyShow = true;
            SceneManager.LoadScene("Crocodile Event");
        }

        if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= openVisitCount)
        {
            ShopItem.GetComponent <Button> ().enabled  = true;
            buyButton.GetComponent <Button> ().enabled = true;
            QuestionBox.SetActive(false);
            if (!IsAlreadyOpen)
            {
                PopUpText.text = "이제 상점에서 <바나나>를 구입할 수 있습니다!";
                PopUpClose.SetActive(true);
                PopUp.SetActive(true);
                IsAlreadyOpen = true;
            }
        }
        save();
    }
示例#14
0
 void Reset()
 {
     answer  = null;
     myText  = "";
     pressed = true;
     index   = 0;
     QuestionButton.Enabled = true;
     QuestionBox.Enabled    = true;
     Cursor     = Cursors.Default;
     ControlBox = true;
     Text       = "Bilgisayar Cini";
     QuestionBox.Focus();
     QuestionButton.Text = "Sor";
 }
示例#15
0
        void questionBox_Disposed(object sender, EventArgs e)
        {
            QuestionBox questionBoxDeleted = ((QuestionBox)sender);

            //remove UI element
            questionBoxes.Remove(questionBoxDeleted);
            //adding it to list to be deleted on save
            if (questionBoxDeleted.Question.Id > 0)
            {
                questionsToDeleteOnSave.Add(questionBoxDeleted.Question);
            }
            //reposition objects on view
            pnlMain_Resize(null, null);
        }
示例#16
0
    // Initialization -----------------------------------------------------

    private void Awake()
    {
        // Singleton setup
        CanvasInstance = this;

        // Retreive references to indivual panels
        Transform progressPanel   = transform.Find("ProgressPanel");
        Transform questionPanel   = transform.Find("QuestionPanel");
        Transform navigationPanel = transform.Find("NavigationPanel");
        Transform dragPanel       = transform.Find("DragPanel");
        Transform finalPanel      = transform.Find("FinalPanel");

        // Init progress panel
        m_PointsValue   = progressPanel.Find("PointsValue").GetComponent <Text>();
        m_ProgressValue = progressPanel.Find("ProgressValue").GetComponent <Text>();
        m_ProgressBar   = progressPanel.Find("ProgressBar").GetComponent <Slider>();

        // Init question panel
        m_QuestionPrompt = questionPanel.Find("QuestionPrompt").GetComponent <QuestionPrompt>();
        m_QuestionBox    = questionPanel.Find("QuestionBox").GetComponent <QuestionBox>();
        m_QuestionText   = questionPanel.Find("QuestionText").GetComponent <Text>();

        // Init navigation panel

        // TODO: Disabled for the sake of demo build v0.52.
        // TODO: Currently, the exit function calls a JS close tab function.
        // TODO: However, it cannot close the tab because it did not open it.
        // TODO: This will remain disabled in scene + code until solution is found.
        //m_ExitButton = navigationPanel.Find("ExitButton").GetComponent<Button>();
        //m_ExitButton.onClick.AddListener(OnExit);
        m_ResetButton = navigationPanel.Find("ResetButton").GetComponent <Button>();
        m_ResetButton.onClick.AddListener(OnReset);
        m_CheckButton = navigationPanel.Find("CheckButton").GetComponent <Button>();
        m_CheckButton.onClick.AddListener(OnCheck);
        m_NextButton = navigationPanel.Find("NextButton").GetComponent <Button>();
        m_NextButton.onClick.AddListener(OnNext);
        m_ConsoleText      = navigationPanel.Find("ConsoleText").GetComponent <Text>();
        m_ConsoleText.text = "";

        // Disable final panel
        m_FinalScore = finalPanel.Find("FinalScoreText").GetComponent <Text>();
        finalPanel.gameObject.SetActive(false);

        // Init drag panel
        m_DraggableObjects = dragPanel.GetComponentsInChildren <DraggableObject>();

        // Init other components
        m_AudioSource = GetComponent <AudioSource>();
        m_QuizHandler = GameObject.Find("QuizHandler").GetComponent <QuizHandler>();
    }
示例#17
0
 void Awake()
 {
     Instance           = this;
     dialogFrame        = GetComponent <Image>();
     dialogText         = GetComponentInChildren <Text>();
     answersFrame       = transform.Find("AnswerBox").gameObject.GetComponent <Image>();
     answerText[0]      = transform.Find("AnswerBox").Find("Text1").gameObject.GetComponent <Text>();
     answerText[1]      = transform.Find("AnswerBox").Find("Text2").gameObject.GetComponent <Text>();
     answerText[2]      = transform.Find("AnswerBox").Find("Text3").gameObject.GetComponent <Text>();
     selectionRectangle = transform.Find("AnswerBox").Find("SelectionRectangle").GetComponent <Image>();
     selectedAnswer     = 0;
     audio             = gameObject.AddComponent <AudioSource>();
     audio.playOnAwake = false;
     audio.clip        = (AudioClip)Resources.Load("Sounds/wrong");
 }
示例#18
0
        public QuizView(QuizData quiz)
        {
            InitializeComponent();
            //set title
            lblMessage.Text = quiz.Name;

            //get questions, and display them
            QuizController.GetQuestions(quiz);

            for (int i = quiz.questions.Count - 1; i >= 0; i--)
            {
                QuestionBox questionBox = new QuestionBox(quiz.questions[i], i + 1);
                questionBox.Dock = DockStyle.Top;
                pnlMain.Controls.Add(questionBox);
            }
        }
示例#19
0
        private void Clean()
        {
            AnswerLabel.Visible          = false;
            CorrectAnswerBox.Visible     = false;
            AnswersGrid.Visible          = false;
            ImageSelectionLabel.Visible  = false;
            ImageDirectoryBox.Visible    = false;
            ImageSelectionButton.Visible = false;

            CorrectAnswerBox.Clear();
            ExplanationBox.Clear();
            ImageDirectoryBox.Clear();
            QuestionBox.Clear();
            AnswersGrid.Rows.Clear();
            Update();
        }
示例#20
0
        public QuizView(QuizData quiz)
        {
            InitializeComponent();
            //set title
            lblMessage.Text = quiz.Name;

            //get questions, and display them
            QuizController.GetQuestions(quiz);

            for (int i = quiz.questions.Count - 1; i >= 0; i--)
            {
                QuestionBox questionBox = new QuestionBox(quiz.questions[i], i + 1);
                questionBox.Dock = DockStyle.Top;
                pnlMain.Controls.Add(questionBox);
            }
        }
示例#21
0
 public void ToggleActivation(PlayerInventory inventory, QuestionBox target = null)
 {
     this.inventory = inventory;
     gameObject.SetActive(!gameObject.activeSelf);
     targetQuestionBox = target;
     if (gameObject.activeSelf)
     {
         //RefreshContentInActiveTab();
         opened = true;
         ActivateCanvas(inventory);
     }
     else
     {
         DeactivateCanvas();
         opened = false;
     }
 }
示例#22
0
文件: mug.cs 项目: SNUGDC/HomeAlone
 // Update is called once per frame
 void Update()
 {
     if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= openVisitCount)
     {
         ShopItem.GetComponent <Button> ().enabled  = true;
         buyButton.GetComponent <Button> ().enabled = true;
         QuestionBox.SetActive(false);
         if (!IsAlreadyOpen)
         {
             PopUpText.text = "이제 상점에서 <머그컵 세트>를 구입할 수 있습니다!";
             PopUpClose.SetActive(true);
             PopUp.SetActive(true);
             IsAlreadyOpen = true;
         }
     }
     save();
 }
示例#23
0
        private void ImportResources(string fileName, IResourceFileReader resourceFileReader)
        {
            var workingDirectory = Path.GetDirectoryName(fileName);
            var documentName     = resourceFileReader.GetDocumentName(fileName);

            if (IsDocumentOpen)
            {
                var fileMatchesDocument = string.Equals(Document.Name, documentName, StringComparison.CurrentCultureIgnoreCase);
                if (fileMatchesDocument == false)
                {
                    var closeConfirmation = QuestionBox.Show(Strings.ResourceFileLoad_CloseConfirmation);

                    switch (closeConfirmation)
                    {
                    case MessageBoxResult.Yes:
                        // Load resources in a new document
                        if (CloseDocument())
                        {
                            break;
                        }

                        // User chose not to close current document -> cancel
                        return;

                    case MessageBoxResult.No:
                        // Load resources in opened document
                        break;

                    case MessageBoxResult.Cancel:
                        // Do not load resources
                        return;

                    default:
                        throw new InvalidOperationException();
                    }
                }
            }

            var document = Document ?? CreateNewDocument(workingDirectory, documentName);

            resourceFileReader.LoadResources(document, fileName);

            Document           = document;
            IsDocumentModified = true;
        }
示例#24
0
    // Update is called once per frame
    void Update()
    {
        if (!DialogPanel.activeSelf)
        {
            //soda event
            ShopItem.GetComponent <Item> ().load();
            if (ShopItem.GetComponent <Item> ().haveItem() && Penguin.enabled && sodaBoughtTimes < 1)
            {
                ShopItem.GetComponent <Item> ().decreaseItem();
                sodaBoughtTimes++;
                PlayerPrefs.SetString("SodaEventShow", "True");                                 // show event save.
                SceneManager.LoadScene("Penguin Event");
            }

            //soda
            if (VisitFriend.GetComponent <VisitFriend> ().VisitNumber >= openVisitCount)
            {
                buyButton.GetComponent <Button> ().enabled = true;
                ShopItem.GetComponent <Button> ().enabled  = true;
                QuestionBox.SetActive(false);
                if (!IsAlreadyOpen)
                {
                    PopUpText.text = "이제 상점에서 <형제소다>를 구입할 수 있습니다!";
                    PopUpClose.SetActive(true);
                    PopUp.SetActive(true);
                    IsAlreadyOpen = true;
                }
            }

            //Episode
            if (TalkBalloon_2.GetComponent <TalkBalloon> ().NumberOfTalk() == 20)
            {
                if (!IsAlreadyOpen2)
                {
                    SceneManager.LoadScene("PenguinEp");
                    IsAlreadyOpen2 = true;
                }
            }
        }
        save();
    }
示例#25
0
    // Update is called once per frame
    void Update()
    {
        day   = PlayerPrefs.GetInt("Day");
        month = PlayerPrefs.GetInt("Month");
        if (!DialogPanel.activeSelf)
        {
            CameleonEventShow = (PlayerPrefs.GetString("CameleonEventShow") == "True");
            if ((ShopItem.GetComponent <Item> ().haveItem()) && !CameleonEventShow)
            {
                Wall_gompang.GetComponent <Image> ().enabled  = true;
                Wall_gompang.GetComponent <Button> ().enabled = true;
            }

            //	hour = PlayerPrefs.GetInt("Min");
            if (((StartMonth == month) && (day >= Startday)) || ((month > StartMonth) && (month < EndMonth)))
            {
                buyButton.GetComponent <Button> ().enabled = true;
                ShopItem.GetComponent <Button> ().enabled  = true;
                QuestionBox.SetActive(false);
                if (!IsAlreadyOpen)
                {
                    PopUpText.text = "특정 기간에만 나오는 곰팡이 제거제를 지금 상점에서 구입할 수 있습니다!";
                    PopUpClose.SetActive(true);
                    PopUp.SetActive(true);
                    IsAlreadyOpen = true;
                }
            }
            else
            {
                buyButton.GetComponent <Button> ().enabled = false;
                if (IsAlreadyOpen)
                {
                    ShopItem.GetComponent <Button> ().enabled = true;
                    QuestionBox.SetActive(false);
                }
            }
        }
        save();
    }
示例#26
0
        /// <summary>
        /// Closes the current document.
        /// </summary>
        /// <returns>True if the document was closed, otherwise false.</returns>
        public bool CloseDocument()
        {
            if (IsDocumentOpen)
            {
                if (IsDocumentModified)
                {
                    var closeConfirmation = QuestionBox.Show("Save changes to current document?");

                    switch (closeConfirmation)
                    {
                    case MessageBoxResult.Yes:
                        SaveDocument();
                        break;

                    case MessageBoxResult.Cancel:
                        return(false);
                    }
                }

                Document = null;
            }

            return(true);
        }
示例#27
0
        void btnAddQuestion_Click(object sender, EventArgs e)
        {
            QuestionData newQuestion = new QuestionData(0);
            frmQuestion questionForm = new frmQuestion(newQuestion);
            questionForm.ShowDialog();

            //check to see the question is valid ie user didnt cancel
            if (newQuestion.Answers.Count > 0)
            {
                //add question to display
                QuestionBox questionBox = new QuestionBox(newQuestion, questionBoxes.Count + 1, myObjective);
                questionBox.Disposed += new EventHandler(questionBox_Disposed);
                questionBoxes.Add(questionBox);
                pnlMain.Controls.Add(questionBox);

                //add question to currentQuiz we are editing
                GlobalData.currentQuiz.addQuestion(newQuestion);

                //set locations via resize
                pnlMain_Resize(null, null);

                pnlMain.ScrollControlIntoView(questionBox);
            }
        }
示例#28
0
            /// <summary>
            /// Handles delete button click event.
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            void btnDeleteQuestion_Click(object sender, EventArgs e)
            {
                QuestionBox questionBoxToDelete = (QuestionBox)((((Button)sender).Parent.Parent));

                questionBoxToDelete.Dispose();
            }
示例#29
0
        public QuizView(Objective objective) : base(objective)
        {
            InitializeComponent();
            questionsToDeleteOnSave = new List <QuestionData>();

            //set title
            lblMessage.Text = GlobalData.currentQuiz.Name;

            QuestionEntity temp = new QuestionEntity();

            GlobalData.currentQuiz.Questions.AddRange(temp.ReadQuestions(GlobalData.currentQuiz));

            //create our questions and add them
            questionBoxes = new List <QuestionBox>();
            for (int i = 0; i < GlobalData.currentQuiz.Questions.Count; i++)
            {
                QuestionBox questionBox = new QuestionBox(GlobalData.currentQuiz.Questions[i], i + 1, myObjective);
                questionBox.Disposed += new EventHandler(questionBox_Disposed);
                questionBoxes.Add(questionBox);
            }

            pnlMain.Controls.AddRange(questionBoxes.ToArray());

            //add objective specific objects
            #region Edit Quiz
            if (myObjective == Objective.ManageQuizzes)
            {
                BackToolStripMenuItem.Visible = false;
                //
                // btnAddQuestion
                //
                this.btnAddQuestion = new Button();
                this.btnAddQuestion.BackgroundImage       = global::JiTU_CS.Properties.Resources.add_question;
                this.btnAddQuestion.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
                this.btnAddQuestion.Name = "btnAddQuestion";
                this.btnAddQuestion.Size = new System.Drawing.Size(32, 32);
                this.btnAddQuestion.UseVisualStyleBackColor   = true;
                this.btnAddQuestion.FlatAppearance.BorderSize = 0;
                this.btnAddQuestion.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                this.btnAddQuestion.Click    += new EventHandler(btnAddQuestion_Click);
                pnlMain.Controls.Add(btnAddQuestion);
            }
            #endregion
            #region Take Quiz
            else if (myObjective == Objective.TakeQuiz)
            {
                mnsMain.Visible = false;
                //
                // btnSubmit
                //
                this.btnSubmit      = new Button();
                this.btnSubmit.Name = "btnSubmit";
                this.btnSubmit.UseVisualStyleBackColor = true;
                this.btnSubmit.Text   = "Submit";
                this.btnSubmit.Width  = 100;
                this.btnSubmit.Click += new EventHandler(btnSubmit_Click);
                pnlMain.Controls.Add(btnSubmit);
            }
            #endregion
            #region View All Results
            else if (myObjective == Objective.ViewAllResults)
            {
                saveToolStripMenuItem.Visible    = false;
                discardToolStripMenuItem.Visible = false;
            }
            #endregion

            //finish up by installing resize handler
            this.pnlMain.Resize += new System.EventHandler(this.pnlMain_Resize);
        }
示例#30
0
        public QuizView(Objective objective)
            : base(objective)
        {
            InitializeComponent();
            questionsToDeleteOnSave = new List<QuestionData>();

            //set title
            lblMessage.Text = GlobalData.currentQuiz.Name;

            QuestionEntity temp = new QuestionEntity();
            GlobalData.currentQuiz.Questions.AddRange(temp.ReadQuestions(GlobalData.currentQuiz));

            //create our questions and add them
            questionBoxes = new List<QuestionBox>();
            for (int i = 0; i < GlobalData.currentQuiz.Questions.Count; i++)
            {
                QuestionBox questionBox = new QuestionBox(GlobalData.currentQuiz.Questions[i], i + 1, myObjective);
                questionBox.Disposed += new EventHandler(questionBox_Disposed);
                questionBoxes.Add(questionBox);
            }

            pnlMain.Controls.AddRange(questionBoxes.ToArray());

            //add objective specific objects
            #region Edit Quiz
            if (myObjective == Objective.ManageQuizzes)
            {
                BackToolStripMenuItem.Visible = false;
                //
                // btnAddQuestion
                //
                this.btnAddQuestion = new Button();
                this.btnAddQuestion.BackgroundImage = global::JiTU_CS.Properties.Resources.add_question;
                this.btnAddQuestion.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
                this.btnAddQuestion.Name = "btnAddQuestion";
                this.btnAddQuestion.Size = new System.Drawing.Size(32, 32);
                this.btnAddQuestion.UseVisualStyleBackColor = true;
                this.btnAddQuestion.FlatAppearance.BorderSize = 0;
                this.btnAddQuestion.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                this.btnAddQuestion.Click += new EventHandler(btnAddQuestion_Click);
                pnlMain.Controls.Add(btnAddQuestion);
            }
            #endregion
            #region Take Quiz
            else if (myObjective == Objective.TakeQuiz)
            {
                mnsMain.Visible = false;
                //
                // btnSubmit
                //
                this.btnSubmit = new Button();
                this.btnSubmit.Name = "btnSubmit";
                this.btnSubmit.UseVisualStyleBackColor = true;
                this.btnSubmit.Text = "Submit";
                this.btnSubmit.Width = 100;
                this.btnSubmit.Click += new EventHandler(btnSubmit_Click);
                pnlMain.Controls.Add(btnSubmit);
            }
            #endregion
            #region View All Results
            else if (myObjective == Objective.ViewAllResults)
            {
                saveToolStripMenuItem.Visible = false;
                discardToolStripMenuItem.Visible = false;

            }
            #endregion

            //finish up by installing resize handler
            this.pnlMain.Resize += new System.EventHandler(this.pnlMain_Resize);
        }