Esempio n. 1
0
 private async Task OnNotificationReady(string key, int value)
 {
     if (NotificationReady != null)
     {
         await NotificationReady.Invoke(key, value);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Shows a notification regarding an action on one file OR folder
        /// </summary>
        /// <param name="name">The name of the file or folder</param>
        /// <param name="ca">The ChangeAction</param>
        /// <param name="file">True if file, False if Folder</param>
        public static void Show(string name, ChangeAction ca, bool file)
        {
            if (!Settings.General.Notifications)
            {
                return;
            }

            name = Common._name(name);

            NotificationReady.SafeInvoke(null, new NotificationArgs(name, Common.Languages[ca, file]));
        }
Esempio n. 3
0
        /// <summary>
        /// Shows a notification for the specified WebUI-related action
        /// </summary>
        public static void Show(WebUiAction a)
        {
            if (!Settings.General.Notifications)
            {
                return;
            }

            string msg = Common.Languages[a];

            NotificationReady.SafeInvoke(null, new NotificationArgs(msg));
        }
Esempio n. 4
0
        /// <summary>
        /// Shows a notification of how many items were deleted.
        /// </summary>
        /// <param name="n"># of deleted items</param>
        /// <param name="c">ChangeAction, should be ChangeAction.deleted</param>
        public static void Show(int n, ChangeAction c)
        {
            if (c != ChangeAction.deleted || !Settings.General.Notifications)
            {
                return;
            }

            string body = string.Format(Common.Languages[MessageType.ItemsDeleted], n);

            NotificationReady.SafeInvoke(null, new NotificationArgs(body));
        }
Esempio n. 5
0
        /// <summary>
        /// Shows a notification of how many files OR folders were updated
        /// </summary>
        /// <param name="i"># of files or folders</param>
        /// <param name="file">True if files, False if folders</param>
        public static void Show(int i, bool file)
        {
            if (!Settings.General.Notifications || i <= 0)
            {
                return;
            }

            string type   = (file) ? Common.Languages[MessageType.Files] : Common.Languages[MessageType.Folders];
            string change = (file) ? Common.Languages[MessageType.FilesOrFoldersUpdated] : Common.Languages[MessageType.FilesOrFoldersCreated];
            string body   = string.Format(change, i, type);

            NotificationReady.SafeInvoke(null, new NotificationArgs(body));
        }
Esempio n. 6
0
        /// <summary>
        /// Shows a notification that a file or folder was renamed.
        /// </summary>
        /// <param name="name">The old name of the file/folder</param>
        /// <param name="ca">file/folder ChangeAction, should be ChangeAction.renamed</param>
        /// /// <param name="newname">The new name of the file/folder</param>
        public static void Show(string name, ChangeAction ca, string newname)
        {
            if (!Settings.General.Notifications)
            {
                return;
            }

            name    = Common._name(name);
            newname = Common._name(newname);
            string body = string.Format(Common.Languages[ChangeAction.renamed, true], name, newname);

            NotificationReady.SafeInvoke(null, new NotificationArgs(body));
        }
Esempio n. 7
0
        /// <summary>
        /// Shows a notifications of how many files and how many folders were updated.
        /// </summary>
        /// <param name="f"># of files</param>
        /// <param name="d"># of folders</param>
        public static void Show(int f, int d)
        {
            if (!Settings.General.Notifications)
            {
                return;
            }

            string fType = (f != 1) ? Common.Languages[MessageType.Files] : Common.Languages[MessageType.File];
            string dType = (d != 1) ? Common.Languages[MessageType.Folders] : Common.Languages[MessageType.Folder];

            if (Settings.General.Notifications && (f > 0 || d > 0))
            {
                string body = string.Format(Common.Languages[MessageType.FilesAndFoldersChanged], d, dType, f, fType);
                NotificationReady.SafeInvoke(null, new NotificationArgs(body));
            }
        }