示例#1
0
文件: MainForm.cs 项目: SayHalou/ospy
        private void newCaptureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Capture.ChooseForm frm = new Capture.ChooseForm();

            Process[] processes = frm.GetSelectedProcesses();
            if (processes.Length == 0)
                return;

            ProgressForm progFrm = new ProgressForm("Starting capture");

            captureMgr.StartCapture(processes, progFrm);

            if (progFrm.ShowDialog() != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to start capture: {0}", 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() != DialogResult.OK)
            {
                MessageBox.Show(String.Format("Failed to stop capture: {0}", progFrm.GetOperationErrorMessage()),
                                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                captureMgr.SaveCapture(saveFileDialog.FileName);
            }
            else
            {
                captureMgr.DiscardCapture();
            }

            #if false
            tmpEventList.Clear();
            tmpPacketList.Clear();

            captureStartMenuItem.Enabled = false;

            object source = dataGridView.DataSource;
            dataGridView.DataSource = null;

            CaptureForm frm = new CaptureForm(listener, swForm.GetRules());
            frm.ShowDialog(this);

            dataGridView.DataSource = null;

            ProgressForm progFrm = new ProgressForm("Analyzing data");

            Thread th = new Thread(new ParameterizedThreadStart(DoPostAnalysis));
            th.Start(progFrm);

            progFrm.ShowDialog(this);
            #endif
        }
示例#2
0
 public void ShowCaptureDialog()
 {
     TopLevelControl.Hide();
     System.Threading.Thread.Sleep(500);
     CaptureForm c = new CaptureForm();
     c.ShowDialog();
     SetFocus();
     Paste();
     TopLevelControl.Show();
 }
示例#3
0
 private void 截图CToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CaptureForm c = new CaptureForm();
     c.ShowDialog();
 }