コード例 #1
0
        public Toast(string header, string body)
        {
            this.request = new ToastRequest
            {
                ToastHeadline = header,
                ToastBody     = body,
#if DEBUG
                ShortcutFileName = "제독업무도 바빠! (debug).lnk",
#else
                ShortcutFileName = "제독업무도 바빠!.lnk",
#endif
                ShortcutTargetFilePath = Assembly.GetEntryAssembly().Location,
                AppId = AppId,
            };

            if (!string.IsNullOrEmpty(sound.FileCheck(header)))
            {
                this.request.ToastAudio = ToastAudio.Silent;
            }

            if (KanColleViewer.Models.Settings.KanColleSettings.NotifyMuteOnMute)
            {
                if (KanColleViewer.Models.Volume.GetInstance().IsMute)
                {
                    // 칸코레 뷰어가 음소거 상태라면 알람도 음소거
                    this.request.ToastAudio = ToastAudio.Silent;
                }
            }
        }
コード例 #2
0
        private static int ShowToast(RequestType type, ref IntPtr data)
        {
            string input = Utilities.GetData(ref data);

            if (String.IsNullOrWhiteSpace(input))
            {
                return(ReturnType.Continue);
            }

            ToastRequest request;

            switch (type)
            {
            case RequestType.Xml:
                request = new ToastRequest
                {
                    Xml         = input,
                    AppId       = AppId,
                    ActivatorId = typeof(NotificationActivator).GUID
                };
                break;

            case RequestType.Json:
                request = new ToastRequest(input)
                {
                    AppId       = AppId,
                    ActivatorId = typeof(NotificationActivator).GUID
                };
                break;

            default:
                return(ReturnType.Continue);
            }

            if (string.IsNullOrWhiteSpace(request.Group))
            {
                request.Group = Instance.NextGroup;
            }
            if (string.IsNullOrWhiteSpace(request.Tag))
            {
                request.Tag = Instance.NextTag;
            }

            const string Format = "/.timer 1 0 if ($isalias({0})) {{ noop ${0}($unsafe({1}).undo,{2}) }}";

            ToastManager.ShowAsync(request).
            ContinueWith(result => {
                Instance.mIRC.Exec(String.Format(Format,
                                                 Instance.OnCompleteCallback,
                                                 Utilities.Base64Encode(request.Tag),
                                                 result.Result));
            });

            Utilities.SetData(ref data, request.Tag);

            return(ReturnType.Return);
        }
コード例 #3
0
 public Toast(string header, string body)
 {
     this.request = new ToastRequest
     {
         ToastHeadline          = header,
         ToastBody              = body,
         ShortcutFileName       = "맥주뷰어.lnk",
         ShortcutTargetFilePath = Assembly.GetEntryAssembly().Location,
         ShortcutIconFilePath   = Assembly.GetEntryAssembly().Location,
         AppId = AppId,
     };
 }
コード例 #4
0
    // The Update function is responsible for monitoring the queue and executing requests
    void Update()
    {
        // If a request exists on the queue, and we're not busy servicing an earlier request, we service the next one on the queue.
        if (!toasting && requests.Count > 0)
        {
            ToastRequest new_request = requests.Dequeue();
            toasting = true;

            instance.toast_text.text = new_request.message;
            instance.StartCoroutine(DoToast(instance.ease_duration, instance.show_duration));
        }
    }
コード例 #5
0
        private async Task <string> ShowToastAsync()
        {
            var request = new ToastRequest
            {
                ToastTitle    = "DesktopToast WinForms Sample",
                ToastBodyList = new[] { "This is a toast test.", "Looping sound will be played." },
                AppId         = "DesktopToast.WinForms",
            };

            var result = await ToastManager.ShowAsync(request);

            return(result.ToString());
        }
コード例 #6
0
        private void CreateShortcut()
        {
            var req = new ToastRequest()
            {
                ShortcutFileName       = AppId + ".lnk",
                ShortcutTargetFilePath = Process.GetCurrentProcess().MainModule.FileName,
                AppId           = AppId,
                ActivatorId     = typeof(NotificationActivator).GUID,
                WaitingDuration = TimeSpan.Zero,
            };

            _ = ToastManager.CheckInstallShortcut(req);
        }
コード例 #7
0
        private async Task <string> ShowInteractiveToastAsync()
        {
            var request = new ToastRequest
            {
                ToastXml               = ComposeInteractiveToast(),
                ShortcutFileName       = "Lucid Dream.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                AppId       = "Lucid Dream",
                ActivatorId = typeof(NotificationActivator).GUID
            };

            var result = await ToastManager.ShowAsync(request);

            return(result.ToString());
        }
コード例 #8
0
        public Toast(string header, string body)
        {
            this.request = new ToastRequest
            {
                ToastHeadline = header,
                ToastBody     = body,
#if DEBUG
                ShortcutFileName = "提督業も忙しい! (debug).lnk",
#else
                ShortcutFileName = "提督業も忙しい!.lnk",
#endif
                ShortcutTargetFilePath = Assembly.GetEntryAssembly().Location,
                AppId = AppId,
            };
        }
コード例 #9
0
ファイル: Notifier.cs プロジェクト: Lyt99/EPIC-LOJS
        /// <summary>
        /// 创建一个Toast Notification并显示
        /// </summary>
        /// <param name="Body">第一行文本</param>
        /// <param name="BodyExtra">第二行文本</param>
        public static void CreateToastNotification(string Body, string BodyExtra = "")
        {
            var request = new ToastRequest
            {
                ToastHeadline          = "EPIC",
                ToastBody              = Body,
                ToastBodyExtra         = BodyExtra,
                ToastAudio             = ToastAudio.Default,
                ShortcutFileName       = "EPIC.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                AppId = "pw.baka.epic",
            };

            var result = ToastManager.ShowAsync(request);
        }
コード例 #10
0
        private async Task <string> ShowInteractiveToastAsync()
        {
            var request = new ToastRequest
            {
                ToastXml               = ComposeInteractiveToast(),
                ShortcutFileName       = "DesktopToast.Wpf.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                MaximumDuration        = TimeSpan.FromSeconds(10),
                AppId       = "DesktopToast.Wpf",
                ActivatorId = typeof(NotificationActivator).GUID
            };

            var result = await new ToastManager(NoOpLoggerFactory.Instance).ShowAsync(request);

            return(result.ToString());
        }
コード例 #11
0
        private async Task <string> ShowToastAsync(string HeadLine, string Body)
        {
            var request = new ToastRequest
            {
                ToastHeadline          = HeadLine,
                ToastBody              = Body,
                ShortcutFileName       = "DejizoToaster.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                AppId      = "DejizoToaster.WinForms",
                ToastAudio = ToastAudio.Silent
            };

            var result = await ToastManager.ShowAsync(request);

            return(result.ToString());
        }
コード例 #12
0
        private async Task <string> ShowInteractiveToastAsync(int expire)
        {
            var request = new ToastRequest
            {
                ToastXml               = ComposeInteractiveToast(),
                ShortcutFileName       = "NWS Alerts.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                ShortcutWorkingFolder  = AppDomain.CurrentDomain.BaseDirectory,
                AppId       = "NWS Alerts",
                ActivatorId = typeof(NotificationActivator).GUID
            };

            var result = await ToastManager.ShowAsync(request, expire);

            return(result.ToString());
        }
コード例 #13
0
ファイル: MainForm.cs プロジェクト: CHDKUtil/DesktopToast
        private async Task <string> ShowToastAsync()
        {
            var request = new ToastRequest
            {
                ToastTitle             = "DesktopToast WinForms Sample",
                ToastBodyList          = new[] { "This is a toast test.", "Looping sound will be played." },
                ToastAudio             = DesktopToast.ToastAudio.LoopingCall,
                ShortcutFileName       = "DesktopToast.WinForms.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                AppId = "DesktopToast.WinForms",
            };

            var result = await new ToastManager(NoOpLoggerFactory.Instance).ShowAsync(request);

            return(result.ToString());
        }
コード例 #14
0
ファイル: MainForm.cs プロジェクト: MrSwiss/DesktopToast
		private async Task<string> ShowToastAsync()
		{
			var request = new ToastRequest
			{
				ToastHeadline = "DesktopToast WinForms Sample",
				ToastBody = "This is a toast test.",
				ToastBodyExtra = "Looping sound will be played.",
				ToastAudio = ToastAudio.LoopingCall,
				ShortcutFileName = "DesktopToast.WinForms.lnk",
				ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
				AppId = "DesktopToast.WinForms",
			};

			var result = await ToastManager.ShowAsync(request);

			return result.ToString();
		}
コード例 #15
0
        private async Task <string> ShowToastAsync()
        {
            var request = new ToastRequest
            {
                ToastTitle             = "DesktopToast WPF Sample",
                ToastBody              = "This is a toast test.",
                ToastLogoFilePath      = string.Format("file:///{0}", Path.GetFullPath("Resources/toast128.png")),
                ShortcutFileName       = "DesktopToast.Wpf.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                AppId       = "DesktopToast.Wpf",
                ActivatorId = typeof(NotificationActivator).GUID                 // For Action Center of Windows 10
            };

            var result = await ToastManager.ShowAsync(request);

            return(result.ToString());
        }
コード例 #16
0
        public static void SendToastAsync(string body, NoticeType type)
        {
            var audio = GetAudioFromType(type);
            var title = GetTitleFromType(type);

            var request = new ToastRequest
            {
                ToastAudio             = audio,
                ToastTitle             = title,
                ToastBody              = body,
                ShortcutFileName       = "zRageAdminMain.lnk",
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                AppId = "zRageAdminMain",
            };

            ToastManager.ShowAsync(request).RunSynchronously();
        }
コード例 #17
0
		private async Task<string> ShowToastAsync()
		{
			var toastImageFilePath = String.Format("file:///{0}", Path.GetFullPath("Resources/toast128.png"));

			var request = new ToastRequest
			{
				ToastHeadline = "DesktopToast WPF Sample",
				ToastBody = "This is a toast test.",
				ToastImageFilePath = toastImageFilePath,
				ShortcutFileName = "DesktopToast.Wpf.lnk",
				ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
				AppId = "DesktopToast.Wpf",
			};

			var result = await ToastManager.ShowAsync(request);

			return result.ToString();
		}
コード例 #18
0
ファイル: Toast.cs プロジェクト: kimbavel/KanColleViewer
        public Toast(string header, string body)
        {
            this.request = new ToastRequest
            {
                ToastHeadline = header,
                ToastBody     = body,
#if DEBUG
                ShortcutFileName = "제독업무도 바빠! (debug).lnk",
#else
                ShortcutFileName = "제독업무도 바빠!.lnk",
#endif
                ShortcutTargetFilePath = Assembly.GetEntryAssembly().Location,
                AppId = AppId,
            };

            if (!string.IsNullOrEmpty(sound.FileCheck(header)))
            {
                this.request.ToastAudio = ToastAudio.Silent;
            }
        }
コード例 #19
0
        public static async Task <string> ShowNotification(Slot slot)
        {
            var body   = string.Format(Resources.NoticeSlotRsvBody, slot.Title);
            var result = "";

            if (NormaConstants.IsSupportedToast)
            {
                var toastXml     = ComposeInteractiveToast(Resources.NoticeSlotRsvTitle, body, slot);
                var toastRequest = new ToastRequest
                {
                    ToastXml         = toastXml,
                    ShortcutFileName = NormaConstants.IpsilonLinkName,
#if DEBUG
                    ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
#else
                    ShortcutTargetFilePath = NormaConstants.IpsilonExecutableFile,
#endif
                    AppId             = NormaConstants.IpsilonAppId,
                    ToastLogoFilePath = $"file:///{Path.GetFullPath("Resources/128.png")}"
                };
                if (NormaConstants.IsSupportedNewToast)
                {
                    toastRequest.ActivatorId = typeof(NotificationActivator).GUID;
                }
                var rs = await ToastManager.ShowAsync(toastRequest);

                result = rs.ToString();
            }
            else
            {
                Dispatcher.CurrentDispatcher.Invoke(() =>
                {
                    //
                    Shell.TaskbarIcon.ShowBalloonTip(Resources.NoticeSlotRsvTitle, body, BalloonIcon.Info);
                });
            }

            return(result);
        }
コード例 #20
0
        /// <summary>
        /// Shows a toast to notify completion of copying.
        /// </summary>
        private async Task ShowToastAsync()
        {
            if (!OsVersion.IsEightOrNewer || (_copyFileCount <= 0) || (DateTime.Now - CopyStartTime < _copyToastShortestDuration))
            {
                return;
            }

            var request = new ToastRequest
            {
                ToastHeadline          = Resources.ToastHeadline_CopyCompleted,
                ToastBody              = Resources.ToastBody_CopyCompleted,
                ToastBodyExtra         = string.Format(Resources.ToastBodyExtra_CopyCompleted, _copyFileCount, (int)(DateTime.Now - CopyStartTime).TotalSeconds),
                ShortcutFileName       = Properties.Settings.Default.ShortcutFileName,
                ShortcutTargetFilePath = Assembly.GetExecutingAssembly().Location,
                AppId = Properties.Settings.Default.AppId
            };

            var result = await ToastManager.ShowAsync(request);

            if (result == ToastResult.Activated)
            {
                ActivateRequested?.Invoke(this, EventArgs.Empty);
            }
        }
コード例 #21
0
 private void OnToast(ToastRequest request)
 {
     Toast.MakeText(this, request.Msg,
                    request.Length == ToastRequest.ToastLength.Short ? ToastLength.Short : ToastLength.Long).Show();
 }