public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) SetAutoCloseInterval(n.Duration * 1000); this.pictureBox1.Image = n.Image; this.titleLabel.Text = n.Title; this.textLabel.Text = n.Description; this.Sticky = n.Sticky; Bitmap template = global::IphoneStyle.Properties.Resources.normal; switch (n.Priority) { case 2: template = global::IphoneStyle.Properties.Resources.emergency; break; case 1: template = global::IphoneStyle.Properties.Resources.high; break; case -1: template = global::IphoneStyle.Properties.Resources.moderate; break; case -2: template = global::IphoneStyle.Properties.Resources.verylow; break; } this.bitmap = SizeImage(template, this.Width, this.Height); }
protected override void HandleNotification(Notification notification, string displayName) { bool replace = false; if (!String.IsNullOrEmpty(notification.CoalescingGroup)) { foreach (NotificationWindow nw in this.ActiveWindows) { if (nw.CoalescingGroup == notification.CoalescingGroup) { ((MeterWindow)nw).Replace(notification); replace = true; break; } } } if (!replace) { MeterWindow win = new MeterWindow(); win.Tag = this; win.SetNotification(notification); win.SetDisplayLocation(GetLocationFromSetting()); this.Show(win); } }
public void Replace(Notification n) { this.replaced = true; SetNotification(n); Show(); OnShown(EventArgs.Empty); // call this manually since it might not fire if the form is already visible }
protected override void HandleNotification( Notification notification, string displayName ) { var location = SettingsHelper.GetLocationFromSetting ( SettingsPanel ); var speed = SettingsHelper.GetSpeedFromSetting ( SettingsPanel ); bool flag = false; if ( !string.IsNullOrEmpty ( notification.CoalescingGroup ) ) { foreach ( NotificationWindow activeWindow in base.ActiveWindows ) { if ( activeWindow.CoalescingGroup != notification.CoalescingGroup ) { continue; } ( (WindowsGrowlNotificationWindow)activeWindow ).Replace ( notification, location, speed ); flag = true; break; } } if ( !flag ) { var visualWindow = new WindowsGrowlNotificationWindow ( location, speed ); visualWindow.SetNotification ( notification ); visualWindow.BackColor = SettingsHelper.GetBackColorFromSetting ( SettingsPanel ); visualWindow.TitleColor = SettingsHelper.GetTitleColorFromSetting ( SettingsPanel ); visualWindow.DescriptionColor = SettingsHelper.GetDescColorFromSetting ( SettingsPanel ); visualWindow.PreferredDevice = base.GetPreferredDisplay ( ); base.Show ( visualWindow ); } }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) this.duration = n.Duration * 1000; //Image image = n.GetImage(); Image image = n.Image; if (image != null) { this.pictureBox1.Image = image; this.pictureBox1.Visible = true; } this.applicationNameLabel.Text = n.ApplicationName; this.titleLabel.Text = n.Title; this.descriptionLabel.Text = n.Description; this.Sticky = n.Sticky; // setup child controls Color textColor = GetTextColor(this.BackColor); this.titleLabel.ForeColor = textColor; this.descriptionLabel.ForeColor = textColor; this.applicationNameLabel.ForeColor = textColor; this.applicationNameLabel.Width = this.Width; }
public virtual void ProcessNotification(DisplayStyle.Notification notification, Growl.Daemon.CallbackInfo cbInfo, Growl.Connector.RequestInfo requestInfo) { try { bool done = this.display.ProcessNotification(notification, this.ActualName); // for any notifications that remain open (essentially, any visual notifications), add them to a list so we // can handle their callbacks later if (!done) { this.notificationsAwaitingCallback.Add(notification.UUID, cbInfo); } } catch (Exception ex) { // suppress any exceptions here (in case the display fails for some reason) Utility.WriteDebugInfo(String.Format("Display failed to process notification: '{0}' - {1}", ex.Message, ex.StackTrace)); } }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) this.AutoClose(n.Duration * 1000); // handle the image. if the image is not set, move the other controls over to compensate var image = Resources.logo.ToBitmap(); if (image != null) { this.pictureBox1.Image = image; this.pictureBox1.Size = new Size(32, 32); this.pictureBox1.Visible = true; int offset = this.pictureBox1.Width + 6; this.titleLabel.Left = this.titleLabel.Left + offset; this.titleLabel.Width = this.titleLabel.Width - offset; this.descriptionLabel.Left = this.descriptionLabel.Left + offset; this.descriptionLabel.Width = this.descriptionLabel.Width - offset; } else { this.pictureBox1.Visible = false; } this.titleLabel.Text = n.Title; this.descriptionLabel.Text = n.Description.Replace("\n", "\r\n"); this.descriptionLabel.Links.Clear(); this.Sticky = n.Sticky; }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) SetAutoCloseInterval(n.Duration * 1000); this.applicationNameLabel.Text = n.ApplicationName; this.titleLabel.Text = n.Title; this.descriptionLabel.Text = n.Description.Replace("\n", "\r\n"); this.Sticky = n.Sticky; Image image = n.Image; if (image != null) { this.pictureBoxApp.Image = image; this.pictureBoxApp.Visible = true; } else { // Move our application label over to account for no image (only half-way for aesthetic reasons). this.applicationNameLabel.Left -= this.pictureBoxApp.Width / 2; this.pictureBoxApp.Visible = false; } Region borderRegion = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, this.Width, this.Height, radius, radius)); this.Region = borderRegion; }
public override void SetNotification(Notification n) { base.SetNotification(n); // handle the image. if the image is not set, move the other controls over to compensate Image image = n.Image; if (image != null) { this.pictureBox1.Image = image; this.pictureBox1.Visible = true; } else { int offset = this.pictureBox1.Width - 6; this.applicationNameLabel.Left = this.titleLabel.Left + offset; this.applicationNameLabel.Width = this.titleLabel.Width - offset; this.titleLabel.Left = this.titleLabel.Left + offset; this.titleLabel.Width = this.titleLabel.Width - offset; this.descriptionLabel.Left = this.descriptionLabel.Left + offset; this.descriptionLabel.Width = this.descriptionLabel.Width - offset; this.pictureBox1.Visible = false; } this.applicationNameLabel.Text = n.ApplicationName; this.titleLabel.Text = n.Title; this.descriptionLabel.Text = n.Description.Replace("\n", "\r\n"); this.Sticky = n.Sticky; }
protected override void HandleNotification(Notification notification, string displayName) { BlueFlowerWindow win = new BlueFlowerWindow(); win.Tag = this; win.SetNotification(notification); win.SetDisplayLocation(GetLocationFromSetting()); this.Show(win); }
protected override void HandleNotification(Notification notification, string displayName) { MiniVisorWindow win = new MiniVisorWindow(); win.SetNotification(notification); win.FormClosed += new FormClosedEventHandler(win_FormClosed); this.queuedNotifications.Enqueue(win); WorkQueue(); }
protected override void HandleNotification(Notification notification, string displayName) { /* // should this fire this, or do nothing? if (this.NotificationClosed != null) { Growl.CoreLibrary.NotificationCallbackEventArgs args = new Growl.CoreLibrary.NotificationCallbackEventArgs(notification.UUID, Growl.CoreLibrary.CallbackResult.CLOSE); this.NotificationClosed(args); } * */ }
protected override void HandleNotification(Notification notification, string displayName) { StringBuilder sb = new StringBuilder(); PromptBuilder pb = new PromptBuilder(); pb.AppendText(notification.Title, PromptEmphasis.Strong); pb.AppendBreak(); pb.AppendText(notification.Description); ss.Speak(pb); }
public void NotificationMeetsRulesTest() { StickyNoteDisplay_Accessor target = new StickyNoteDisplay_Accessor(); // TODO: Initialize to an appropriate value Notification notification = new Notification(); // TODO: Initialize to an appropriate value notification.Description = "lala.txt"; string exclusions = ".txt,.dwg"; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; actual = target.NotificationMeetsRules(notification, exclusions); Assert.AreEqual(expected, actual); }
protected override void HandleNotification(Notification notification, string displayName) { VisorWindow win = new VisorWindow(); win.Tag = this; win.BackColor = GetBackgroundColorFromPriority(notification.Priority); win.SetNotification(notification); win.FormClosed += new FormClosedEventHandler(win_FormClosed); this.queuedNotifications.Enqueue(win); WorkQueue(); }
/// <summary> /// This is where we actually deal with the notification. The Growl client will call this method /// when a notification is received that is configured to use this display. /// </summary> protected override void HandleNotification(Notification notification, string displayName) { // 1. create your notification window // 2. call SetNotification to set the title, description, image, etc // 3. set any other custom settings // 4. call this.Show(win) - NOTE: you should always call the display's Show method // rather than calling win.Show() directly. this ensures that all necessary events // for click callbacks and layout management. SampleVisualWindow win = new SampleVisualWindow(); win.SetNotification(notification); win.BackColor = GetColorFromSetting(SETTING_BGCOLOR, BGCOLOR); this.Show(win); }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) this.SetAutoCloseInterval(n.Duration * 1000); //this.image = n.GetImage(); this.image = n.Image; this.applicationNameLabel.Text = n.ApplicationName; this.titleLabel.Text = n.Title; this.descriptionLabel.Text = n.Description.Replace("\n", "\r\n"); this.Sticky = n.Sticky; }
protected override void HandleNotification(Notification notification, string displayName) { CompactDarkWindow win = new CompactDarkWindow(); win.SetNotification(notification); this.Show(win); //win.FormClosed += new FormClosedEventHandler(win_FormClosed); /* ToastWindow win = new ToastWindow(); win.FormClosed += new FormClosedEventHandler(win_FormClosed); win.SetNotification(notification); this.queuedNotifications.Enqueue(win); WorkQueue(); */ }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) SetAutoCloseInterval(n.Duration * 1000); this.pictureBox1.Image = n.Image; this.titleLabel.Text = n.Title; this.textLabel.Text = n.Description; this.Sticky = n.Sticky; Bitmap template = global::Degree.Properties.Resources.degree; this.bitmap = SizeImage(template, this.Width, this.Height); }
/// <summary> /// This is where we actually deal with the notification. The Growl client will call this method /// when a notification is received that is configured to use this display. /// </summary> protected override void HandleNotification(Notification notification, string displayName) { // read the filename from the settings string filename = (string)this.SettingsCollection[SETTING_FILE_NAME]; if (!String.IsNullOrEmpty(filename)) { // write the data System.IO.StreamWriter sw = null; if (!System.IO.File.Exists(filename)) sw = System.IO.File.CreateText(filename); else sw = System.IO.File.AppendText(filename); sw.WriteLine("Application: {0}\r\nType: {1}\r\nID: {2}\r\nTitle: {3}\r\nDescription: {4}\r\nPriority: {5}\r\nSticky: {6}\r\n----------------------------\r\n\r\n", notification.ApplicationName, notification.Name, notification.NotificationID, notification.Title, notification.Description, notification.Priority, notification.Sticky); sw.Close(); } }
protected override void HandleNotification(Notification notification, string displayName) { /* string xml = @"<p> <s>You have 4 new messages.</s> <s>The first is from Stephanie Williams and arrived at <break/> 3:45pm. </s> <s> The subject is <prosody rate=""-20%"">ski trip</prosody> </s> </p>"; * */ PromptBuilder pb = new PromptBuilder(); // handle title if (notification.CustomTextAttributes != null && notification.CustomTextAttributes.ContainsKey("Notification-Title-SSML")) pb.AppendSsmlMarkup(notification.CustomTextAttributes["Notification-Title-SSML"]); else pb.AppendText(notification.Title, PromptEmphasis.Strong); pb.AppendBreak(); // handle text if (notification.CustomTextAttributes != null && notification.CustomTextAttributes.ContainsKey("Notification-Text-SSML")) pb.AppendSsmlMarkup(notification.CustomTextAttributes["Notification-Text-SSML"]); else pb.AppendText(notification.Description); try { ss.Speak(pb); } catch (Exception ex) { Growl.CoreLibrary.DebugInfo.WriteLine("Unable to speak input: " + ex.Message); // fall back to plain text (if the plain text is what failed the first time, it wont work this time either but wont hurt anything) pb.ClearContent(); pb.AppendText(notification.Title, PromptEmphasis.Strong); pb.AppendBreak(); pb.AppendText(notification.Description); ss.Speak(pb); } }
protected override void HandleNotification(Notification notification, string displayName) { if (!String.IsNullOrEmpty(notification.CoalescingGroup)) { foreach (NotificationWindow nw in this.ActiveWindows) { if (nw.CoalescingGroup == notification.CoalescingGroup) { ((SmokestackWindow)nw).Close(true); break; } } } SmokestackWindow win = new SmokestackWindow(); win.Tag = this; win.SetNotification(notification); win.SetDisplayLocation(GetLocationFromSetting()); this.Show(win); }
protected override void HandleNotification(Notification notification, string displayName) { if (!String.IsNullOrEmpty(notification.CoalescingGroup)) { foreach (NotificationWindow nw in this.ActiveWindows) { if (nw.CoalescingGroup == notification.CoalescingGroup) { ((StandardWindow)nw).Close(true); break; } } } StandardWindow win = new StandardWindow(); win.Tag = this; win.SetNotification(notification); win.Color1 = GetColorFromSetting(SETTING_COLOR1, COLOR1); win.Color2 = GetColorFromSetting(SETTING_COLOR2, COLOR2); this.Show(win); }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) this.SetAutoCloseInterval(n.Duration * 1000); this.Sticky = n.Sticky; Image image = n.Image; if (image != null) { if (image.Width > this.pictureBox1.Width) this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; this.pictureBox1.Image = image; this.pictureBox1.Visible = true; } string artist = n.Description; if (n.CustomTextAttributes != null && n.CustomTextAttributes.ContainsKey("iTunes-Artist")) artist = n.CustomTextAttributes["iTunes-Artist"]; string album = String.Empty; if (n.CustomTextAttributes != null && n.CustomTextAttributes.ContainsKey("iTunes-Album")) album = n.CustomTextAttributes["iTunes-Album"]; int rating = 0; if (n.CustomTextAttributes != null && n.CustomTextAttributes.ContainsKey("iTunes-Rating")) { string r = n.CustomTextAttributes["iTunes-Rating"]; if (!String.IsNullOrEmpty(r)) { rating = Convert.ToInt32(r); } } this.songNameLabel.Text = n.Title; this.artistNameLabel.Text = artist; this.albumLabel.Text = album; this.starRating.Rating = rating; }
protected override void HandleNotification(Notification notification, string displayName) { string filename = (string) this.SettingsCollection[SETTING_FILE_NAME]; if (!String.IsNullOrEmpty(filename)) { System.Text.StringBuilder sb = new StringBuilder(); sb.AppendFormat("-app \"{0}\" -id \"{1}\" -type \"{2}\" -title \"{3}\" -desc \"{4}\" -priority \"{5}\" -sticky \"{6}\"", Escape(notification.ApplicationName), Escape(notification.NotificationID), Escape(notification.Name), Escape(notification.Title), Escape(notification.Description), notification.Priority, notification.Sticky); if (notification.CustomTextAttributes != null) { foreach (KeyValuePair<string, string> item in notification.CustomTextAttributes) { sb.AppendFormat(" -{0} \"{1}\"", item.Key, item.Value); } } string arguments = sb.ToString(); System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(filename, arguments); psi.UseShellExecute = true; // this has to be true in order to run documents (.bat files specifically) - otherwise, only .exes can be launched psi.CreateNoWindow = true; System.Diagnostics.Process.Start(psi); } }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) this.SetAutoCloseInterval(n.Duration * 1000); //Image image = n.GetImage(); Image image = n.Image; if (image != null) { this.pictureBox1.Image = image; this.pictureBox1.Visible = true; int offset = this.pictureBox1.Width + 6; this.descriptionLabel.Left = this.descriptionLabel.Left + offset; this.descriptionLabel.Width = this.descriptionLabel.Width - offset; } this.applicationNameLabel.Text = n.ApplicationName; this.titleLabel.Text = n.Title; this.descriptionLabel.Text = n.Description.Replace("\n", "\r\n"); this.Sticky = n.Sticky; this.borderBrush = GetBorderBrushFromPriority(n.Priority); }
/// <summary> /// Handles displaying the notification. Called each time a notification is received that is to /// be handled by this display. /// </summary> /// <param name="notification">The <see cref="Notification"/> information</param> /// <param name="displayName">A string identifying the display name (used mainly by displays that provide multiple end-user selectable display styles)</param> protected abstract void HandleNotification(Notification notification, string displayName);
/// <summary> /// Handles displaying the notification. Called each time a notification is received that is to /// be handled by this display. /// </summary> /// <param name="notification">The <see cref="Notification"/> information</param> /// <param name="displayName">A string identifying the display name (used mainly by displays that provide multiple end-user selectable display styles)</param> /// <returns><c>true</c> if the handling of the message is 100% complete when this method finishes;<c>false</c> if the display may send a callback later (if you are creating a visual display that can be clicked, you should return false)</returns> public virtual bool ProcessNotification(Notification notification, string displayName) { HandleNotification(notification, displayName); // returning true indicates that the handling of the message is 100% complete (ie: there will be no callbacks later) return true; }
/// <summary> /// Handles displaying the notification. Called each time a notification is received that is to /// be handled by this display. /// </summary> /// <param name="notification">The <see cref="Notification"/> information</param> /// <param name="displayName">A string identifying the display name (used mainly by displays that provide multiple end-user selectable display styles)</param> /// <returns>Should almost always return <c>false</c>, which indicates that the notification is still 'open' (visible) and may callback later</returns> public override bool ProcessNotification(Notification notification, string displayName) { HandleNotification(notification, displayName); // returning false indicates that the notification is still 'open' (visible) and will callback later return false; }
public override void SetNotification(Notification n) { base.SetNotification(n); if (n.Duration > 0) this.SetAutoCloseInterval(n.Duration * 1000); Image image = n.Image; if (image != null) { this.pictureBox1.Image = image; this.pictureBox1.Visible = true; int offset = this.pictureBox1.Width + 6; this.descriptionLabel.Left = this.descriptionLabel.Left + offset; this.descriptionLabel.Width = this.descriptionLabel.Width - offset; } string applicationNameFormat = (!String.IsNullOrEmpty(n.OriginMachineName) ? "{0} on {1}" : "{0}"); this.applicationNameLabel.Text = String.Format(applicationNameFormat, n.ApplicationName, n.OriginMachineName); this.titleLabel.Text = n.Title; this.descriptionLabel.Text = n.Description.Replace("\n", "\r\n"); this.Sticky = n.Sticky; Region borderRegion = Growl.DisplayStyle.Utility.CreateRoundedRegion(0, 0, this.Width, this.Height, radius, radius); this.Region = borderRegion; }
/// <summary> /// Sets the notification information /// </summary> /// <param name="n">The <see cref="Notification"/> data to show</param> public virtual void SetNotification(Notification n) { this.notificationUUID = n.UUID; this.notificationID = n.NotificationID; this.coalescingGroup = n.CoalescingGroup; }