public void TestAdd2() { _viewModel.Notifications.Should().BeEmpty(); _actionCenter.Add(Notification.CreateInfo("Foo", "Hello World!")); _dispatcher.InvokeAll(); _viewModel.Notifications.Count().Should().Be(1); _viewModel.UnreadCount.Should().Be(1); _viewModel.HasNewMessages.Should().BeTrue(); }
public static void AddRange(this IActionCenter actionCenter, IEnumerable <INotification> notifications) { foreach (var notification in notifications) { actionCenter.Add(notification); } }
private void OpenInExplorer() { var dataSources = _dataSource.OriginalSources.GroupBy(GetDirectory); foreach (var grouping in dataSources) { var files = grouping.Select(x => x.FullFileName).ToArray(); var action = new OpenFolderAction(files, grouping.Key, new FileExplorer()); _actionCenter.Add(action); } }
private void OnVersionChecked(Task <VersionInfo> task, bool addNotificationWhenUpToDate) { try { VersionInfo latestVersion = task.Result; if (latestVersion != null) { LatestVersion = latestVersion; Version latest = latestVersion.Stable; Version current = AppVersion; if (current != null && latest != null && latest > current) { var message = string.Format("A newer version ({0}) is available to be downloaded", latest); Log.InfoFormat(message); _actionCenter.Add(Notification.CreateInfo("Check for updates", message)); } else { const string message = "Running the latest version"; Log.InfoFormat(message); if (addNotificationWhenUpToDate) { _actionCenter.Add(Notification.CreateInfo("Check for updates", message)); } } } // There's no need to log that the task didn't return any result: // we already logged this problem in the task... } catch (Exception e) { Log.ErrorFormat("Caught unexpected exception while querying newest version: {0}", e); } }
private void ExportToFile() { var dataSource = DataSource; var logFile = dataSource?.FilteredLogSource; if (logFile == null) { Log.Warn("DataSource is null, cancelling export..."); return; } var exportDirectory = _applicationSettings.Export.ExportFolder; var exporter = new LogFileToFileExporter(logFile, exportDirectory, dataSource.FullFileName ); var action = new ExportAction(exporter, DisplayName, exportDirectory); _actionCenter.Add(action); }
private void OpenInExplorer() { var action = new OpenFolderAction(FullName, new FileExplorer()); _actionCenter.Add(action); }