Exemplo n.º 1
0
        private async void LoadFileButton_Click(object sender, EventArgs e)
        {
            LoadFileButton.Enabled     = false;
            LoadFileTextBox.Enabled    = false;
            StatusLabel.Text           = @"Loading...";
            LoadingPictureBox.Location = new Point(
                RTBAsync.Location.X + ((RTBAsync.Width / 2) - (LoadingPictureBox.Width / 2)),
                RTBAsync.Location.Y + ((RTBAsync.Height / 2) - (LoadingPictureBox.Height / 2)));
            LoadingPictureBox.Show();

            try
            {
                await RTBAsync.LoadFileAsync(LoadFileTextBox.Text);

                StatusLabel.Text = @"Done!";
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                StatusLabel.Text = @"Couldn't load file!";
            }
            finally
            {
                LoadingPictureBox.Hide();
                LoadFileButton.Enabled  = true;
                LoadFileTextBox.Enabled = true;
            }
        }
Exemplo n.º 2
0
        private async void ImportTxtBtn_Click(object sender, EventArgs e)
        {
            ImportForm import = new ImportForm();

            import.ShowDialog();
            if (string.IsNullOrEmpty(import.ImportBuffer))
            {
                return;
            }
            LoadingPictureBox.Visible = true;
            LoadingPictureBox.BringToFront();
            await Task.Run(() => OnImportTxt(import));

            LoadingPictureBox.SendToBack();
            LoadingPictureBox.Visible = false;
        }