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; }
public bool DeleteFile(string FilePath) { return(Shell32.FileOperation(FilePath, FileOperationType.Delete, 0) == 0); }