public void Saved() { var deleteAction = new NotificationAction { Icon = _icons.Delete, Name = _loc.Delete, Color = "LightPink" }; deleteAction.Click += () => { if (File.Exists(_recentItem.FileName)) { var platformServices = ServiceProvider.Get <IPlatformServices>(); if (!platformServices.DeleteFile(_recentItem.FileName)) { return; } } Remove(); OnDelete?.Invoke(); }; _notificationActions.Add(deleteAction); PrimaryText = _recentItem.FileType == RecentFileType.Video ? _loc.VideoSaved : _loc.AudioSaved; Finished = true; }
public FileSavedNotification(string FileName, string Message) { _fileName = FileName; PrimaryText = Message; SecondaryText = Path.GetFileName(FileName); var loc = ServiceProvider.Get<LanguageManager>(); var icons = ServiceProvider.Get<IIconSet>(); var deleteAction = new NotificationAction { Icon = icons.Delete, Name = loc.Delete, Color = "LightPink" }; deleteAction.Click += () => { if (File.Exists(_fileName)) { if (Shell32.FileOperation(_fileName, FileOperationType.Delete, 0) != 0) return; } Remove(); OnDelete?.Invoke(); }; Actions = new[] { deleteAction }; }
public void Saved() { var deleteAction = new NotificationAction { Icon = _icons.Delete, Name = _loc.Delete, Color = "LightPink" }; deleteAction.Click += () => { if (File.Exists(_recentItem.FileName)) { if (Shell32.FileOperation(_recentItem.FileName, FileOperationType.Delete, 0) != 0) { return; } } Remove(); OnDelete?.Invoke(); }; _notificationActions.Add(deleteAction); PrimaryText = _recentItem.FileType == RecentFileType.Video ? _loc.VideoSaved : _loc.AudioSaved; Finished = true; }
NotificationAction AddAction() { var action = new NotificationAction(); _syncContext.Run(() => _actions.Add(action)); return(action); }
NotificationAction AddAction() { var action = new NotificationAction(); if (_syncContext != null) { _syncContext.Post(S => _actions.Add(action), null); } else { _actions.Add(action); } return(action); }