Inheritance: System.ComponentModel.BackgroundWorker
コード例 #1
0
        private void btnOpenLeft_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Trace Files|*.tracesql;*.twiz";
            openFileDialog1.FileName = "";
            var result = openFileDialog1.ShowDialog();
            if (result == DialogResult.Cancel)
            {
                return;
            }
            btnLeftSelectAll.Enabled = false;
            execTreeLeft.Nodes.Clear();
            leftSelected.Clear();

            if (result == DialogResult.OK)
            {
                string filename = openFileDialog1.FileName;
                // Process the file

                if (TraceDeserializer.IsSerializedData(filename))
                {
                    if (TraceDeserializer.IsSerializedVersionSupported(filename))
                    {
                        leftData = new TraceDeserializer().DeserializeTraceData(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None));
                        UIBuilder.BuildExecutionTree(leftData, execTreeLeft, SQLMap, ExecMap, false);
                    }
                    else
                    {
                        MessageBox.Show("This version of Trace Wizard cannot import the serialized data, maybe it was serialized with an older version.");
                    }
                }
                else
                {
                    leftProcessor = new TraceProcessor(filename);
                    leftProcessor.WorkerReportsProgress = true;
                    leftProcessor.WorkerSupportsCancellation = true;

                    leftProcessor.ProgressChanged += ProcessorLeft_ProgressChanged;
                    leftProcessor.RunWorkerCompleted += ProcessorLeft_RunWorkerCompleted;
                    leftProcessor.RunWorkerAsync();
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: pjfarsi/Trace-Wizard
        private void Processor_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            progressBar.Value = 0;
            if (e.Cancelled)
            {
                MessageBox.Show("Trace file processing cancelled.");
                processor = null;
                System.GC.Collect();
                return;
            }
            
            traceData = (TraceData)e.Result;
            UpdateUI();
            sw.Stop();

            MessageBox.Show("Trace file processed in " + sw.Elapsed.TotalSeconds + " seconds.");
            sw.Reset();
            System.GC.Collect();
        }
コード例 #3
0
ファイル: MainForm.cs プロジェクト: pjfarsi/Trace-Wizard
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Trace Files|*.tracesql";
            openFileDialog1.FileName = "";
            var result = openFileDialog1.ShowDialog();
            if (result == DialogResult.OK)
            {
                string filename = openFileDialog1.FileName;
                // Process the file

                executionTree.Nodes.Clear();
                sqlListView.Items.Clear();
                stackTraceListView.Items.Clear();
                detailsBox.Items.Clear();

                processor = new TraceProcessor(filename);
                processor.WorkerReportsProgress = true;
                processor.WorkerSupportsCancellation = true;

                processor.ProgressChanged += Processor_ProgressChanged;
                processor.RunWorkerCompleted += Processor_RunWorkerCompleted;
                sw.Reset();
                sw.Start();
                processor.RunWorkerAsync();
            }
        }
コード例 #4
0
ファイル: MainForm.cs プロジェクト: tslater2006/Trace-Wizard
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Trace Files|*.tracesql;*.twiz";
            openFileDialog1.FileName = "";
            var result = openFileDialog1.ShowDialog();

            executionTree.Nodes.Clear();
            sqlListView.Items.Clear();
            stackTraceListView.Items.Clear();
            detailsBox.Items.Clear();

            if (result == DialogResult.OK)
            {
                string filename = openFileDialog1.FileName;
                // Process the file

                if (TraceDeserializer.IsSerializedData(filename))
                {
                    if (TraceDeserializer.IsSerializedVersionSupported(filename))
                    {
                        sw.Reset();
                        sw.Start();
                        traceData = new TraceDeserializer().DeserializeTraceData(new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.None));
                        UpdateUI();
                        sw.Stop();

                        MessageBox.Show("Trace data loaded in " + sw.Elapsed.TotalSeconds + " seconds.");
                        sw.Reset();
                    }
                    else
                    {
                        MessageBox.Show("This version of Trace Wizard cannot import the serialized data, maybe it was serialized with an older version.");
                    }
                }
                else
                {
                    processor = new TraceProcessor(filename);
                    processor.WorkerReportsProgress = true;
                    processor.WorkerSupportsCancellation = true;

                    processor.ProgressChanged += Processor_ProgressChanged;
                    processor.RunWorkerCompleted += Processor_RunWorkerCompleted;
                    sw.Reset();
                    sw.Start();
                    processor.RunWorkerAsync();
                }
            }
        }