示例#1
1
 public Growler( string              applicationName, 
                 NotificationType[]  notificationTypes)
 {
     _notificationTypes = notificationTypes;
     _application = new Application(applicationName);
     _growl = new GrowlConnector
                  {
                      EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
                  };
     _growl.Register(_application, _notificationTypes);
 }
        public override void Subscribe()
        {
            Kill();

            Application app = new Application(APP_NAME);
            app.Icon = FolderWatchHandler.Icon;
            NotificationType[] types = new NotificationType[4];
            types[0] = new NotificationType(TYPE_CHANGED);
            types[1] = new NotificationType(TYPE_CREATED);
            types[2] = new NotificationType(TYPE_DELETED);
            types[3] = new NotificationType(TYPE_RENAMED);
            Register(app, types);

            if (this.watcher == null)
            {
                this.watcher = new FileSystemWatcher();
                this.watcher.Changed += new FileSystemEventHandler(watcher_Changed);
                this.watcher.Created += new FileSystemEventHandler(watcher_Created);
                this.watcher.Deleted += new FileSystemEventHandler(watcher_Deleted);
                this.watcher.Renamed += new RenamedEventHandler(watcher_Renamed);
            }

            this.watcher.Path = this.Path;
            this.watcher.IncludeSubdirectories = this.IncludeSubfolders;
            this.watcher.EnableRaisingEvents = true;
        }
        //Create growl object to register application and send notification.
        public void createGrowlObject()
        {
            //Growl object
            growl = new GrowlConnector();

            //Check growl running or not.
            if (GrowlConnector.IsGrowlRunningLocally())
            {

                //Application name(Spotify) as seen in growl GUI.
                Growl.Connector.Application application = new Growl.Connector.Application("Spotify");

                //Application Icon.
                application.Icon = getCurrentWorkingDirectory();

                NotificationType Spotify_notification_type = new NotificationType("SPOTIFYNOTIFICATION", "Display Notification");
                //Register "Spotify" application
                growl.Register(application, new NotificationType[] { Spotify_notification_type });

                //return growl object to show notification.
                // return growl;

            }
            else
                MessageBox.Show("check Growl running or not","Growl Not Found",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
        }
示例#4
0
        public Form1()
        {
            InitializeComponent();

            log4net.Config.XmlConfigurator.Configure();

            textBox1.Text = ConfigurationManager.AppSettings["Path"];
            _application = new Application(ApplicationName);

            _workerFiber = new PoolFiber();
            _workerFiber.Start();

            _importar = new Channel<string>();
            _importar.Subscribe(_workerFiber, Work);

            _notificationType = new NotificationType(SampleNotificationType, "Sample Notification");

            _growl = new GrowlConnector { EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.AES };
            _growl.NotificationCallback += GrowlNotificationCallback;
            _growl.Register(_application, new[] { _notificationType });

            folderWatch.Created += FolderWatchCreated;
            folderWatch.Renamed += FolderWatchRenamed;
            folderWatch.Deleted += FolderWatchDeleted;

            InitDatabase();

            if (!_autostart) return;

            Operar(true,true);
        }
示例#5
0
        public void RegisterForGrowl(string password, string hostName, string tcpPort)
        {
            this.notificationType = new NotificationType(NotificationName, NotificationName);

            int portNum;
            bool isValidPortNum = int.TryParse(tcpPort, out portNum);
            if (!string.IsNullOrEmpty(hostName) && isValidPortNum)
            {
                // use this if you want to connect to a remote Growl instance on another machine
                this.growl = new GrowlConnector(password, hostName, portNum);
            }
            else
            {
                // use this if you need to set a password - you can also pass null or an empty string to this constructor to use no password
                this.growl = new GrowlConnector(password);
            }

            //this.growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);

            // set this so messages are sent in plain text (easier for debugging)
            this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            this.application = new Growl.Connector.Application(ApplicationName);

            this.growl.Register(application, new NotificationType[] { notificationType });
        }
 public static void simpleGrowl(string title, string message = "")
 {
     var simpleGrowl = new GrowlConnector();
     var thisApp = new Growl.Connector.Application(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name);
     var simpleGrowlType = new NotificationType("SIMPLEGROWL");
     simpleGrowl.Register(thisApp, new NotificationType[] { simpleGrowlType });
     var myGrowl = new Notification(System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, "SIMPLEGROWL", title, title, message);
     simpleGrowl.Notify(myGrowl);
 }
示例#7
0
 public void Notify(string title, string message = "", NotificationType notificationType = NotificationType.None)
 {
     var simpleGrowl = new GrowlConnector();
     var thisApplication = new Growl.Connector.Application("Jubilee");
     var simpleGrowlType = new Growl.Connector.NotificationType("SIMPLEGROWL");
     simpleGrowl.Register(thisApplication, new Growl.Connector.NotificationType[] { simpleGrowlType });
     var myGrowl = new Notification("Jubilee", "SIMPLEGROWL", title, title, message);
     simpleGrowl.Notify(myGrowl);
 }
示例#8
0
 public static void simpleGrowl(string title, string message = "")
 {
     GrowlConnector simpleGrowl = new GrowlConnector();
     Growl.Connector.Application thisApp = new Growl.Connector.Application(System.Windows.Forms.Application.ProductName);
     NotificationType simpleGrowlType = new NotificationType("SIMPLEGROWL");
     simpleGrowl.Register(thisApp, new NotificationType[] { simpleGrowlType });
     Notification myGrowl = new Notification(System.Windows.Forms.Application.ProductName, "SIMPLEGROWL", title, title, message);
     simpleGrowl.Notify(myGrowl);
 }
示例#9
0
 public void RegisterGrowl()
 {
     _growl = new GrowlConnector();
     _notificationTypeSucces = new NotificationType("SUCCESS_NOTIFICATION", "Notification Succes");
     _notificationTypeFailure = new NotificationType("FAILURE_NOTIFICATION", "NotificationFailure");
     _application = new Application("NUnit build notifier");
     NotificationType[] notificationList = {_notificationTypeSucces, _notificationTypeFailure};
     _growl.Register(_application, notificationList);
     Thread.Sleep(2000);
 }
示例#10
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            var growlConnector = new GrowlConnector();
            var application = new Growl.Connector.Application("Hello, growl!");
            var notificationType = new NotificationType("sample", "Test");
            growlConnector.Register(application, new [] {notificationType});

            var notification = new Notification(application.Name, notificationType.Name, "1", "Test", "Hello there!");
            growlConnector.Notify(notification);
        }
示例#11
0
        private void Register()
        {
            Growl.Connector.Application application = new Growl.Connector.Application(applicationName);
            application.Icon = new Bitmap(System.Reflection.Assembly.GetEntryAssembly().GetManifestResourceStream("Spofy.Images.logo_small.png"));

            growl.Register(application, new NotificationType[] {
                new NotificationType(NotificationTypes.TrackChanged.Type, NotificationTypes.TrackChanged.Name),
                new NotificationType(NotificationTypes.MusicPaused.Type, NotificationTypes.MusicPaused.Name),
                new NotificationType(NotificationTypes.MusicResumed.Type, NotificationTypes.MusicResumed.Name),
            });
        }
示例#12
0
        public AppContext()
            : base()
        {
            bool ok = false;
            if (Environment.OSVersion.Version.Major > 5)
            {
                // Vista & higher
                ok = true;

                MMDeviceEnumerator devEnum = new MMDeviceEnumerator();
                this.defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);
                this.defaultDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
            }
            else
            {
                this.spkrVolumeControlID = MM.GetControlID(spkrComponent, spkrVolumeControl);
                this.spkrMuteControlID = MM.GetControlID(spkrComponent, spkrMuteControl);

                if (this.spkrVolumeControlID > 0)
                {
                    ok = true;

                    int v = MM.GetVolume(spkrVolumeControl, spkrComponent);
                    this.currentVolume = ConvertToPercentage(v);

                    this.hwnd = new Hwnd(WndProc);
                    int iw = (int)this.hwnd.Handle;

                    // ... and we can now activate the message monitor 
                    bool b = MM.MonitorControl(iw);
                }
            }

            if (ok)
            {
                NotificationType ntUp = new NotificationType(ntNameVolumeUp);
                NotificationType ntDown = new NotificationType(ntNameVolumeDown);
                NotificationType[] types = new NotificationType[] { ntUp, ntDown };
                Growl.Connector.Application app = new Growl.Connector.Application(appName);
                app.Icon = Properties.Resources.volumeter;

                this.growl = new GrowlConnector();
                this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
                this.growl.Register(app, types);

                this.timer = new System.Timers.Timer(buffer);
                this.timer.AutoReset = false;
                this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            }
            else
            {
                MessageBox.Show("No speaker/line out component found to monitor");
            }
        }
示例#13
0
        void Initialize()
        {
            notificationType = new NotificationType("BUILD_RESULT_NOTIFICATION", "Sample Notification");
            application = new Application("Giles");
            growl = new GrowlConnector
                        {
                            EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
                        };

            growl.Register(application, new[] { notificationType });
        }
        static Configuration()
        {
            application_name = Properties.Settings.Default.application_name;
            updateUserConfig();

            // configure growl
            growl = new GC.GrowlConnector();
            application = new GC.Application(Configuration.application_name);
            application.Icon = @"Icon.ico";

            // Notifications types available to register
            torrent_started = new GC.NotificationType("STARTED", "Torrent Started");
            torrent_completed = new GC.NotificationType("COMPLETED", "Torrent Completed");
            connection_error = new GC.NotificationType("ERROR", "Connection Error");
        }
示例#15
0
        public GrowlNotifier()
        {
            notificationType = new NotificationType(sampleNotificationType, "Network ARP change notification");

            growl = new GrowlConnector();
            //this.growl = new GrowlConnector("password");    // use this if you need to set a password - you can also pass null or an empty string to this constructor to use no password
            //this.growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);
            // set this so messages are sent in plain text (easier for debugging)

            growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            application = new Application("MacNotifier");

            growl.Register(application, new NotificationType[] { notificationType });
        }
示例#16
0
        public Form1()
        {
            InitializeComponent();

            growl = new GrowlConnector();
            //growl.Password = this.textBox2.Text;
            this.growl.OKResponse += new GrowlConnector.ResponseEventHandler(growl_OKResponse);
            this.growl.ErrorResponse += new GrowlConnector.ResponseEventHandler(growl_ErrorResponse);
            this.growl.NotificationCallback +=new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);

            growl.KeyHashAlgorithm = Cryptography.HashAlgorithmType.SHA256;
            growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
            //growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.DES;
            //growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.TripleDES;
            //growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.AES;

            this.app = new Growl.Connector.Application("SurfWriter");
            //app.Icon = "http://atomicbride.com/Apple.gif";
            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";
            //app.Icon = @"c:\apple.png";
            //app.Icon = Properties.Resources.Apple;
            //app.CustomTextAttributes.Add("Creator", "Apple Software");
            //app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");
            //app.CustomBinaryAttributes.Add("Sound", "http://fake.net/app.wav");
            app.Icon = @"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1JREFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jqch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5ErkJggg==";

            Growl.CoreLibrary.Detector detector = new Detector();
            if (detector.IsInstalled)
            {
                InvokeWrite(String.Format("Growl (v{0}; f{1}; a{2}) is installed at {3} ({4})", detector.FileVersion.ProductVersion, detector.FileVersion.FileVersion, detector.AssemblyVersion.ToString(), detector.InstallationFolder, detector.DisplaysFolder));
            }
            else
            {
                InvokeWrite("Growl is not available on this machine");
            }

            if (growl.IsGrowlRunning())
            {
                InvokeWrite("Growl is running");
            }
            else
            {
                InvokeWrite("Growl is not running");
            }
        }
示例#17
0
        public void Register()
        {
            var name = "SQL Aliaser";

            var icons = new StateIcons();

            _application = new Application(name) {
                                                     Icon = new BinaryData(GetIconBytes(icons.NotAliased))
                                                 };

            Resource aliasedIcon = new BinaryData(GetIconBytes(icons.Aliased));
            Resource notAliasedIcon = new BinaryData(GetIconBytes(icons.NotAliased));

            _aliasedNotification = new NotificationType("Aliased", "Aliased", aliasedIcon, true);
            _notAliasedNotification = new NotificationType("NotAliased", "Not Aliased", notAliasedIcon, true);
            _closedNotification = new NotificationType("Closed", "Shut Down");
            _connector.Register(_application, new[] { _aliasedNotification, _notAliasedNotification, _closedNotification });
        }
示例#18
0
        void Initialize()
        {
            informationNotificationType = new NotificationType("BUILD_RESULT_NOTIFICATION", "Sample Notification");
            successNotificationType = new NotificationType("SUCCESS_NOTIFICATION", "Success Notification");
            failureNotificationType = new NotificationType("FAILURE_NOTIFICATION", "Failure Notification");

            application = new Application("Giles");
            growl = new GrowlConnector
                        {
                            EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText
                        };

            growl.Register(application,
                new[] {
                    informationNotificationType,
                    successNotificationType,
                    failureNotificationType
                });
        }
        public static void Register()
        {
            if (Registered) return;

            Application application = new Application(Resources.WindowTitle);
            using (MemoryStream s = new MemoryStream()) {
                Utilities.ResourceHelper.GetImage("about-icon.png"
                    ).Save(s, ImageFormat.Png);
                application.Icon = new BinaryData(s.ToArray());
            }

            NotificationType new_message = new NotificationType(
                MessageTypes.NEWMESSAGE.ToString(),
                Localization.Locale.Current.Growl.NewMessage);

            Growl.Register(application, new NotificationType[] {
                new_message });

            Registered = true;
        }
示例#20
0
        public NUnitGrowlAddIn()
        {
            growlConnector = new GrowlConnector();

            if (growlConnector.IsGrowlRunning())
            {

                growlApplication = new Application("NUnit");
                NotificationType[] notificationTypeArr1 = new NotificationType[] {
                                                                                   new NotificationType("NUnit.TestRun.Started"),
                                                                                   new NotificationType("NUnit.TestRun.Succeeded"),
                                                                                   new NotificationType("NUnit.TestRun.Failed"),
                                                                                   new NotificationType("NUnit.TestRun.FirstTestFailed"),
                                                                                   new NotificationType("NUnit.TestRun.Exception")

                };

                NotificationType[] notificationTypes = notificationTypeArr1;
                growlConnector.Register(growlApplication, notificationTypes);

            }
        }
        public GrowlTrayAppContext()
            : base()
        {
            this.hwnd = new Hwnd(WndProc);

            NotificationType ntInfo = new NotificationType(ntNameInfo, ntNameInfo, Properties.Resources.info, true);
            NotificationType ntWarning = new NotificationType(ntNameWarning, ntNameWarning, Properties.Resources.warning, true);
            NotificationType ntError = new NotificationType(ntNameError, ntNameError, Properties.Resources.error, true);
            NotificationType ntOther = new NotificationType(ntNameOther, ntNameOther, Properties.Resources.windows, true);

            NotificationType[] types = new NotificationType[] { ntInfo, ntWarning, ntError, ntOther };
            Growl.Connector.Application app = new Growl.Connector.Application(appName);
            app.Icon = Properties.Resources.windows;

            this.growl = new GrowlConnector();
            this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;
            this.growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);
            if(GROWL) this.growl.Register(app, types);

            timer = new Timer();
            timer.Interval = 5 * 1000;
            timer.Tick += new EventHandler(timer_Tick);
        }
示例#22
0
        public static void Connect()
        {
            if (!GrowlConnector.IsGrowlRunningLocally())
                MessageBox.Show("Growl isn't running. :(", "Github Issue Notifier", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            var asm = Assembly.GetExecutingAssembly();
            Image icon;

            using (var stream = asm.GetManifestResourceStream("GitHubNotifier.Embedded.github.png"))
                icon = Image.FromStream(stream);

            var app = new Application("Github Notifier") {
                Icon = icon
            };

            var issueNotification = new NotificationType("ISSUE", "New issue");

            Connector.Register(app, new[] {
                issueNotification
            });

            Connector.NotificationCallback += ConnectorOnNotificationCallback;
        }
示例#23
0
        public GrowlDisplay(IGrowlWrapper growl)
        {
            string workingDirectory = AppDomain.CurrentDomain.BaseDirectory;
            string iconpath = Path.Combine(workingDirectory, "images");

            var application = new Application(ApplicationName);
            var success = new NotificationType(Success, "All Tests Pass")
                              {
                                  Icon = Path.Combine(iconpath, "Green.jpg")
                              };

            var fail = new NotificationType(Failed, "A Test Has Failed")
                           {
                               Icon = Path.Combine(iconpath, "Red.jpg")
                           };

            var inconclusive = new NotificationType(Inconclusive, "The Tests Are Inconclusive")
                                   {
                                       Icon = Path.Combine(iconpath, "Yellow.jpg")
                                   };

            _growl = growl;
            _growl.Register(application,new NotificationType[]{success,fail,inconclusive});
        }
示例#24
0
 // where growlAppName like "Sample App", "CryptoTrader", "blinkie", ...
 public void RegisterApplication(string growlAppName)
 {
     this.application = new Growl.Connector.Application(growlAppName);
     this.growl.Register(application, new NotificationType[] { notificationType });
 }
 /// <summary>
 /// Registers the specified application and notification types.
 /// </summary>
 /// <param name="application">The <see cref="Application"/> to register.</param>
 /// <param name="notificationTypes">The <see cref="NotificationType"/>s to register.</param>
 public virtual void Register(Application application, NotificationType[] notificationTypes)
 {
     Register(application, notificationTypes, null, null);
 }
 internal abstract void ForwardRegistration(Growl.Connector.Application application, List <Growl.Connector.NotificationType> notificationTypes, Growl.Daemon.RequestInfo requestInfo, bool isIdle);
 /// <summary>
 /// Registers the specified application and notification types and allows for additional request data.
 /// </summary>
 /// <param name="application">The <see cref="Application"/> to register.</param>
 /// <param name="notificationTypes">The <see cref="NotificationType"/>s to register.</param>
 /// <param name="requestData">The <see cref="RequestData"/> containing the additional information.</param>
 public virtual void Register(Application application, NotificationType[] notificationTypes, RequestData requestData)
 {
     Register(application, notificationTypes, requestData, null);
 }
示例#28
0
 /// <summary>
 /// Called when an application registration is received by GfW.
 /// </summary>
 /// <param name="application">The application.</param>
 /// <param name="notificationTypes">The notification types.</param>
 /// <param name="requestInfo">The request info.</param>
 /// <param name="isIdle"><c>true</c> if the user is currently idle;<c>false</c> otherwise</param>
 /// <remarks>
 /// Many types of forwarders can just ignore this event.
 /// </remarks>
 public override void ForwardRegistration(Growl.Connector.Application application,
                                          List <Growl.Connector.NotificationType> notificationTypes,
                                          Growl.Connector.RequestInfo requestInfo, bool isIdle)
 {
     // do nothing
 }
		private void RegisterApplication()
		{
			List<NotificationType> notificationTypes = new List<NotificationType>();

			notificationTypes.Add(new NotificationType(growlMessages.BrokenBuildMessage.Caption, 
				growlMessages.BrokenBuildMessage.Caption, DefaultProjectIcons.Red.ToBitmap(), true));
			notificationTypes.Add(new NotificationType(growlMessages.FixedBuildMessage.Caption, 
				growlMessages.FixedBuildMessage.Caption, DefaultProjectIcons.Green.ToBitmap(), true));
			notificationTypes.Add(new NotificationType(growlMessages.StillFailingBuildMessage.Caption, 
				growlMessages.StillFailingBuildMessage.Caption, DefaultProjectIcons.Red.ToBitmap(), true));
			notificationTypes.Add(new NotificationType(growlMessages.StillSuccessfulBuildMessage.Caption, 
				growlMessages.StillSuccessfulBuildMessage.Caption, DefaultProjectIcons.Green.ToBitmap(), true));
			notificationTypes.Add(new NotificationType("Message", "Message", DefaultProjectIcons.Orange.ToBitmap(), true));

			Application app = new Application(ApplicationName);

			app.Icon = DefaultProjectIcons.Green.ToBitmap();

			growl.Register(app, notificationTypes.ToArray());
		}
示例#30
0
 private void RegisterGrowl()
 {
     application = new Growl.Connector.Application("OWAMonitor");
     growl.Register(application, new[] { notificationType });
 }
示例#31
0
        private void button2_Click(object sender, EventArgs e)

        {
            Growl.Connector.Application app = new Growl.Connector.Application("SurfWriter");

            //app.Icon = "http://atomicbride.com/Apple.gif";

            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";

            app.Icon = @"c:\apple.png";

            app.CustomTextAttributes.Add("Creator", "Apple Software");

            app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");



            NotificationType nt1 = new NotificationType("Download Complete", "Download completed");

            //nt1.Icon = new BinaryData(new byte[] { 65, 66, 67, 68 });

            nt1.CustomTextAttributes.Add("Language", "English");

            nt1.CustomTextAttributes.Add("Timezone", "PST");



            Notification notification = new Notification(app.Name, nt1.Name, "123456", "\u2065 Your docu;ment\nwas publi&shed", "File 'c:\\file.txt' was successfully published at 8:57pm.\n\nClick this notification to open the file.\n\nThis is a test of the expanding displays.");

            notification.Sticky = false;

            notification.Priority = Priority.Emergency;

            notification.Icon = "http://atomicbride.com/Apple.gif";

            //notification.Icon = "http://haxe.org/favicon.ico";

            notification.CustomTextAttributes.Add("Filename", @"c:\file.txt");

            notification.CustomTextAttributes.Add("Timestamp", "8:57pm");

            notification.CustomBinaryAttributes.Add("File", new BinaryData(new byte[] { 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }));

            notification.CoalescingID = "secretfaketest";



            //string url = "http://localhost/growl-callback.aspx";

            //string url = "mailto:[email protected]";

            string url = "itpc:http://www.npr.org/rss/podcast.php?id=35";

            CallbackContext callback = new CallbackContext(url);



            Growl.Connector.RequestData rd = new RequestData();

            rd.Add("Return-To-Me", "some text value");

            rd.Add("Return-To-Me2", "this is some longer value, including a \n few \n line \n breaks");

            rd.Add("Can I have spaces?", "dont know");



            growl.Notify(notification, callback, rd);

            this.textBox1.Text = "NOTIFY sent";
        }
 /// <summary>
 /// Registers the specified application and notification types.
 /// </summary>
 /// <param name="application">The <see cref="Application"/> to register.</param>
 /// <param name="notificationTypes">The <see cref="NotificationType"/>s to register.</param>
 /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>
 public virtual void Register(Application application, NotificationType[] notificationTypes, object state)
 {
     Register(application, notificationTypes, null, state);
 }
示例#33
0
        public Form1()

        {
            InitializeComponent();



            growl = new GrowlConnector();

            //growl.Password = this.textBox2.Text;

            this.growl.OKResponse += new GrowlConnector.ResponseEventHandler(growl_OKResponse);

            this.growl.ErrorResponse += new GrowlConnector.ResponseEventHandler(growl_ErrorResponse);

            this.growl.NotificationCallback += new GrowlConnector.CallbackEventHandler(growl_NotificationCallback);



            growl.KeyHashAlgorithm = Cryptography.HashAlgorithmType.SHA256;

            growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

            //growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.DES;

            //growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.TripleDES;

            //growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.AES;



            this.app = new Growl.Connector.Application("SurfWriter");

            //app.Icon = "http://atomicbride.com/Apple.gif";

            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";

            //app.Icon = @"c:\apple.png";

            //app.Icon = Properties.Resources.Apple;

            //app.CustomTextAttributes.Add("Creator", "Apple Software");

            //app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");

            //app.CustomBinaryAttributes.Add("Sound", "http://fake.net/app.wav");

            app.Icon = @"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IAAAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1JREFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jqch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0vr4MkhoXe0rZigAAAABJRU5ErkJggg==";



            Growl.CoreLibrary.Detector detector = new Detector();

            if (detector.IsInstalled)

            {
                InvokeWrite(String.Format("Growl (v{0}; f{1}; a{2}) is installed at {3} ({4})", detector.FileVersion.ProductVersion, detector.FileVersion.FileVersion, detector.AssemblyVersion.ToString(), detector.InstallationFolder, detector.DisplaysFolder));
            }

            else

            {
                InvokeWrite("Growl is not available on this machine");
            }



            if (growl.IsGrowlRunning())

            {
                InvokeWrite("Growl is running");
            }

            else

            {
                InvokeWrite("Growl is not running");
            }
        }
        /// <summary>
        /// Registers the specified application and notification types and allows for additional request data.
        /// </summary>
        /// <param name="application">The <see cref="Application"/> to register.</param>
        /// <param name="notificationTypes">The <see cref="NotificationType"/>s to register.</param>
        /// <param name="requestData">The <see cref="RequestData"/> containing the additional information.</param>
        /// <param name="state">An optional state object that will be passed into the response events associated with this request</param>
        public virtual void Register(Application application, NotificationType[] notificationTypes, RequestData requestData, object state)
        {
            HeaderCollection appHeaders = application.ToHeaders();
            List<HeaderCollection> notifications = new List<HeaderCollection>();
            foreach (NotificationType notificationType in notificationTypes)
            {
                HeaderCollection notificationHeaders = notificationType.ToHeaders();
                notifications.Add(notificationHeaders);
            }

            MessageBuilder mb = new MessageBuilder(RequestType.REGISTER, this.GetKey());
            foreach(Header header in appHeaders)
            {
                mb.AddHeader(header);
            }
            mb.AddHeader(new Header(Header.NOTIFICATIONS_COUNT, notificationTypes.Length.ToString()));

            // handle any additional request data
            if (requestData != null)
            {
                HeaderCollection requestDataHeaders = requestData.ToHeaders();
                foreach (Header header in requestDataHeaders)
                {
                    mb.AddHeader(header);
                }
            }

            foreach(HeaderCollection headers in notifications)
            {
                MessageSection ms = new MessageSection();
                foreach(Header header in headers)
                {
                    ms.AddHeader(header);
                }
                mb.AddMessageSection(ms);
            }

            Send(mb, OnResponseReceived, false, state);
        }
示例#35
0
        private void button5_Click(object sender, EventArgs e)

        {
            Growl.Connector.Application app = new Growl.Connector.Application("SurfWriter");

            //app.Icon = "http://atomicbride.com/Apple.gif";

            //app.Icon = "http://www.thetroyers.com/images/Apple_Logo.jpg";

            app.Icon = @"c:\apple.png";

            app.CustomTextAttributes.Add("Creator", "Apple Software");

            app.CustomTextAttributes.Add("Application-ID", "08d6c05a21512a79a1dfeb9d2a8f262f");



            NotificationType nt1 = new NotificationType("Download Complete", "Download completed");

            nt1.Icon = new BinaryData(new byte[] { 65, 66, 67, 68 });

            nt1.CustomTextAttributes.Add("Language", "English");

            nt1.CustomTextAttributes.Add("Timezone", "PST");



            Notification notification = new Notification(app.Name, nt1.Name, "123456", "\u2605 Your document was published", @"File 'c:\file.txt' was successfully published at 8:57pm.");

            notification.Sticky = false;

            notification.Priority = Priority.Emergency;

            //notification.Icon = "http://atomicbride.com/Apple.gif";

            app.Icon = @"c:\apple.png";

            notification.CustomTextAttributes.Add("Filename", @"c:\file.txt");

            notification.CustomTextAttributes.Add("Timestamp", "8:57pm");

            notification.CustomBinaryAttributes.Add("File", new BinaryData(new byte[] { 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78 }));



            string data = "this is my context\nthis is after a line break";

            string type = typeof(string).ToString();

            CallbackContext context = new CallbackContext(data, type);



            Growl.Connector.RequestData rd = new RequestData();

            rd.Add("Return-To-Me", "some text value");

            rd.Add("Return-To-Me2", "another value");



            growl.Notify(notification, context, rd);

            this.textBox1.Text = "NOTIFY sent";
        }
示例#36
0
        public void RegisterGrowl()
        {
            try
            {
                //string[] resourcenames = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
                //foreach (string rname in resourcenames)
                //{
                //    API.WriteToLog(Urgency.INFO, rname);
                //}

                Growl.Connector.Application application = new Growl.Connector.Application("zVirtualScenes");
                string exePath = System.IO.Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
                application.Icon = new Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("GrowlPlugin.zvirtualscenes57.png"));

                NotificationType DeviceValueChange = new NotificationType(NOTIFY_DEVICE_VALUE_CHANGE, "Device Value Changed");
                DeviceValueChange.Icon = new Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("GrowlPlugin.Broadcast48.png"));

                GrowlConnector.Register(application, new NotificationType[] { DeviceValueChange });
                WriteToLog(Urgency.INFO, "Registered Growl Interface.");
            }
            catch (Exception ex)
            {
                WriteToLog(Urgency.ERROR, "Error registering Growl. " + ex.Message);
            }
        }
示例#37
0
        public AppContext()

            : base()

        {
            bool ok = false;

            if (Environment.OSVersion.Version.Major > 5)

            {
                // Vista & higher

                ok = true;



                MMDeviceEnumerator devEnum = new MMDeviceEnumerator();

                this.defaultDevice = devEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia);

                this.defaultDevice.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification);
            }

            else

            {
                this.spkrVolumeControlID = MM.GetControlID(spkrComponent, spkrVolumeControl);

                this.spkrMuteControlID = MM.GetControlID(spkrComponent, spkrMuteControl);



                if (this.spkrVolumeControlID > 0)

                {
                    ok = true;



                    int v = MM.GetVolume(spkrVolumeControl, spkrComponent);

                    this.currentVolume = ConvertToPercentage(v);



                    this.hwnd = new Hwnd(WndProc);

                    int iw = (int)this.hwnd.Handle;



                    // ... and we can now activate the message monitor

                    bool b = MM.MonitorControl(iw);
                }
            }



            if (ok)

            {
                NotificationType ntUp = new NotificationType(ntNameVolumeUp);

                NotificationType ntDown = new NotificationType(ntNameVolumeDown);

                NotificationType[] types = new NotificationType[] { ntUp, ntDown };

                Growl.Connector.Application app = new Growl.Connector.Application(appName);

                app.Icon = Properties.Resources.volumeter;



                this.growl = new GrowlConnector();

                this.growl.EncryptionAlgorithm = Cryptography.SymmetricAlgorithmType.PlainText;

                this.growl.Register(app, types);



                this.timer = new System.Timers.Timer(buffer);

                this.timer.AutoReset = false;

                this.timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
            }

            else

            {
                MessageBox.Show("No speaker/line out component found to monitor");
            }
        }