LoadQuestions() public method

public LoadQuestions ( string strDirectory, System.Windows.Controls.RichTextBox richMain ) : bool
strDirectory string
richMain System.Windows.Controls.RichTextBox
return bool
コード例 #1
0
        /// <summary>
        /// Init the main window
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                masterPRNG = new Random(Convert.ToInt32(System.DateTime.Now));
            }
            catch
            {
                masterPRNG = new Random();
            }

            qCollection = new QuestionCollection(masterPRNG);
            richTextBox1.AppendText("Loading questions..." + Environment.NewLine);
            if (qCollection.LoadQuestions(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\NCCQuestions", richTextBox1) == false)
            {
                MessageBox.Show("Having to exit due to not being able to find the questions directory!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            richTextBox1.AppendText("Loaded questions." + Environment.NewLine);

            button1.IsEnabled = false;
            button2.IsEnabled = false;
            button3.IsEnabled = false;
            button4.IsEnabled = false;
            button5.IsEnabled = true;
            button6.IsEnabled = false;
            button7.IsEnabled = false;
        }
コード例 #2
0
        /// <summary>
        /// Init the main window
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            try
            {

               masterPRNG = new Random(Convert.ToInt32(System.DateTime.Now));
            }
            catch
            {
                masterPRNG = new Random();
            }

            qCollection = new QuestionCollection(masterPRNG);
            richTextBox1.AppendText("Loading questions..." + Environment.NewLine);
            if(qCollection.LoadQuestions(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "\\NCCQuestions", richTextBox1) == false){
                MessageBox.Show("Having to exit due to not being able to find the questions directory!", "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }
            richTextBox1.AppendText("Loaded questions." + Environment.NewLine);

            button1.IsEnabled = false;
            button2.IsEnabled = false;
            button3.IsEnabled = false;
            button4.IsEnabled = false;
            button5.IsEnabled = true;
            button6.IsEnabled = false;
            button7.IsEnabled = false;
        }