Exemple #1
0
            public WorkflowProvider(TraceEventsDataView view, int?rowIndex, int?columnIndex)
            {
                this.view        = view;
                this.rowIndex    = rowIndex;
                this.columnIndex = columnIndex;

                providerIdColumn = (DataColumn <Guid>)view.DataTable.Columns.FirstOrDefault(
                    x => x.Id == GenericEventsViewModelSource.ProviderIdColumnId);
            }
Exemple #2
0
        public TraceLogToolViewModel(
            ISettingsService settings, ITraceController traceController,
            Func <ISettingsStore, TraceSettingsViewModel> traceSettingsViewModelFactory,
            IVsUIShell uiShell = null)
        {
            this.settings        = settings ?? throw new ArgumentNullException(nameof(settings));
            this.traceController = traceController ?? throw new ArgumentNullException(nameof(traceController));
            this.traceSettingsViewModelFactory = traceSettingsViewModelFactory ??
                                                 throw new ArgumentNullException(nameof(traceSettingsViewModelFactory));
            this.uiShell = uiShell;

            settings.SettingsLayerChanged += OnSettingsLayerChanged;

            traceController.SessionStarting += OnSessionStarting;
            traceController.SessionStarted  += OnSessionStarted;
            traceController.SessionStopped  += OnSessionStopped;

            var tableTuple     = new GenericEventsViewModelSource().CreateTable(this);
            var dataTable      = tableTuple.Item1;
            var templatePreset = tableTuple.Item2;

            var defaultPreset = GenericEventsViewModelSource.CreateDefaultPreset();
            var viewPresets   = settings.GetGlobalStore().GetViewPresets(SettingsSerializer.Mapper);

            viewPresets.BuiltInPresets.Add(defaultPreset);

            var preset = viewPresets.TryGetPersistedPresetByName(defaultPreset.Name);

            if (preset == null)
            {
                preset = defaultPreset;
            }

            EventsDataView = new TraceEventsDataView(dataTable, this);
            AdvModel       = new AsyncDataViewModel(
                EventsDataView, templatePreset, preset, viewPresets);

            GridModel = AdvModel.GridViewModel;
            AdvModel.PresetChanged += OnViewPresetChanged;
            BindingOperations.SetBinding(GridModel, AsyncDataGridViewModel.AutoScrollProperty, new Binding(nameof(AutoScroll))
            {
                Source = this
            });

            updateStatsTimer          = new DispatcherTimer(DispatcherPriority.Background);
            updateStatsTimer.Interval = TimeSpan.FromSeconds(1);
            updateStatsTimer.Tick    += (s, e) => UpdateStats();

            LoadGlobalSettings();
            LoadAmbientSettings();
        }