Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAnalyze_Click(object sender, RoutedEventArgs e)
        {
            string line = "";
            _process_log = new List<string>();

            if (textBoxCaptureFile.Text == "")
            {
                line = "No capture file selected.";
                _process_log.Add(DateTime.Now.ToString() + ":\t" + line);
                if (_command_line_called)
                    System.Windows.Application.Current.Shutdown(-1);
                else
                    System.Windows.MessageBox.Show(line, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                FileInfo cap_file = new FileInfo(textBoxCaptureFile.Text);

                if (cap_file.Exists)
                {
                    if (_process_status != Enums.ProcessStatusState.InProgress && _process_status != Enums.ProcessStatusState.Paused)
                    {
                        this.Cursor = System.Windows.Input.Cursors.Wait;
                        _process_status = Enums.ProcessStatusState.InProgress;
                        buttonAnalyze.IsEnabled = false;

                        _analysis_settings.DeviceIp = new IPv4Addr(textBoxIpAddress.Text);
                        _analysis_settings.CaptureFileName = textBoxCaptureFile.Text;
                        _analysis_settings.WiresharkFilterString = textBoxWiresharkFilter.Text;

                        ClearResults();
                        _background_worker.RunWorkerAsync();
                    }
                    else
                    {
                        line = "Analysis process already started.";
                        _process_log.Add(DateTime.Now.ToString() + ":\t" + line);
                        System.Windows.MessageBox.Show(line, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    line = "Capture file does not exist.";
                    _process_log.Add(DateTime.Now.ToString() + ":\t" + line);
                    if (_command_line_called)
                        System.Windows.Application.Current.Shutdown(-2);
                    else
                        System.Windows.MessageBox.Show(line, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void background_worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if ((Enums.AnalysisStatus)e.Result == Enums.AnalysisStatus.Success)
            {
                comboBoxResultsDataset.Items.Clear();
                for (int i = 0; i < Results.Datasets.Count; i++)
                    comboBoxResultsDataset.Items.Add(Results.Datasets[i].DatasetIdent.Name);
                comboBoxResultsDataset.SelectedIndex = 0;
                textBoxSuccess.Text = "SUCCESS";
                textBoxSuccess.Background = Constants.TextBoxBackgroundBrushValid;
                PopulateResultsTextBox(comboBoxResultsDataset.SelectedIndex);
                BuildChart(comboBoxResultsDataset.SelectedIndex);
                buttonResultsChartResetZoom.IsEnabled = true;
            }
            else
            {
                _process_status = Enums.ProcessStatusState.Error;
            }
            this.Cursor = System.Windows.Input.Cursors.Arrow;
            buttonAnalyze.IsEnabled = true;
            _process_status = Enums.ProcessStatusState.Completed;

            if (_command_line_called) this.Close();
        }