/// <summary> /// Called to show the small toast alert window on new items received. /// </summary> /// <param name="feed">Feed to be displayed</param> /// <param name="dispItemCount">unread items count to display</param> /// <param name="items">list of the newest DownloadItem's received. We assume, /// they are sorted with the newest items first!</param> /// <remarks> /// The parameter <c>dispItemCount</c> controls, if and how many item links /// are displayed in the window. This means; if 0 (zero) or lower than zero, nothing /// happens (no window). If one or more is specified, it displayes up to three items /// in the window. This way you can control, if there was allready e.g. 3 new items on the /// feed, and just only one new was received, that the window display only a link /// to that one newest item by specify 1 (one) as the parameter. /// </remarks> public void Alert(INewsFeed feed, int dispItemCount, IList <DownloadItem> items) { if (feed == null || dispItemCount < 0 || items == null || items.Count == 0) { return; } int unreadCount = items.Count; var firstItem = items[0]; if (_alertWindow != null && unreadCount > dispItemCount && !_alertWindow.IsOpen(DownloadItemAlertWindowKey)) { UltraDesktopAlertShowWindowInfo windowInfo = new UltraDesktopAlertShowWindowInfo(); windowInfo.Key = DownloadItemAlertWindowKey; windowInfo.Image = Properties.Resources.download_enclosure_32; windowInfo.Data = firstItem; windowInfo.PinButtonVisible = true; windowInfo.Caption = $"<font face=\"Tahoma\" size=\"+2\"><b>{feed.title}</b></font><br/> "; windowInfo.Text = String.Format("<font face=\"Tahoma\">{0}<br/>{1}<br/>{2}</font>", SR.GUIStatusEnclosureJustReceivedItemsMessage, StringHelper.ShortenByEllipsis(firstItem.File.LocalName, maxItemTextWith), String.IsNullOrEmpty(firstItem.Enclosure.Description) ? "" : firstItem.Enclosure.Description); windowInfo.FooterText = $"<font face=\"Tahoma\" size=\"-1\">{SR.MenuShowFeedPropertiesCaption}</font>"; if (_preferences.AllowAppEventSounds) { windowInfo.Sound = Resource.ApplicationSound.GetSoundStream(Resource.ApplicationSound.NewAttachmentDownloaded); } _alertWindow.Show(windowInfo); } }
/// <summary> /// Displays a desktop alert /// </summary> /// <param name="messageText">string to be displayed in the desktop alert</param> public static void ShowDesktopAlert(string messageText) { Configuration config = ConfigurationManager.OpenExeConfiguration(Path.Combine(Application.StartupPath, "AuditWizardv8.exe")); int autoCloseDelay = (Convert.ToInt32(config.AppSettings.Settings["DesktopAlertFadeOutSeconds"].Value) * 1000); //float alertOpacity = (Convert.ToSingle(config.AppSettings.Settings["DesktopAlertOpacityPercent"].Value) / 100); Infragistics.Win.Appearance normalLinkAppearance = new Infragistics.Win.Appearance(); normalLinkAppearance.ForeColor = System.Drawing.SystemColors.WindowText; normalLinkAppearance.FontData.Name = "Calibri"; normalLinkAppearance.FontData.SizeInPoints = 9.5F; _desktopAlert.CaptionAppearance = normalLinkAppearance; _desktopAlert.TextAppearance = normalLinkAppearance; _desktopAlert.FooterTextAppearance = normalLinkAppearance; _desktopAlert.Opacity = 0.9F;// alertOpacity; _desktopAlert.Visible = true; _desktopAlert.AutoClose = DefaultableBoolean.True; _desktopAlert.AutoCloseDelay = autoCloseDelay; _desktopAlert.ImageSize = new System.Drawing.Size(32, 32); _desktopAlert.AllowMove = DefaultableBoolean.False; _desktopAlert.TreatCaptionAsLink = DefaultableBoolean.False; _desktopAlert.TreatTextAsLink = DefaultableBoolean.False; _desktopAlert.FixedSize = new System.Drawing.Size(350, 0); _desktopAlert.AnimationSpeed = AnimationSpeed.Slow; _desktopAlert.AnimationStyleShow = AnimationStyle.Fade; _desktopAlert.AnimationStyleAutoClose = AnimationStyle.Fade; _desktopAlert.AnimationScrollDirectionShow = AnimationScrollDirection.BottomToTop; _desktopAlert.AnimationScrollDirectionAutoClose = AnimationScrollDirection.TopToBottom; _desktopAlert.MultipleWindowDisplayStyle = MultipleWindowDisplayStyle.Tiled; // Create a new instance of the UltraDesktopAlertShowWindowInfo class. UltraDesktopAlertShowWindowInfo showInfo = new UltraDesktopAlertShowWindowInfo(); showInfo.Text = "<span style=\"text-decoration:none\">" + messageText + " " + "</span>"; showInfo.Caption = "<span style=\"text-decoration:none\">AuditWizard notification</span>"; showInfo.Screen = Screen.AllScreens[Screen.AllScreens.Length - 1]; _desktopAlert.Show(showInfo); }
/// <summary> /// Displays a desktop alert for tasks /// </summary> /// <param name="messageText">string to be displayed in the desktop alert</param> public static void ShowDesktopAlertForTasks(string messageText, int aTaskID) { Infragistics.Win.Appearance normalLinkAppearance = new Infragistics.Win.Appearance(); normalLinkAppearance.ForeColor = System.Drawing.SystemColors.WindowText; normalLinkAppearance.FontData.Name = "Verdana"; normalLinkAppearance.FontData.SizeInPoints = 8; _desktopAlert.CaptionAppearance = normalLinkAppearance; _desktopAlert.TextAppearance = normalLinkAppearance; _desktopAlert.FooterTextAppearance = normalLinkAppearance; _desktopAlert.Opacity = 0.9F;// alertOpacity; _desktopAlert.Visible = true; _desktopAlert.AutoClose = DefaultableBoolean.False; _desktopAlert.ImageSize = new System.Drawing.Size(32, 32); _desktopAlert.AllowMove = DefaultableBoolean.False; _desktopAlert.TreatCaptionAsLink = DefaultableBoolean.False; _desktopAlert.TreatTextAsLink = DefaultableBoolean.True; _desktopAlert.FixedSize = new System.Drawing.Size(350, 0); _desktopAlert.AnimationSpeed = AnimationSpeed.Slow; _desktopAlert.AnimationStyleShow = AnimationStyle.Fade; _desktopAlert.AnimationStyleAutoClose = AnimationStyle.Fade; _desktopAlert.AnimationScrollDirectionShow = AnimationScrollDirection.BottomToTop; _desktopAlert.AnimationScrollDirectionAutoClose = AnimationScrollDirection.TopToBottom; _desktopAlert.MultipleWindowDisplayStyle = MultipleWindowDisplayStyle.Tiled; _desktopAlert.DesktopAlertLinkClicked -= new DesktopAlertLinkClickedHandler(_desktopAlert_SupportDesktopAlertLinkClicked); _desktopAlert.DesktopAlertLinkClicked += new DesktopAlertLinkClickedHandler(_desktopAlert_DesktopAlertLinkClicked); // Create a new instance of the UltraDesktopAlertShowWindowInfo class. UltraDesktopAlertShowWindowInfo showInfo = new UltraDesktopAlertShowWindowInfo(); showInfo.Text = "<span style=\"text-decoration:none\">" + messageText + "</span>"; showInfo.Caption = "<span style=\"text-decoration:none\">AuditWizard notification</span>"; showInfo.Data = aTaskID; showInfo.Screen = Screen.AllScreens[Screen.AllScreens.Length - 1]; _desktopAlert.Show(showInfo); }
/// <summary> /// Called to show the small toast alert window on new items received. /// </summary> /// <param name="node">Feed node where items received</param> /// <param name="dispItemCount">unread items count to display</param> /// <param name="items">list of the newest NewsItem's received. We assume, /// they are sorted with the newest items first!</param> /// <remarks> /// The parameter <c>dispItemCount</c> controls, if and how many item links /// are displayed in the window. This means; if 0 (zero) or lower than zero, nothing /// happens (no window). If one or more is specified, it displayes up to three items /// in the window. This way you can control, if there was allready e.g. 3 new items on the /// feed, and just only one new was received, that the window display only a link /// to that one newest item by specify 1 (one) as the parameter. /// </remarks> public void Alert(TreeFeedsNodeBase node, int dispItemCount, IList <INewsItem> items) { if (node == null || dispItemCount < 0 || items == null || items.Count == 0) { return; } int unreadCount = items.Aggregate(0, (i, item) => { if (item.BeenRead) { return(i); } return(i + 1); }); var firstItem = items[0]; if (_alertWindow != null && unreadCount > dispItemCount && !_alertWindow.IsOpen(NewsItemAlertWindowKey)) { UltraDesktopAlertShowWindowInfo windowInfo = new UltraDesktopAlertShowWindowInfo(); windowInfo.Key = NewsItemAlertWindowKey; windowInfo.PinButtonVisible = true; windowInfo.Image = node.ImageResolved; windowInfo.Data = firstItem; windowInfo.Caption = "<font face=\"Tahoma\">{0} ({1})</font>" .FormatWith(node.Text, unreadCount - dispItemCount); windowInfo.Text = String.Format("<hr NoShade=\"true\" size=\"1px\"/><font face=\"Tahoma\"><span style=\"font-style:italic_x003B_\">{0}</span></font>", StringHelper.ShortenByEllipsis(firstItem.Title, maxItemTextWith)); windowInfo.FooterText = "<font face=\"Tahoma\">{0}</font>" .FormatWith(SR.MenuShowFeedPropertiesCaption); if (_preferences.AllowAppEventSounds) { windowInfo.Sound = Resource.ApplicationSound.GetSoundStream(Resource.ApplicationSound.NewItemsReceived); } _alertWindow.Show(windowInfo); } }
public void ShowMessage(string message, TimerState state) { var mainForm = GetActiveMainForm(); mainForm.Invoke((Action) delegate { mainForm.TryCloseAlert(TomatoTimer_DesktopAlert_Key); var info = new UltraDesktopAlertShowWindowInfo { Caption = message, Image = (state == TimerState.Pausing || state == TimerState.Walking) ? Properties.Resources.clock : Properties.Resources.pause, ScreenPosition = ScreenPosition.Center, Key = TomatoTimer_DesktopAlert_Key, Screen = System.Windows.Forms.Screen.FromControl(mainForm) }; mainForm.GetType() .GetMethods(BindingFlags.Instance | BindingFlags.NonPublic) .Where(mi => mi.Name.Equals("ShowDesktopAlert", StringComparison.OrdinalIgnoreCase) && mi.GetParameters().Length == 2) .FirstOrDefault(mi => mi.GetParameters()[0].ParameterType.Name.Equals("UltraDesktopAlertShowWindowInfo", StringComparison.OrdinalIgnoreCase) && mi.GetParameters()[1].ParameterType.Name.Equals("Int32", StringComparison.OrdinalIgnoreCase))? .Invoke(mainForm, new object[] { info, 3000 }); }); }
public void NotifyStampaBatch(StampaBatchDTO dto, Image image, string message) { if (!string.IsNullOrEmpty(message)) { CommonMessages.DisplayWarning(string.Format("Si sono verificati degli errori nell'elaborazione della funzione:{0}{1}", Environment.NewLine, message)); return; } const ScreenPosition screenPosition = ScreenPosition.BottomRight; // If the UltraDesktopAlert component has not yet been created, // create it now, and set the properties of interest. if (_desktopAlert == null) { _desktopAlert = new UltraDesktopAlert(components) { Style = DesktopAlertStyle.WindowsLiveMessenger, CaptionAreaAppearance = {Image = CondominioResources.App_16.ToBitmap()}, MainImageAreaBorderColor = Color.Transparent, TextAppearance = {TextHAlign = HAlign.Left}, AutoClose = DefaultableBoolean.False }; // There is no specific Appearance exposed for the close button // (or dropdown button), but we can use Application Styling to // change the image that appears. //var library = new ApplicationStyleLibrary(); //var styleSet = library.StyleSets.Add("Default"); //Image closeImage = CondominioResources.Exit_16.ToBitmap(); //styleSet.RoleStyles.GetStyle("DesktopAlertCloseButton", true).States.GetState(RoleState.Normal, true).Appearance.Image = closeImage; //styleSet.RoleStyles.GetStyle("DesktopAlertCloseButton", true).States.GetState(RoleState.HotTracked, true).Appearance.Image = closeImage; //styleSet.RoleStyles.GetStyle("DesktopAlertCloseButton", true).States.GetState(RoleState.Pressed, true).Appearance.Image = closeImage; //library.UpdateStyleManager(); // Remove the border that appears by default around the main image // by setting the MainImageAreaBorderColor to Transparent. // Set the alignment for the text link to left // Populate the AlertButtons collection var alertButtons = _desktopAlert.AlertButtons; // Add a button that enables the end user to unload the stock watcher //var button = alertButtons.Add("no_more"); //button.Appearance.Image = CondominioResources.NoMore_16.ToBitmap(); //button.ToolTipText = "Stop notifying me about this stock"; // Add a button that enables the end user to display data history var button = alertButtons.Add("data_history"); button.Appearance.Image = getStampeBatchUIService().SmallIcon; button.ToolTipText = "Visualizza l'elenco delle stampe batch disponibili"; // There are no properties for the tooltip text displayed by // the links, but we can change it easily using the resource customizer // since they are localized strings. In this case we should probably hide // the tooltip since clicking it doesn't do anything, so set the resource // value to an empty string. Infragistics.Win.Misc.Resources.Customizer.SetCustomizedString("DesktopAlertLinkUIElement_Caption_ToolTipText", string.Empty); Infragistics.Win.Misc.Resources.Customizer.SetCustomizedString("DesktopAlertLinkUIElement_Text_ToolTipText", "Clicca qui per aprire il report"); // Set the AnimationStyleShow and AnimationStyleAutoClose properties according // to the screen position...if the screen position is such that the desktop alert // windows are not aligned with an edge of the screen, use 'Fade', otherwise, use // 'Scroll' const AnimationStyle animationStyle = screenPosition == ScreenPosition.Manual ? AnimationStyle.Fade : AnimationStyle.Scroll; _desktopAlert.AnimationStyleShow = animationStyle; _desktopAlert.AnimationStyleAutoClose = animationStyle; // If we used the 'Fade' setting for the AnimationStyle properties, // set the AnimationSpeed property to 'Slow', only because it looks // a little better. Use 'Fast' for the 'Scroll' AnimationStyle setting. _desktopAlert.AnimationSpeed = animationStyle == AnimationStyle.Fade ? AnimationSpeed.Slow : AnimationSpeed.Fast; // Disallow multiple desktop alert windows, so that each new // notification closes the last, if one should happen to be open // at the time the new one appears. _desktopAlert.MultipleWindowDisplayStyle = MultipleWindowDisplayStyle.Tiled; // Disallow moving the desktop alert windows _desktopAlert.AllowMove = DefaultableBoolean.False; // Center align the footer text _desktopAlert.FooterTextAppearance.TextHAlign = HAlign.Center; // Hook the events of interest. hookEvents(true); } // Create the UltraDesktopAlertShowWindowInfo instance which we will use to // customize the appearance and content for the desktop alert window we are // about to display. var showInfo = new UltraDesktopAlertShowWindowInfo { Caption = "Stampe Batch", Text = "<strong>" + dto.Condominio + "</strong><br/><strong>" + dto.Esercizio + "</strong><br/>" + dto.Descrizione + " è ora disponibile", Data = dto, FooterText = "Visualizza la stampa", Image = image, ScreenPosition = screenPosition }; // Show the desktop alert window _desktopAlert.Show(showInfo); }