Пример #1
0
        private void SendNotification(object info)
        {
            BuildInfo buildInfo = (BuildInfo)info;

            if (Properties.Settings.Default.EnableNotifications)
            {
                int    index = buildInfo.Name.IndexOf('\\');
                string name  = buildInfo.Name;
                if (index > 0)
                {
                    name = name.Substring(0, index);
                }

                string title     = String.Format("Build {0}", (buildInfo.Success ? "succeeded" : "failed"));
                string text      = String.Format("{0} '{1}' {2}.", (buildInfo.IsSolution ? "Solution" : "Project"), name, (buildInfo.Success ? "was built successfully" : "failed to build"));
                byte[] iconBytes = (buildInfo.Success ? this.successIcon : this.failureIcon);
                Growl.CoreLibrary.BinaryData icon = new Growl.CoreLibrary.BinaryData(iconBytes);

                Growl.Connector.NotificationType nt = null;
                if (buildInfo.IsSolution)
                {
                    nt = (buildInfo.Success ? this.ntSolutionSuccess : this.ntSolutionFailed);
                }
                else
                {
                    nt = (buildInfo.Success ? this.ntProjectSuccess : this.ntProjectFailed);
                }

                Growl.Connector.Notification notification = new Growl.Connector.Notification(this.application.Name, nt.Name, String.Empty, title, text, icon, false, Growl.Connector.Priority.Normal, null);

                this.growl.Notify(notification);
            }
        }
Пример #2
0
        private void InitializeAddIn()
        {
            this.cf = new ConfigForm();
            this.cf.PasswordChanged += new EventHandler(cf_PasswordChanged);

            this.appIcon     = ConvertImageToBytes(global::GrowlExtras.VisualStudioAddIn.Properties.Resources.vs);
            this.successIcon = ConvertImageToBytes(global::GrowlExtras.VisualStudioAddIn.Properties.Resources.vs_success);
            this.failureIcon = ConvertImageToBytes(global::GrowlExtras.VisualStudioAddIn.Properties.Resources.vs_failed);

            //string password = Growl.Connector.GrowlConnector.TEST_PASSWORD; //TODO:
            //this.growl = new Growl.Connector.GrowlConnector(password);
            this.growl = new Growl.Connector.GrowlConnector(Properties.Settings.Default.Password);
            this.growl.EncryptionAlgorithm = Growl.Connector.Cryptography.SymmetricAlgorithmType.PlainText;

            this.application      = new Growl.Connector.Application("Visual Studio");
            this.application.Icon = new Growl.CoreLibrary.BinaryData(this.appIcon);

            this.ntSolutionSuccess = new Growl.Connector.NotificationType("Solution Succeeded", "Solution Succeeded", new Growl.CoreLibrary.BinaryData(this.successIcon), true);
            this.ntSolutionFailed  = new Growl.Connector.NotificationType("Solution Failed", "Solution Failed", new Growl.CoreLibrary.BinaryData(this.failureIcon), true);
            this.ntProjectSuccess  = new Growl.Connector.NotificationType("Project Succeeded", "Project Succeeded", new Growl.CoreLibrary.BinaryData(this.successIcon), true);
            this.ntProjectFailed   = new Growl.Connector.NotificationType("Project Failed", "Project Failed", new Growl.CoreLibrary.BinaryData(this.failureIcon), true);

            this.growl.Register(application, new Growl.Connector.NotificationType[] { ntSolutionSuccess, ntSolutionFailed, ntProjectSuccess, ntProjectFailed });

            this._applicationObject.Events.BuildEvents.OnBuildDone           += new _dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone);
            this._applicationObject.Events.BuildEvents.OnBuildProjConfigDone += new _dispBuildEvents_OnBuildProjConfigDoneEventHandler(BuildEvents_OnBuildProjConfigDone);
        }
Пример #3
0
        private void growlBootUp()
        {
            notificationType = new Growl.Connector.NotificationType(sampleNotificationType, "Sample Notification");

            growl = new Growl.Connector.GrowlConnector();
            growl.EncryptionAlgorithm = Growl.Connector.Cryptography.SymmetricAlgorithmType.PlainText;

            growlapp = new Growl.Connector.Application("WPanel");
            growl.Register(growlapp, new Growl.Connector.NotificationType[] { notificationType });
        }
        public override void ForwardRegistration(Growl.Connector.Application application, List <Growl.Connector.NotificationType> notificationTypes, Growl.Connector.RequestInfo requestInfo, bool isIdle)
        {
            Growl.UDPLegacy.NotificationType[] types = new Growl.UDPLegacy.NotificationType[notificationTypes.Count];
            for (int i = 0; i < notificationTypes.Count; i++)
            {
                Growl.Connector.NotificationType notificationType = notificationTypes[i];
                Growl.UDPLegacy.NotificationType nt = new Growl.UDPLegacy.NotificationType(notificationType.Name, notificationType.Enabled);
                types[i] = nt;
            }

            Growl.UDPLegacy.MessageSender netgrowl = new Growl.UDPLegacy.MessageSender(this.IPAddress, this.Port, application.Name, this.Password);
            netgrowl.Register(ref types);
        }
Пример #5
0
        public GrowlPlugin()
        {
            this.OnPlayerPlayEvent += new _IiTunesEvents_OnPlayerPlayEventEventHandler(growlPlugin_OnPlayerPlayEvent);
            this.OnPlayerPlayingTrackChangedEvent += new _IiTunesEvents_OnPlayerPlayingTrackChangedEventEventHandler(growlPlugin_OnPlayerPlayingTrackChangedEvent);

            // old
            this.udpGrowl = new Growl.UDPLegacy.MessageSender("ITunes Growl Plug-in", Properties.Settings.Default.GrowlPassword);
            this.udpNotificationType = new Growl.UDPLegacy.NotificationType("Track Changed", true);
            this.udpNotificationTypes = new Growl.UDPLegacy.NotificationType[] { this.udpNotificationType };

            // new
            this.application = new Growl.Connector.Application("iTunes");
            this.application.Icon = String.Format(@"{0}\icon.png", System.Windows.Forms.Application.StartupPath);
            this.growl = new Growl.Connector.GrowlConnector(Properties.Settings.Default.GrowlPassword);
            this.growl.NotificationCallback +=new Growl.Connector.GrowlConnector.CallbackEventHandler(growl_NotificationCallback);
            this.growl.EncryptionAlgorithm = Growl.Connector.Cryptography.SymmetricAlgorithmType.PlainText;
            this.nt1 = new Growl.Connector.NotificationType("Track Changed", "Track Changed");
            this.notificationTypes = new Growl.Connector.NotificationType[] { this.nt1 };
        }
        public GrowlPlugin()
        {
            this.OnPlayerPlayEvent += new _IiTunesEvents_OnPlayerPlayEventEventHandler(growlPlugin_OnPlayerPlayEvent);
            this.OnPlayerPlayingTrackChangedEvent += new _IiTunesEvents_OnPlayerPlayingTrackChangedEventEventHandler(growlPlugin_OnPlayerPlayingTrackChangedEvent);

            // old
            this.udpGrowl             = new Growl.UDPLegacy.MessageSender("ITunes Growl Plug-in", Properties.Settings.Default.GrowlPassword);
            this.udpNotificationType  = new Growl.UDPLegacy.NotificationType("Track Changed", true);
            this.udpNotificationTypes = new Growl.UDPLegacy.NotificationType[] { this.udpNotificationType };

            // new
            this.application                 = new Growl.Connector.Application("iTunes");
            this.application.Icon            = String.Format(@"{0}\icon.png", System.Windows.Forms.Application.StartupPath);
            this.growl                       = new Growl.Connector.GrowlConnector(Properties.Settings.Default.GrowlPassword);
            this.growl.NotificationCallback += new Growl.Connector.GrowlConnector.CallbackEventHandler(growl_NotificationCallback);
            this.growl.EncryptionAlgorithm   = Growl.Connector.Cryptography.SymmetricAlgorithmType.PlainText;
            this.nt1 = new Growl.Connector.NotificationType("Track Changed", "Track Changed");
            this.notificationTypes = new Growl.Connector.NotificationType[] { this.nt1 };
        }
Пример #7
0
        public static string getPathToIcon(Growl.Connector.NotificationType nType)
        {
            string returnValue = "";

            if (nType.Icon != null)
            {
                if (nType.Icon.IsSet)
                {
                    if (nType.Icon.IsUrl)
                    {
                        returnValue = nType.Icon.Url;
                    }
                    else
                    {
                        returnValue = Path.GetTempFileName();
                        System.Drawing.Image Icon = nType.Icon;
                        Icon.Save(returnValue);
                    }
                }
            }
            return(returnValue);
        }
Пример #8
0
 public NotificationType()
 {
     this.nt = new Growl.Connector.NotificationType("General Notification", "General Notification");
 }
Пример #9
0
        public List<string> ProcessRegistration(Growl.UDPLegacy.RegistrationPacket rp, string receivedFrom)
        {
            /* THIS METHOD RESENDS THE UDP MESSAGE AS A LOCAL GNTP MESSAGE
            Growl.Connector.Application application = new Growl.Connector.Application(rp.ApplicationName);
            List<Growl.Connector.NotificationType> notificationTypes = new List<Growl.Connector.NotificationType>();
            foreach (Growl.UDPLegacy.NotificationType nt in rp.NotificationTypes)
            {
                Growl.Connector.NotificationType notificationType = new Growl.Connector.NotificationType(nt.Name, nt.Name, null, nt.Enabled);
                notificationTypes.Add(notificationType);
            }

            Growl.Connector.GrowlConnector udpToGNTPForwarder = new Growl.Connector.GrowlConnector();
            udpToGNTPForwarder.Password = rp.Password;
            udpToGNTPForwarder.EncryptionAlgorithm = Growl.Connector.Cryptography.SymmetricAlgorithmType.PlainText;
            udpToGNTPForwarder.Register(application, notificationTypes.ToArray());
             * */

            /* THIS METHOD AVOIDS SENDING ANOTHER MESSAGE, BUT TRADES THE DETAILED GNTP LOGGING */
            Growl.Connector.Application application = new Growl.Connector.Application(rp.ApplicationName);
            List<Growl.Connector.NotificationType> notificationTypes = new List<Growl.Connector.NotificationType>();
            foreach (Growl.UDPLegacy.NotificationType nt in rp.NotificationTypes)
            {
                Growl.Connector.NotificationType notificationType = new Growl.Connector.NotificationType(nt.Name, nt.Name, null, nt.Enabled);
                notificationTypes.Add(notificationType);
            }
            Growl.Connector.RequestInfo requestInfo = new Growl.Connector.RequestInfo();
            gntpListener_RegisterReceived(application, notificationTypes, requestInfo);
            List<string> extraLogInfo = (requestInfo != null ? requestInfo.HandlingInfo : null);
            return extraLogInfo;
        }
Пример #10
0
 public NotificationType()
 {
     this.nt = new Growl.Connector.NotificationType("General Notification", "General Notification");
 }
Пример #11
0
        private void InitializeAddIn()
        {
            this.cf = new ConfigForm();
            this.cf.PasswordChanged += new EventHandler(cf_PasswordChanged);

            this.appIcon = ConvertImageToBytes(global::GrowlExtras.VisualStudioAddIn.Properties.Resources.vs);
            this.successIcon = ConvertImageToBytes(global::GrowlExtras.VisualStudioAddIn.Properties.Resources.vs_success);
            this.failureIcon = ConvertImageToBytes(global::GrowlExtras.VisualStudioAddIn.Properties.Resources.vs_failed);

            //string password = Growl.Connector.GrowlConnector.TEST_PASSWORD; //TODO:
            //this.growl = new Growl.Connector.GrowlConnector(password);
            this.growl = new Growl.Connector.GrowlConnector(Properties.Settings.Default.Password);
            this.growl.EncryptionAlgorithm = Growl.Connector.Cryptography.SymmetricAlgorithmType.PlainText;

            this.application = new Growl.Connector.Application("Visual Studio");
            this.application.Icon = new Growl.CoreLibrary.BinaryData(this.appIcon);

            this.ntSolutionSuccess = new Growl.Connector.NotificationType("Solution Succeeded", "Solution Succeeded", new Growl.CoreLibrary.BinaryData(this.successIcon), true);
            this.ntSolutionFailed = new Growl.Connector.NotificationType("Solution Failed", "Solution Failed", new Growl.CoreLibrary.BinaryData(this.failureIcon), true);
            this.ntProjectSuccess = new Growl.Connector.NotificationType("Project Succeeded", "Project Succeeded", new Growl.CoreLibrary.BinaryData(this.successIcon), true);
            this.ntProjectFailed = new Growl.Connector.NotificationType("Project Failed", "Project Failed", new Growl.CoreLibrary.BinaryData(this.failureIcon), true);

            this.growl.Register(application, new Growl.Connector.NotificationType[] { ntSolutionSuccess, ntSolutionFailed, ntProjectSuccess, ntProjectFailed });

            this._applicationObject.Events.BuildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone);
            this._applicationObject.Events.BuildEvents.OnBuildProjConfigDone += new _dispBuildEvents_OnBuildProjConfigDoneEventHandler(BuildEvents_OnBuildProjConfigDone);
        }