コード例 #1
0
        //Save
        private void button1_Click(object sender, EventArgs e)
        {
            if (ValidateAndSaveQuestion())
            {
                QBManager.Load();
                //frmParent.RefreshGrid(QBManager.QBank.Questions);

                MessageBox.Show(this, "Question saved successfully", "Success", MessageBoxButton.OK, MessageBoxImage.Information);

                if (this.ID == null)
                {
                    //Reload the form with empty fields
                    //comboBox1.SelectedIndex = -1;
                    comboTopic.SelectedIndex = -1;

                    //htmlwysiwyg1.setHTML("");
                    //htmlwysiwyg2.setHTML("");
                    //htmlwysiwyg3.setHTML("");
                    //htmlwysiwyg4.setHTML("");
                    //htmlwysiwyg5.setHTML("");
                    //htmlwysiwyg6.setHTML("");
                    //htmlwysiwyg7.setHTML("");
                    txtQuestion.Text    = string.Empty;
                    txtOp1.Text         = string.Empty;
                    txtOp2.Text         = string.Empty;
                    txtOp3.Text         = string.Empty;
                    txtOp4.Text         = string.Empty;
                    txtOp5.Text         = string.Empty;
                    txtExplination.Text = string.Empty;

                    if (!chkDescr.IsChecked == true)
                    {
                        // htmlwysiwyg8.setHTML("");
                        txtDirection.Text = string.Empty;
                    }

                    chkOp1.IsChecked = false;
                    chkOp2.IsChecked = false;
                    chkOp3.IsChecked = false;
                    chkOp4.IsChecked = false;
                    chkOp5.IsChecked = false;

                    radMod.IsChecked = true;
                }
                else
                {
                    this.Close();
                }
            }
        }
コード例 #2
0
        private void openExistQuestionBank(object sender, EventArgs e)
        {
            //if (Properties.Settings.Default["LastFolderPath"].ToString() != "")
            //{
            //    openFileDialog1.InitialDirectory = Properties.Settings.Default["LastFolderPath"].ToString();
            //}

            //  if (Properties.Settings.Default["LastFolderPath"].ToString() != "")
            //{
            //    openFileDialog1.InitialDirectory = Properties.Settings.Default["LastFolderPath"].ToString();
            // }

            System.Windows.Forms.DialogResult dr = openFileDialog1.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                QBManager.FileName = openFileDialog1.FileName;

                // Saves settings in application configuration file
                //Properties.Settings.Default["LastFolderPath"] = System.IO.Path.GetDirectoryName(openFileDialog1.FileName);
                //Properties.Settings.Default.Save();

                //toolStripStatusLabel1.Text = openFileDialog1.FileName;

                QBManager.Load();
                if (QBManager.QBank.Mode == null)
                {
                    QBManager.QBank.Mode = "Operator";
                }

                //.Rows.Clear();
                List <Question> list = QBManager.QBank.Questions;
                foreach (Question q in list)
                {
                    itmsQuestions.Items.Add(q);
                }

                //toolStripStatusLabel3.Text = QBManager.QBank.ExamGrade;
                //toolStripStatusLabel4.Text = QBManager.QBank.LastModifiedDate.ToString();

                //editDetailsToolStripMenuItem.Enabled = true;
                //newQuestionToolStripMenuItem.Enabled = true;
                //toolStripMenuItem3.Enabled = true;
                //syncToolStripMenuItem.Enabled = true;
            }
        }