private void NewOperation(string name) { curOperation = name; curProgress = new ProgressForm(curOperation); }
private void openMenuItem_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog() == DialogResult.OK) { ProgressForm progFrm = new ProgressForm("Opening"); ClearState(); dataGridView.DataSource = null; dataSet.Tables[0].BeginLoadData(); clearMenuItem.PerformClick(); Thread th = new Thread(new ParameterizedThreadStart(OpenFile)); th.Start(progFrm); progFrm.ShowDialog(this); } }
private void newCaptureToolStripMenuItem_Click(object sender, EventArgs e) { Capture.ChooseForm frm = new Capture.ChooseForm(); System.Diagnostics.Process[] processes; oSpy.Capture.Device[] devices; bool restartDevices; if (!frm.GetSelection (out processes, out devices, out restartDevices)) return; captureMgr.RestartDevices = restartDevices; if (processes.Length > 0 && devices.Length > 0) { MessageBox.Show ("Capturing from both processes and devices simultaneously is not yet supported.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } NewOperation("Starting capture"); captureMgr.StartCapture(processes, swForm.GetRules(), devices, curProgress); if (curProgress.ShowDialog(this) != DialogResult.OK) { MessageBox.Show(String.Format("Failed to start capture: {0}", curProgress.GetOperationErrorMessage()), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Capture.ProgressForm capProgFrm = new Capture.ProgressForm(captureMgr); capProgFrm.ShowDialog(); NewOperation("Stopping capture"); captureMgr.StopCapture(curProgress); if (curProgress.ShowDialog(this) != DialogResult.OK) { MessageBox.Show(String.Format("Failed to stop capture: {0}", curProgress.GetOperationErrorMessage()), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } NewOperation("Processing capture"); curProgress = new ProgressForm(curOperation); dumpBuilder.BuildAsync(captureMgr.CapturePath, captureMgr.EventCount, curOperation); curProgress.ShowDialog(this); }
private void DoCapture(Capture.Details details) { details.SoftwallRules = swForm.GetRules(); ClearState(); object source = dataGridView.DataSource; dataGridView.DataSource = null; ProgressForm progFrm = new ProgressForm("Starting capture"); captureMgr.StartCapture(details, progFrm); if (progFrm.ShowDialog(this) != DialogResult.OK) { MessageBox.Show(String.Format("Failed to start capture: {0}\n\nIf you're trying to monitor Internet Explorer, make sure you disable its \"Protected Mode\" feature. This issue will be addressed in a future oSpy release.", progFrm.GetOperationErrorMessage()), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Capture.ProgressForm capProgFrm = new Capture.ProgressForm(captureMgr); capProgFrm.ShowDialog(); progFrm = new ProgressForm("Stopping capture"); captureMgr.StopCapture(progFrm); if (progFrm.ShowDialog(this) != DialogResult.OK) { MessageBox.Show(String.Format("Failed to stop capture: {0}", progFrm.GetOperationErrorMessage()), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } progFrm = new ProgressForm("Loading data"); Thread th = new Thread(new ParameterizedThreadStart(DoCapturePostProcessing)); th.Start(progFrm); progFrm.ShowDialog(this); }