Exemplo n.º 1
0
        private void ShowNotification(Growl.DisplayStyle.Notification notification, Display display, Growl.Daemon.CallbackInfo cbInfo, bool recordInMissedNotifications, Growl.Connector.RequestInfo requestInfo)
        {
            // could be cross-thread, so check for invokerequired
            if (this.synchronizingObject != null && this.synchronizingObject.InvokeRequired)
            {
                MethodInvoker invoker = new MethodInvoker(delegate()
                {
                    ShowNotification(notification, display, cbInfo, recordInMissedNotifications, requestInfo);
                });

                this.synchronizingObject.Invoke(invoker, null);
            }
            else
            {
                if (display == null) display = this.growlDefaultDisplay;

                // if not a system notification and we are paused, dont show
                if (recordInMissedNotifications && paused)
                {
                    display = Display.None;
                    requestInfo.SaveHandlingInfo(String.Format("Not shown - {0}", (paused ? "Paused" : "Idle")));
                }
                else
                {
                    requestInfo.SaveHandlingInfo(String.Format("Displayed using '{0}' {1}", display.Name, (display.IsDefault ? "(" + display.ActualName + ")" : "")));
                }

                display.ProcessNotification(notification, cbInfo, requestInfo);
                this.lastUsedDisplay = display;
            }
        }
Exemplo n.º 2
0
        private void ShowNotification(Growl.DisplayStyle.Notification notification, Display display, Growl.Daemon.CallbackInfo cbInfo, bool recordInMissedNotifications, Growl.Connector.RequestInfo requestInfo)
        {
            // could be cross-thread, so check for invokerequired
            if (this.synchronizingObject != null && this.synchronizingObject.InvokeRequired)
            {
                MethodInvoker invoker = new MethodInvoker(delegate()
                {
                    ShowNotification(notification, display, cbInfo, recordInMissedNotifications, requestInfo);
                });

                this.synchronizingObject.Invoke(invoker, null);
            }
            else
            {
                if (display == null) display = this.growlDefaultDisplay;

                // check for fullscreen handling
                if (!paused && (this.AutoPauseFullscreen && this.fullscreenHelper.IsFullScreenAppActive()))
                {
                    Utility.WriteDebugInfo("Fullscreen app detected - automatically pausing Growl");
                    ApplicationMain.Program.Pause(true);
                    this.fullscreenHelper.StartChecking();
                }

                // if not a system notification and we are paused, dont show
                if (recordInMissedNotifications && paused)
                {
                    display = Display.None;
                    requestInfo.SaveHandlingInfo(String.Format("Not shown - {0}", (paused ? "Paused" : "Idle")));
                }
                else
                {
                    requestInfo.SaveHandlingInfo(String.Format("Displayed using '{0}' {1}", display.Name, (display.IsDefault ? "(" + display.ActualName + ")" : "")));
                }

                display.ProcessNotification(notification, cbInfo, requestInfo);
                this.lastUsedDisplay = display;
            }
        }