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