Ejemplo n.º 1
0
        public ResultsWindow(PerformanceHelper profiler)
        {
            InitializeComponent();

            Profiler = profiler;
            profiler.NewResultsEvent     += UpdateLastResult;
            profiler.HighestResultsEvent += UpdateHighestResult;

            ToggleButton.Click  += (s, e) => ToggleButton_Clicked();
            ShowLogButton.Click += (s, e) => ShowLogButton_Clicked();
            MinimizeWhenActiveCheckBox.PreviewMouseLeftButtonUp += (s, e) => MinimizeWhenActive_Changed();

            ProcessNameLabel.Content             = $"Process Name: {Profiler.ProcessName}";
            ProcessStartedLabel.Content          = $"Started: {DateTime.Now.ToString()}";
            MinimizeWhenActiveCheckBox.IsChecked = AppSettings.Instance.MinimizeWhenActive;

            Show();

            // Auto start profiler when the window is opened
            ToggleButton_Clicked();
        }
Ejemplo n.º 2
0
        private void StartNewProfiler()
        {
            try
            {
                var profiler = new PerformanceHelper(ResourceType.CPU, GetSelectedProcess())
                {
                    LogInterval   = Convert.ToInt32(LogEveryTextBox.Text),
                    CheckInterval = Convert.ToInt32(CheckEveryTextBox.Text),
                    LogPath       = LogPathTextBox.Text
                };

                var window = new ResultsWindow(profiler);

                _profilers.Add(profiler);
                _resultWindows.Add(window);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Failed to start new profiler: {ex.Message}");
            }
        }