public PluginsMainPanelViewModel(IApplicationSettings applicationSettings, IEnumerable <IPluginDescription> plugins) : base(applicationSettings) { _plugins = plugins.Select(x => new PluginViewModel(x)).ToList(); _openPluginFolderCommand = new DelegateCommand2(OpenPluginFolder); }
public PluginsMainPanelViewModel(IApplicationSettings applicationSettings, IDispatcher dispatcher, IPluginUpdater pluginUpdater, IEnumerable <IPluginDescription> plugins) : base(applicationSettings) { _applicationSettings = applicationSettings; _dispatcher = dispatcher; _pluginUpdater = pluginUpdater; _installedPlugins = plugins.Select(x => new InstalledPluginViewModel(x)).ToList(); _allPlugins = new ObservableCollection <IPluginViewModel>(); _openPluginFolderCommand = new DelegateCommand2(OpenPluginFolder); _updatePluginsCommand = new DelegateCommand2(UpdatePlugins); _refreshPluginsCommand = new DelegateCommand2(RefreshPlugins); if (!HasPluginRepositoryConfigured) { ShowAllPluginsError = "No plugin repository configured!"; ShowAllPluginsErrorDescription = "In order to download/update plugins, you have to configure tailviewer to use a plugin repository. Please note that there is no globally available plugin repository. This feature is currently intended for organizations to deploy their own private repositories."; } else { ShowAllPluginsError = null; ShowAllPluginsErrorDescription = null; RefreshPlugins(); } }
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 AdminViewModel() { adminService = new AdminServices(); cmd1 = new DelegateCommand(AddProduct, canAdd); cmd2 = new DelegateCommand(DeleteProduct, canDelete); cmd3 = new DelegateCommand(ViewProd, canClose); FinishCommand2 = new DelegateCommand2(Finish, canClose); }
public AvailablePluginViewModel(PublishedPluginDescription plugin, Action download) { Name = plugin.Name; Description = plugin.Description; Author = plugin.Author; Version = plugin.Identifier.Version; Website = new Uri(plugin.Website); DownloadCommand = new DelegateCommand2(download); }
public HighlightersSidePanelViewModel(IHighlighters highlighters) { _highlighters = highlighters; _highlighterViewModels = new ObservableCollection <HighlighterViewModel>(); foreach (var highlighter in _highlighters.Highlighters) { AddHighlighterViewModel(highlighter); } _addCommand = new DelegateCommand2(Add); }
public AvailablePluginViewModel(PublishedPluginDescription plugin, Action download) { Name = plugin.Name; Description = plugin.Description; Author = plugin.Author; Version = plugin.Identifier.Version; Uri.TryCreate(plugin.Website, UriKind.Absolute, out var uri); Website = uri; DownloadCommand = new DelegateCommand2(download); }
public QuickInfoWidgetViewModel(IWidgetTemplate template, IDataSourceAnalyser dataSourceAnalyser) : base(template, dataSourceAnalyser) { _viewConfiguration = template.Configuration as QuickInfoWidgetConfiguration; _analyserConfiguration = AnalyserConfiguration as QuickInfoAnalyserConfiguration; _quickInfosById = new Dictionary <Guid, QuickInfoViewModel>(); _quickInfos = new ObservableCollection <QuickInfoViewModel>(); _addQuickInfoCommand = new DelegateCommand2(AddQuickInfo); PropertyChanged += OnPropertyChanged; }
public AddAlarmViewModel(Configuration configuration) { _addAlarmCommand = new DelegateCommand2(OnAddAlarm); _cancelCommand = new DelegateCommand2(OnCancel); _availableDevices = configuration.Devices.Select(x => new DeviceViewModel(x)).ToList(); SelectedDevice = _availableDevices.FirstOrDefault(); _availableTemperatures = configuration.Temperatures.OrderBy(x => x).ToList(); SelectedTemperature = _availableTemperatures.FirstOrDefault(); UpdateAddButton(); }
public DataSourcesViewModel(IApplicationSettings settings, IDataSources dataSources, IActionCenter actionCenter) { _actionCenter = actionCenter ?? throw new ArgumentNullException(nameof(actionCenter)); _settings = settings ?? throw new ArgumentNullException(nameof(settings)); _observable = new ObservableCollection <IDataSourceViewModel>(); _allDataSourceViewModels = new List <IDataSourceViewModel>(); _dataSources = dataSources ?? throw new ArgumentNullException(nameof(dataSources)); _removeCurrentDataSourceCommand = new DelegateCommand2(CloseSelectedDataSource); _removeAllDataSourcesCommand = new DelegateCommand2(CloseAllDataSources); foreach (IDataSource dataSource in dataSources.Sources) { if (dataSource.ParentId == DataSourceId.Empty) { Add(dataSource); } } foreach (IDataSource dataSource in dataSources.Sources) { DataSourceId parentId = dataSource.ParentId; if (parentId != DataSourceId.Empty) { IDataSourceViewModel parent = _observable.First(x => x.DataSource.Id == parentId); var group = (MergedDataSourceViewModel)parent; IDataSourceViewModel viewModel = CreateViewModel(dataSource); group.AddChild(viewModel); } } //_customDataSources = // _dataSources.CustomDataSources.Select(x => new AddCustomDataSourceViewModel(x.DisplayName, () => AddCustomDataSource(x.Id))).ToList(); // We need to make sure that if we construct this view model *and* the data sources panel is supposed // to be pinned, then we also need to make sure the toggle button is checked as otherwise nothing // is showing up. IsPinned = _settings.DataSources.IsPinned; if (IsPinned) { IsChecked = true; } UpdateTooltip(); UpdateRemoveCommands(); PropertyChanged += OnPropertyChanged; }
public BookmarksViewModel(IDataSources dataSources, Action <Bookmark> navigateToBookmark) { _dataSources = dataSources ?? throw new ArgumentNullException(nameof(dataSources)); _navigateToBookmark = navigateToBookmark ?? throw new ArgumentNullException(nameof(navigateToBookmark)); _addBookmarkCommand = new DelegateCommand2(AddBookmark) { CanBeExecuted = false }; _removeAllBookmarksCommand = new DelegateCommand2(RemoveAllBookmarks) { CanBeExecuted = false }; _viewModelByBookmark = new Dictionary <Bookmark, BookmarkViewModel>(); _bookmarks = new ObservableCollection <BookmarkViewModel>(); UpdateTooltip(); PropertyChanged += OnPropertyChanged; }
protected AbstractDataSourceViewModel(IDataSource dataSource) { if (dataSource == null) { throw new ArgumentNullException(nameof(dataSource)); } _dataSource = dataSource; _searchTerm = dataSource.SearchTerm; _removeCommand = new DelegateCommand(OnRemoveDataSource); _currentSearchResultIndex = -1; _clearScreenCommand = new DelegateCommand2(ClearScreen); _showAllCommand = new DelegateCommand2(ShowAll) { CanBeExecuted = false }; }
public QuickInfoViewModel(Guid id, QuickInfoViewConfiguration viewConfig, QuickInfoConfiguration analyserConfig) { if (id == null) { throw new ArgumentNullException(nameof(id)); } if (viewConfig == null) { throw new ArgumentNullException(nameof(viewConfig)); } if (analyserConfig == null) { throw new ArgumentNullException(nameof(analyserConfig)); } _id = id; _viewConfig = viewConfig; _analyserConfig = analyserConfig; _removeCommand = new DelegateCommand2(Remove); _formatter = new QuickInfoFormatter(analyserConfig); }
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 QuickInfoWidgetViewModel(IWidgetTemplate template, IDataSourceAnalyser dataSourceAnalyser) : base(template, dataSourceAnalyser) { _viewConfiguration = template.Configuration as QuickInfoWidgetConfiguration ?? new QuickInfoWidgetConfiguration(); _analyserConfiguration = AnalyserConfiguration as QuickInfoAnalyserConfiguration ?? new QuickInfoAnalyserConfiguration(); _quickInfosById = new Dictionary <Guid, QuickInfoViewModel>(); _quickInfos = new ObservableCollection <QuickInfoViewModel>(); _addQuickInfoCommand = new DelegateCommand2(AddQuickInfo); foreach (var quickInfo in _viewConfiguration.Titles) { var analysis = _analyserConfiguration.QuickInfos.FirstOrDefault(x => x.Id == quickInfo.Id); if (analysis != null) { AddQuickInfo(quickInfo.Id, quickInfo, analysis); } } PropertyChanged += OnPropertyChanged; }
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; } }
public ToggleExcludeFromGroupViewModel(ISingleDataSourceViewModel dataSource) { _dataSource = dataSource; _command = new DelegateCommand2(ToggleFilterAll); UpdateHeader(); }
public MainWindowViewModel(IServiceContainer services, IApplicationSettings settings, DataSources dataSources, QuickFilters quickFilters, IActionCenter actionCenter, IAutoUpdater updater) { if (dataSources == null) { throw new ArgumentNullException(nameof(dataSources)); } if (quickFilters == null) { throw new ArgumentNullException(nameof(quickFilters)); } if (updater == null) { throw new ArgumentNullException(nameof(updater)); } _services = services; _applicationSettings = settings; _plugins = services.Retrieve <IPluginLoader>().Plugins; _settings = new SettingsMainPanelViewModel(settings); _actionCenterViewModel = new ActionCenterViewModel(services.Retrieve <IDispatcher>(), actionCenter); _logViewPanel = new LogViewMainPanelViewModel(services, actionCenter, dataSources, quickFilters, services.Retrieve <IHighlighters>(), _applicationSettings); ((NavigationService)services.Retrieve <INavigationService>()).LogViewer = _logViewPanel; _logViewPanel.PropertyChanged += LogViewPanelOnPropertyChanged; var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) }; timer.Tick += TimerOnTick; timer.Start(); _autoUpdater = new AutoUpdateViewModel(updater, settings.AutoUpdate, services.Retrieve <IDispatcher>()); _showLogCommand = new DelegateCommand(ShowLog); _showGoToLineCommand = new DelegateCommand2(ShowGoToLine); _showQuickNavigationCommand = new DelegateCommand2(ShowQuickNavigation); _goToNextDataSourceCommand = new DelegateCommand2(GoToNextDataSource); _goToPreviousDataSourceCommand = new DelegateCommand2(GoToPreviousDataSource); _rawEntry = new LogViewMainPanelEntry(); _topEntries = new IMainPanelEntry[] { _rawEntry }; _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; } _isLeftSidePanelVisible = settings.MainWindow.IsLeftSidePanelVisible; UpdateLeftSidePanelExpanderTooltip(); }
public IncludeAllInGroupViewModel(IMergedDataSourceViewModel viewModel) { _viewModel = viewModel; _command = new DelegateCommand2(OnIncludeAll); }
protected AbstractDataSourceViewModel(IDataSource dataSource, IActionCenter actionCenter, IApplicationSettings applicationSettings) { _dataSource = dataSource ?? throw new ArgumentNullException(nameof(dataSource)); _actionCenter = actionCenter ?? throw new ArgumentNullException(nameof(actionCenter)); _applicationSettings = applicationSettings; _search = new SearchViewModel(dataSource); _findAll = new FindAllViewModel(this, dataSource); _removeCommand = new DelegateCommand(OnRemoveDataSource); _clearScreenCommand = new DelegateCommand2(ClearScreen); _showAllCommand = new DelegateCommand2(ShowAll) { CanBeExecuted = false }; _fileMenuItems = new ObservableCollectionExt <IMenuViewModel> { new CommandMenuViewModel(new DelegateCommand2(ExportToFile)) { Header = "Export To File", ToolTip = "Export the current Data Source to a text file (with the current filters)" } }; _editMenuItems = new ObservableCollectionExt <IMenuViewModel>(); _viewMenuItems = new ObservableCollectionExt <IMenuViewModel> { new ToggleMenuViewModel(FollowTail, newValue => { FollowTail = newValue; }) { Header = "Follow Tail", ToolTip = "Follow/Unfollow the last log entry" }, null, new ToggleMenuViewModel(ShowLineNumbers, newValue => { ShowLineNumbers = newValue; }) { Header = "Show Line Numbers", ToolTip = "Show/hide line numbers", }, new ToggleMenuViewModel(ShowDeltaTimes, newValue => { ShowDeltaTimes = newValue; }) { Header = "Show Delta Times", ToolTip = "Show the amount of time elapsed since the previous entry" }, new ToggleMenuViewModel(ShowElapsedTime, newValue => { ShowElapsedTime = newValue; }) { Header = "Show Elapsed Times", ToolTip = "Show the amount of time elapsed since the first entry" }, null, new ToggleMenuViewModel(ColorByLevel, newValue => { ColorByLevel = newValue; }) { Header = "Color by Level", ToolTip = "Color log messages by their log level" }, new ToggleMenuViewModel(HideEmptyLines, newValue => { HideEmptyLines = newValue; }) { Header = "Hide Empty Lines", ToolTip = "Hide lines which are completely empty" }, new ToggleMenuViewModel(IsSingleLine, newValue => { IsSingleLine = newValue; }) { Header = "Single Line", ToolTip = "Treat every single line as a separate log entry" }, null, new CommandMenuViewModel(_clearScreenCommand) { Icon = Icons.PlaylistRemove, Header = "Clear Screen", ToolTip = "Hides all log current entries of the data source. New log entries will still be shown once they are added to the data source." }, new CommandMenuViewModel(_showAllCommand) { Header = "Show All", ToolTip = "Shows all log entries that were previously cleared again" } }; _contextMenuItems = new ObservableCollectionExt <IMenuViewModel>(); }