Пример #1
0
        private void UpdateProfiling()
        {
            if (device is object)
            {
                profilerMenuItem.Checked = device.Profiler.Enabled;

                if (device.Profiler.Enabled)
                {
                    profilerWindow.Show();
                }
                else
                {
                    profilerWindow.Visible = false;
                }
            }
        }
Пример #2
0
        public override void CreateProfiler(ProfilerConfig config, int enabledTimeRulerLevels, int enabledPerformanceGraphLevels, int enabledProfilerSummaryLevels)
        {
            if (CreateUI == false)
            {
                return;
            }

            _profilerConfig = config;

            _profilerViewModel = new ProfilerViewModel(config.TimeRulerConfig.VisibleLevelsFlags, config.PerformanceGraphConfig.VisibleLevelsFlags, config.ProfilerSummaryConfig.VisibleLevelsFlags);
            _profilerViewModel.LevelItemChanged += (sender, args) =>
            {
                OnLevelItemChanged(new LevelItemChangedEventArgs(args.Key, args.LevelId, args.Enabled));
            };

            _profilerWindow = new ProfilerWindow
            {
                Top    = config.Top,
                Left   = config.Left,
                Width  = config.Width,
                Height = config.Height
            };

            _profilerWindow.trLevelsListBox.DataContext = _profilerViewModel.TimeRulerLevels;
            _profilerWindow.PgLevelsListBox.DataContext = _profilerViewModel.PerformanceGraphLevels;
            _profilerWindow.PsLevelsListBox.DataContext = _profilerViewModel.ProfilerSummaryLevels;

            _profilerWindow.EnableAllTimeRulerLevels         += (sender, args) => { _profilerViewModel.EnableAllTimeRulerLevels(); };
            _profilerWindow.DisableAllTimeRulerLevels        += (sender, args) => { _profilerViewModel.DisableAllTimeRulerLevels(); };
            _profilerWindow.EnableAllPerformanceGraphLevels  += (sender, args) => { _profilerViewModel.EnableAllPerformanceGraphLevels(); };
            _profilerWindow.DisableAllPerformanceGraphLevels += (sender, args) => { _profilerViewModel.DisableAllPerformanceGraphLevels(); };
            _profilerWindow.EnableAllProfilerSummaryLevels   += (sender, args) => { _profilerViewModel.EnableAllProfilerSummaryLevels(); };
            _profilerWindow.DisableAllProfilerSummaryLevels  += (sender, args) => { _profilerViewModel.DisableAllProfilerSummaryLevels(); };

            _profilerWindow.IsVisibleChanged += (sender, args) => _profilerConfig.Visible = _profilerWindow.IsVisible;
            _profilerWindow.LocationChanged  += (sender, args) => _profilerLocationJustChanged = true;
            _profilerWindow.SizeChanged      += (sender, args) => _profilerLocationJustChanged = true;

            if (_profilerConfig.Visible)
            {
                _profilerWindow.Show();
            }

            _windows.Add(_profilerWindow);

            WindowHelper.EnsureOnScreen(_profilerWindow);
        }