public AnalyseMainPanelViewModel(IApplicationSettings applicationSettings, IDataSources dataSources, IDispatcher dispatcher, ITaskScheduler taskScheduler, IAnalysisStorage analysisStorage) : base(applicationSettings) { if (dataSources == null) { throw new ArgumentNullException(nameof(dataSources)); } if (dispatcher == null) { throw new ArgumentNullException(nameof(dispatcher)); } if (taskScheduler == null) { throw new ArgumentNullException(nameof(taskScheduler)); } if (analysisStorage == null) { throw new ArgumentNullException(nameof(analysisStorage)); } _dispatcher = dispatcher; _sidePanels = new ISidePanelViewModel[] { _analysesSidePanel = new AnalysesSidePanel(dispatcher, taskScheduler, analysisStorage), _dataSelectionSidePanel = new AnalysisDataSelectionSidePanel(applicationSettings, dataSources), _widgetsSidePanel = new WidgetsSidePanel() }; _createAnalysisCommand = new DelegateCommand(CreateAnalysis); SelectedSidePanel = _sidePanels.FirstOrDefault(x => x.Id == applicationSettings.MainWindow?.SelectedSidePanel); }
public AnalysisViewModel(IDispatcher dispatcher, AnalysisViewTemplate viewTemplate, IAnalysis analyser, IAnalysisStorage analysisStorage, IPluginLoader pluginLoader) { _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); _analyser = analyser ?? throw new ArgumentNullException(nameof(analyser)); _analysisStorage = analysisStorage ?? throw new ArgumentNullException(nameof(analysisStorage)); _viewTemplate = viewTemplate ?? throw new ArgumentNullException(nameof(viewTemplate)); _pluginLoader = pluginLoader ?? throw new ArgumentNullException(nameof(pluginLoader)); _pages = new ObservableCollection <AnalysisPageViewModel>(); _addPageCommand = new DelegateCommand(AddNewPage); _removeCommand = new DelegateCommand(RemoveThis); _captureSnapshotCommand = new DelegateCommand2(CaptureSnapshot) { CanBeExecuted = true }; if (viewTemplate.Pages.Any()) { foreach (var pageTemplate in viewTemplate.Pages) { // TODO: Solve this conundrum! AddPage((PageTemplate)pageTemplate); } } else { AddNewPage(); } _selectedPage = _pages.FirstOrDefault(); }
public AnalysesSidePanel(IDispatcher dispatcher, ITaskScheduler taskScheduler, IAnalysisStorage analysisStorage) { if (dispatcher == null) { throw new ArgumentNullException(nameof(dispatcher)); } if (taskScheduler == null) { throw new ArgumentNullException(nameof(taskScheduler)); } if (analysisStorage == null) { throw new ArgumentNullException(nameof(analysisStorage)); } _dispatcher = dispatcher; _taskScheduler = taskScheduler; _analysisStorage = analysisStorage; _pathComparer = new PathComparer(); _activeById = new Dictionary <AnalysisId, AnalysisViewModel>(); _active = new ObservableCollection <AnalysisViewModel>(); _available = new ObservableCollection <AnalysisTemplateViewModel>(); _availableSnapshotsByFileName = new Dictionary <string, AnalysisSnapshotItemViewModel>(); _availableSnapshots = new ObservableCollection <AnalysisSnapshotItemViewModel>(); UpdateTooltip(); PropertyChanged += OnPropertyChanged; }
public AnalysisPageViewModel(AnalysisId id, PageTemplate template, IAnalysis analysis, IAnalysisStorage analysisStorage, IPluginLoader pluginLoader) { _id = id; _template = template ?? throw new ArgumentNullException(nameof(template)); _analysis = analysis ?? throw new ArgumentNullException(nameof(analysis)); _analysisStorage = analysisStorage ?? throw new ArgumentNullException(nameof(analysisStorage)); _name = "New Page"; _deletePageCommand = new DelegateCommand(DeletePage, () => _canBeDeleted); _widgets = new List <IWidgetViewModel>(); _analysersPerWidget = new Dictionary <IWidgetViewModel, IDataSourceAnalyser>(); PageLayout = PageLayout.WrapHorizontal; var widgetPlugins = LoadRelevantPlugins(pluginLoader); foreach (var widgetTemplate in template.Widgets) { if (_analysis.TryGetAnalyser(widgetTemplate.AnalyserId, out var analyser)) { if (widgetPlugins.TryGetValue(widgetTemplate.LogAnalyserFactoryId, out var plugin)) { AddExistingWidget(plugin, widgetTemplate, analyser); } else { Log.WarnFormat("Unable to find plugin widget factory '{0}', widget '{1} ({2})' will NOT be displayed", widgetTemplate.LogAnalyserFactoryId, widgetTemplate.Title, widgetTemplate.Id); } } else { Log.WarnFormat("Unable to find analyser '{0}', widget '{1} ({2})' will NOT be displayed", widgetTemplate.AnalyserId, widgetTemplate.Title, widgetTemplate.Id); } } }
public AnalysisViewModel(IDispatcher dispatcher, AnalysisViewTemplate viewTemplate, IAnalysis analyser, IAnalysisStorage analysisStorage, IPluginLoader pluginLoader) { _dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); _analyser = analyser ?? throw new ArgumentNullException(nameof(analyser)); _analysisStorage = analysisStorage ?? throw new ArgumentNullException(nameof(analysisStorage)); _viewTemplate = viewTemplate ?? throw new ArgumentNullException(nameof(viewTemplate)); _pluginLoader = pluginLoader ?? throw new ArgumentNullException(nameof(pluginLoader)); _pages = new ObservableCollection <AnalysisPageViewModel>(); _addPageCommand = new DelegateCommand(AddPage); _removeCommand = new DelegateCommand(RemoveThis); _captureSnapshotCommand = new DelegateCommand2(CaptureSnapshot) { CanBeExecuted = true }; AddPage(); _selectedPage = _pages.FirstOrDefault(); }
public AnalysisViewModel(IDispatcher dispatcher, AnalysisViewTemplate viewTemplate, IAnalysis analyser, IAnalysisStorage analysisStorage) { if (dispatcher == null) { throw new ArgumentNullException(nameof(dispatcher)); } if (viewTemplate == null) { throw new ArgumentNullException(nameof(viewTemplate)); } if (analyser == null) { throw new ArgumentNullException(nameof(analyser)); } if (analysisStorage == null) { throw new ArgumentNullException(nameof(analysisStorage)); } _dispatcher = dispatcher; _analyser = analyser; _analysisStorage = analysisStorage; _viewTemplate = viewTemplate; _pages = new ObservableCollection <AnalysisPageViewModel>(); _addPageCommand = new DelegateCommand(AddPage); _removeCommand = new DelegateCommand(RemoveThis); _captureSnapshotCommand = new DelegateCommand2(CaptureSnapshot) { CanBeExecuted = true }; _name = "Unsaved analysis"; AddPage(); _selectedPage = _pages.FirstOrDefault(); }
public MainWindowViewModel(IApplicationSettings settings, DataSources dataSources, QuickFilters quickFilters, IActionCenter actionCenter, IAutoUpdater updater, ITaskScheduler taskScheduler, IAnalysisStorage analysisStorage, IDispatcher dispatcher, IPluginLoader pluginLoader) { if (dataSources == null) { throw new ArgumentNullException(nameof(dataSources)); } if (quickFilters == null) { throw new ArgumentNullException(nameof(quickFilters)); } if (updater == null) { throw new ArgumentNullException(nameof(updater)); } if (dispatcher == null) { throw new ArgumentNullException(nameof(dispatcher)); } _applicationSettings = settings; _plugins = pluginLoader.Plugins; _settings = new SettingsMainPanelViewModel(settings); _actionCenterViewModel = new ActionCenterViewModel(dispatcher, actionCenter); _analysePanel = new AnalyseMainPanelViewModel(_applicationSettings, dataSources, dispatcher, taskScheduler, analysisStorage, pluginLoader); _analysePanel.PropertyChanged += AnalysePanelOnPropertyChanged; _logViewPanel = new LogViewMainPanelViewModel(actionCenter, dataSources, quickFilters, _applicationSettings); _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged; _timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; _timer.Tick += TimerOnTick; _timer.Start(); _autoUpdater = new AutoUpdateViewModel(updater, settings.AutoUpdate, dispatcher); _showLogCommand = new DelegateCommand(ShowLog); _showGoToLineCommand = new DelegateCommand2(ShowGoToLine); _showQuickNavigationCommand = new DelegateCommand2(ShowQuickNavigation); _goToNextDataSourceCommand = new DelegateCommand2(GoToNextDataSource); _goToPreviousDataSourceCommand = new DelegateCommand2(GoToPreviousDataSource); _analyseEntry = new AnalyseMainPanelEntry(); _rawEntry = new LogViewMainPanelEntry(); _topEntries = new IMainPanelEntry[] { _rawEntry, _analyseEntry }; _settingsEntry = new SettingsMainPanelEntry(); _pluginsEntry = new PluginsMainPanelEntry(); _aboutEntry = new AboutMainPanelEntry(); _bottomEntries = new[] { _settingsEntry, _pluginsEntry, _aboutEntry }; var selectedTopEntry = _topEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel); var selectedBottomEntry = _bottomEntries.FirstOrDefault(x => x.Id == _applicationSettings.MainWindow.SelectedMainPanel); if (selectedTopEntry != null) { SelectedTopEntry = selectedTopEntry; } else if (selectedBottomEntry != null) { SelectedBottomEntry = selectedBottomEntry; } else { SelectedTopEntry = _rawEntry; } }