Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
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 };
        }
Exemplo n.º 3
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;
        }
Exemplo n.º 4
0
        NotificationAction AddAction()
        {
            var action = new NotificationAction();

            _syncContext.Run(() => _actions.Add(action));

            return(action);
        }
Exemplo n.º 5
0
        NotificationAction AddAction()
        {
            var action = new NotificationAction();

            if (_syncContext != null)
            {
                _syncContext.Post(S => _actions.Add(action), null);
            }
            else
            {
                _actions.Add(action);
            }

            return(action);
        }