private void OK_Click(object sender, EventArgs e) { OK.Enabled = false; Controls.Remove(chart1); Controls.Remove(dataGridView); BW.RunWorkerAsync("OK"); }
//Načtení anime private void LoadAnime() { Main_LB01.Visible = true; AnimeS.Columns.Clear(); AnimeS.Rows.Clear(); AnimeID.Clear(); AnimeS.Width = Convert.ToInt32(Math.Truncate((float)this.Width / 250) * 250); AnimeS.Height = 240; AnimeS.Location = new Point((this.Width - AnimeS.Width) / 2, AnimeS.Location.Y); Anime.Location = new Point((this.Width - Anime.Width) / 2, AnimeS.Location.Y + AnimeS.Height + 20); AnimeS.Columns.Add(new DataGridViewImageColumn()); AnimeS.Rows.Add(); AnimeS.Rows[0].Height = 230; AnimeS.Rows.Add(); AnimeS.Rows[1].Height = 5; AnimeS.Rows[1].DefaultCellStyle.SelectionBackColor = DesignColor; AnimeS.Rows[1].DefaultCellStyle.SelectionForeColor = DesignColor; if (BW.IsBusy) { BW.CancelAsync(); Thread.Sleep(3000); } BW.RunWorkerAsync(); }
private void start_Click(object sender, EventArgs e) { //выкл кнопку Cancel.Enabled = true; start.Enabled = false; Controls.Remove(chart1); Controls.Remove(dataGridView); BW.RunWorkerAsync("START");//запуск кода в обработчике do_work, выполняется в отдельном потоке }
private void Form1_Load(object sender, EventArgs e) { maStart.Value = 10; maEnd.Value = 20; rsiStart.Value = 8; rsiEnd.Value = 12; ma2Start.Value = 12; ma2End.Value = 15; BW.RunWorkerAsync(); }
private void button2_Click(object sender, System.EventArgs e) { ma2Start.Enabled = false; ma2End.Enabled = false; rsiStart.Enabled = false; rsiEnd.Enabled = false; maStart.Enabled = false; maEnd.Enabled = false; BW.RunWorkerAsync(); }
private async void UserWindow_Load(object sender, EventArgs e) { // SelectedUser был без ID , тут мы его всего забираем из базы Variable.SelectedUser = ServiceClient.FindUser(Variable.SelectedUser); // подгрузить заметки юзера Variable.Notes = await ServiceClient.GetNotesOfUser(Variable.SelectedUser.Id_); listBoxNotesOfUser.Items.AddRange(Variable.Notes.Select(x => x.Title).ToArray()); // Хаб для SignalR hubConnection = new HubConnection("http://localhost:36932/"); stockTickerHubProxy = hubConnection.CreateHubProxy("SignalRHub"); stockTickerHubProxy.On("Update", () => BW.RunWorkerAsync());// BW - BackgroundWorker hubConnection.Start().Wait(); // BackgroundWorker для клиентской обработки серверного метода от SignalR BW.DoWork += update; BW.RunWorkerCompleted += BW_RunWorkerCompleted; }
/// <summary> /// Rename files /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BTRename_Click(object sender, EventArgs e) { // Rename if files if (LVFiles.Items.Count > 0) { DialogResult dialogResult = MessageBox.Show($"{LVFiles.Items.Count} files are about to be renamed. Do you want to continue ?", "Rename files", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dialogResult == DialogResult.Yes) { // Start (processing files) thread loading = true; new Thread(Loading).Start(); BW.RunWorkerAsync(); BTClear.Enabled = false; BTRename.Enabled = false; } } }
private void MainMenu_Load(object sender, EventArgs e) { BW.RunWorkerAsync(); }
private void btn_Get_Click(object sender, EventArgs e) { currChapter = first; BW.RunWorkerAsync(); }
private void UserList_Load(object sender, EventArgs e) { BW.RunWorkerAsync(); }