Example #1
0
 /// <summary>
 /// The handler for when the dictionary loader changes progress. Changes the progress value of the progress bar.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DictionaryLoader_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     if (!Pb1.Visible)
     {
         Pb1.Show();
     }
     Pb1.Value = e.ProgressPercentage;
 }
Example #2
0
 /// <summary>
 /// Helper method that should be called from the main thread prior to starting the background dictionary loader
 /// </summary>
 /// <param name="postSave">True to save the dictionary after loading</param>
 private void PreDictionaryLoader(bool postSave)
 {
     Pb1.Value = 0;
     Pb1.Show();
     LabelDictionaryStatus.Text = DICT_STATUS_LABEL_PROMPT + "Loading...";
     LabelDictionaryStatus.Show();
     MenuItemDictionary.Enabled = false;
     _saveWhenFinished          = postSave;
 }
Example #3
0
 private void Pov_Click(object sender, EventArgs e)
 {
     st.Reset();
     st.Start();
     Pb2.Image = Pb1.Image;
     Pb2.Image.RotateFlip(RotateFlipType.Rotate180FlipY);
     Pb1.Load(openFileDialog1.FileName);
     st.Stop();
     label1.Text = Convert.ToString(st.Elapsed.Milliseconds + " мс");
 }
Example #4
0
 private void Soh_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         Pb1.Load(openFileDialog1.FileName);
         Pb2.Image = Pb1.Image;
         Pb3.Image = Pb1.Image;
         Pb4.Image = Pb1.Image;
         Pb5.Image = Pb1.Image;
         Pb6.Image = Pb1.Image;
     }
 }
Example #5
0
        /// <summary>
        /// The method called when the dictionary loader finishes.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DictionaryLoader_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            bool?     result = e.Result as bool?;
            Exception error  = e.Result as Exception;

            if (e.Error != null)
            {
                MessageBox.Show("An error occurred loading the dictionary:\n" + e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (e.Cancelled)
            {
                //TODO: Handle user cancelled
            }
            else if (result != null && result.HasValue)
            {
                if (result.Value)
                {
                    LabelDictionarySave.Text = DICT_LABEL_PROMPT + Tree.WordCount;
                    BtnFindWords.Enabled     = true;
                }
                else
                {
                    MessageBox.Show("Error loading");
                }
            }
            else if (error != null)
            {
                MessageBox.Show("An error occurred whilst loading the dictionary: " + error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Pb1.Hide();
            LabelDictionaryStatus.Hide();
            MenuItemDictionary.Enabled = true;

            if (!File.Exists(GetDictionaryPath()) && Tree.WordCount > 0)
            {
                PreDictionarySaver(null);
            }
        }