Exemplo n.º 1
0
        private Response notificationReceived(Notification notification, CallbackInfo callbackInfo, RequestInfo requestInfo)
        {
            Response returnCode = new Response();

            if (!registeredApps.ContainsKey(notification.ApplicationName.ToUpper()))
            {
                returnCode = new Response(ErrorCode.UNKNOWN_APPLICATION, "Application not registered");
                SnarlConnector.ShowMessageEx("Error messages", "Growl notification from unregistered app", "The application " + notification.ApplicationName + " tried to send a notification without being registered", 10, pawIconPath, registeredApps["Paw"].windowHandle, Snarl.WindowsMessage.WM_USER + 24, "");
            }
            else
            {
                bool   deleteIcon = false;
                string iconPath   = "";
                iconPath = IconFetcher.getPathToIcon(notification);
                if (iconPath == "")
                {
                    GrowlApplication thisApp = registeredApps[notification.ApplicationName.ToUpper()];
                    if (notification.Name != null)
                    {
                        if (thisApp.alertClassIcons.ContainsKey(notification.Name))
                        {
                            iconPath = thisApp.alertClassIcons[notification.Name];
                        }
                    }
                    if (iconPath == "")
                    {
                        iconPath = registeredApps[notification.ApplicationName.ToUpper()].pathToIcon;
                    }
                }
                else
                {
                    deleteIcon = true;
                }
                SnarlConnector.ShowMessageEx(notification.Name, notification.Title, notification.Text, 10, iconPath, registeredApps[notification.ApplicationName.ToUpper()].windowHandle, Snarl.WindowsMessage.WM_USER + 24, "");
                if (deleteIcon)
                {
                    try
                    {
                        System.IO.File.Delete(iconPath);
                    }
                    catch
                    { }
                }
            }
            return(returnCode);
        }
Exemplo n.º 2
0
 public GrowlApplication(Growl.Connector.Application app, List <NotificationType> notiTypes)
 {
     // Create the actual window
     windowHandle    = IntPtr.Zero;
     alertClasses    = new List <AlertClass>();
     alertClassIcons = new Dictionary <string, string>();
     this.CreateHandle(cp);
     windowHandle = this.Handle;
     this.SNARL_GLOBAL_MESSAGE = Snarl.SnarlConnector.GetGlobalMsg();
     this.application          = app;
     foreach (NotificationType alertClass in notiTypes)
     {
         AlertClass newClass = new AlertClass(alertClass);
         alertClasses.Add(newClass);
         alertClassIcons.Add(newClass.notificationType.Name, newClass.defaultIconLocation);
     }
     pathToIcon = IconFetcher.getPathToIcon(app);
     registerWithSnarl();
 }
Exemplo n.º 3
0
 public AlertClass(NotificationType nType)
 {
     this.notificationType    = nType;
     this.defaultIconLocation = IconFetcher.getPathToIcon(nType);
 }