public static void Showtip(int time, string title, string content, ToolTipIcon icon, bool force = false) { if (Settings.Default.ShowPopup || force) { TaskbarIcon.ShowBalloonTip(time, title, content, icon); } }
/// <summary> /// Displays a balloon tip with the specified title, text, and icon in the taskbar for the specified time period. /// </summary> /// <param name="timeout">The time period, in milliseconds, the balloon tip should display.</param> /// <param name="tipTitle">The title to display on the balloon tip.</param> /// <param name="tipText">The text to display on the balloon tip.</param> /// <param name="tipIcon">One of the <see cref="T:System.Windows.Forms.ToolTipIcon"/> values.</param> /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="timeout"/> is less than 0.</exception> /// <exception cref="T:System.ArgumentException"><paramref name="tipText"/> is null or an empty string.</exception> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException"> /// <paramref name="tipIcon"/> is not a member of <see cref="T:System.Windows.Forms.ToolTipIcon"/>. /// </exception> internal static void ShowBalloonTip(int timeout, string tipTitle, string tipText, ToolTipIcon tipIcon) { if (Configuration.MadCow.TrayNotificationsEnabled) { Form1.GlobalAccess.MadCowTrayIcon.ShowBalloonTip(timeout, tipTitle, tipText, tipIcon); } }
public static void ShowBaloon(string msg, ToolTipIcon tip) { if (_notifyIcon != null) { _notifyIcon.ShowBalloonTip(5000, "Ошибка", string.IsNullOrEmpty(msg) ? "-": msg, tip); } }
public static void Balloon(string title, string text, ToolTipIcon tt_icon, int display_duration) { icon.BalloonTipTitle = title; icon.BalloonTipText = text; icon.BalloonTipIcon = tt_icon; icon.ShowBalloonTip(display_duration); }
public void ShowBalloonTip(int timeout,string tipTitle,string tipText,ToolTipIcon tipIcon) { // try { if (this.ShowDesktopAlerts) this.mNotifyIcon.ShowBalloonTip(timeout,tipTitle,tipText,tipIcon); } catch (Exception ex) { if (this.TrayIconError != null) TrayIconError(this,new TrayIconErrorEventArgs(ex)); } }
public static void Show(string title, string text, int milliseconds, ToolTipIcon icon) { if (n != null) { n.KillThread(); n.Close(); n.Dispose(); n = null; } n = new Notify(); n.carbonTheme1.Text = title; n.label1.Text = text; n.sleepTime = milliseconds; switch (icon) { case ToolTipIcon.Info: { n.boxIcon.Image = new Bitmap(SystemIcons.Information.ToBitmap(), 26, 26); } break; case ToolTipIcon.Error: { n.boxIcon.Image = new Bitmap(SystemIcons.Error.ToBitmap(), 26, 26); } break; case ToolTipIcon.Warning: { n.boxIcon.Image = new Bitmap(SystemIcons.Exclamation.ToBitmap(), 26, 26); } break; } n.TopMost = true; n.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - n.Width, Screen.PrimaryScreen.WorkingArea.Bottom - n.Height); n.Show(); }
private void ExibirAlerta(string titulo, string mensagem, ToolTipIcon icone) { if (WindowState == FormWindowState.Minimized) { notifyIcon1.ShowBalloonTip(5000, titulo, mensagem, icone); } }
public void NewNotify(int timeout, string title, string text, ToolTipIcon icon) { if (Icon != null) { Icon.ShowBalloonTip(timeout, title, text, icon); } }
public ShowBallonTip(int timeout, string tipTitle, string tipText, ToolTipIcon toolTipIcon) { Timeout = timeout; TipTitle = tipTitle; TipText = tipText; ToolTipIcon = toolTipIcon; }
public void ShowBallon(string message,ToolTipIcon toolTipIcon) { NotificationIcon.BalloonTipIcon = toolTipIcon; NotificationIcon.BalloonTipText = message; NotificationIcon.Visible = true; NotificationIcon.ShowBalloonTip(10000); }
/// <summary> /// 在任务栏显示水泡提示 /// </summary> /// <param name="timeOut"></param> /// <param name="tipTitle"></param> /// <param name="tipText"></param> /// <param name="tipIcon"></param> public void ShowBalloonTip( int timeOut, string tipTitle, string tipText, ToolTipIcon tipIcon) { this.notifyIcon.ShowBalloonTip(timeOut, tipTitle, tipText, tipIcon); }
public static void ShowNotifyTip(NotifyIcon notifyIcon, String NotifyTitle, String Message, ToolTipIcon TipIcon) { if (String.IsNullOrEmpty(Message)) { Message = " "; } notifyIcon.ShowBalloonTip(300, NotifyTitle, Message, TipIcon); }
private void ShowBalloonTip( string message, string title = "", ToolTipIcon icon = ToolTipIcon.None) { notifyIcon.BalloonTipIcon = icon; notifyIcon.BalloonTipText = message; notifyIcon.BalloonTipTitle = title; notifyIcon.ShowBalloonTip(1000); }
public void ShowBalloonTip(string title, string tipText, int timeout, ToolTipIcon icon) { if (Notify != null) { Notify.ShowBalloonTip(timeout, title, tipText, icon); } }
public void SetStatus(Status status, string message, string tip = null, ToolTipIcon tipIcon = ToolTipIcon.Info) { window.sshStatusTextBlock.Text = message; icon.Icon = statusIcons[(int)status]; icon.Text = settings.ProxyType == "SSH" ? resources["XWall"] as string + " - " + message : resources["XWall"] as string; if (tip != null) icon.ShowBalloonTip(0, message, tip, tipIcon); }
/// <summary> /// Drawing content of alert window. /// </summary> /// <param name="dc">Graphics object of alert window.</param> /// <param name="title">Title of alert.</param> /// <param name="text">Text of alert.</param> /// <param name="icon">Icon of alert.</param> /// <param name="customImage">Custom image of alert.</param> public virtual void Draw(System.Drawing.Graphics dc, string title, string text, ToolTipIcon icon = ToolTipIcon.None, System.Drawing.Image customImage = null) { Rectangle titleRect = GetTitleRect(dc, title, text, icon, customImage); Rectangle bodyRect = GetBodyRect(dc, title, text, icon, customImage); Rectangle rect = GetRect(dc, titleRect, bodyRect, icon, customImage); Image img = GetIcon(icon, customImage); Draw(dc, title, text, rect, titleRect, bodyRect, img, GetIconSize(icon, customImage).Width); // drawing icon if (img != null) dc.DrawImage(img, new Point(Padding.Left + IconPadding.Left, rect.Height / 2 - (img.Height + IconPadding.Vertical) / 2)); }
public void ShowBubbleInfo(string message, ToolTipIcon iconType = ToolTipIcon.Info) { if (Settings.Instance.ShowBubbleTooltipWhenSyncing) { this.icon.ShowBalloonTip( 500, "Outlook Google Calendar Sync", message, iconType ); } }
public void BindToProjectMonitor(IProjectMonitor monitor, bool showBalloonMessages, ToolTipIcon minimumNotificationLevel) { this.monitor = monitor; monitor.Polled += Monitor_Polled; this.minimumNotificationLevel = minimumNotificationLevel; if (showBalloonMessages) { monitor.BuildOccurred += Monitor_BuildOccurred; monitor.MessageReceived += Monitor_MessageReceived; } }
public void ShowBalloonTip(int timeOut, string tipTitle, string tipText, ToolTipIcon tipIcon, EventHandler balloonTipClickedHandler) { try { if (balloonTipClickedHandler != null) { NotifyIcon.BalloonTipClicked -= balloonTipClickedHandler; NotifyIcon.BalloonTipClicked += balloonTipClickedHandler; } ShowBalloon(tipTitle, tipText, tipIcon); } catch (NullReferenceException) { } }
public NotificationInformation( Icon icon, ToolTipIcon toolTipIcon, ToastIcons toastIcon, PlaySymbols playSymbol, bool isBlink, bool isLong) { this.Icon = icon; this.ToolTipIcon = toolTipIcon; this.ToastIcon = toastIcon; this.PlaySymbol = playSymbol; this.IsBlink = isBlink; this.IsLong = isLong; }
protected void showNotification(int timeout, string title, string text, ToolTipIcon icon) { new Thread(() => { toggleNotifyIcon(); notifyIcon.ShowBalloonTip(timeout, title, text, icon); lastNotification = DateTime.UtcNow; notificationTimer.Interval = timeout; notificationTimer.Start(); }) { IsBackground = true }.Start(); }
public NotifyOptions(string Message, string SubText, AlertType Type) { this.Message = Message; this.SubText = SubText; switch (Type) { default: Icon = ToolTipIcon.Info; break; case AlertType.Warning: Icon = ToolTipIcon.Warning; break; } }
//Shows a balloon popup. public static void ShowBalloonPopup(String title, String text, ToolTipIcon icon) { if (InvokeControl.InvokeRequired) { Debug.WriteLine("Invoking ShowBalloonPopup:" + title + " " + text); InvokeControl.Invoke(new ShowBalloonPopupHandler(ShowBalloonPopup), new object[] { title, text, icon }); } if (trayIcons == null) { dummyIcon.ShowBalloonPopup(title, text, icon); } else { trayIcons[0].ShowBalloonPopup(title, text, icon); } }
private void ShowNotification(string message, ToolTipIcon icon, int time) { if (!Utilities.ShowDesktopNotifications) { return; } if (TrayIcon == null) { return; } TrayIcon.BalloonTipText = message; TrayIcon.BalloonTipIcon = icon; TrayIcon.ShowBalloonTip(time); }
public void ShowToolTip(ToolTipIcon tti, string strTitle, string strMessage, Control controlName, Form form) { ToolTip toolTip1 = new ToolTip(); if (!form.IsDisposed) { toolTip1.ToolTipIcon = tti;//ToolTipIcon.Error; toolTip1.ToolTipTitle = strTitle; Point showLocation = new Point( controlName.Location.X + controlName.Width, controlName.Location.Y); toolTip1.Show(strMessage, form, showLocation, 5000); //controlName.SelectAll(); controlName.Focus(); } }
/// <summary> /// System notification /// </summary> /// <param name="Time">Time displayed in milliseconds (5000 = 5 seconds)</param> /// <param name="TitleText">Title text (REQUIRED)</param> /// <param name="TipText">Body text (REQUIRED)</param> /// <param name="Icon">Icon</param> public void Notification(int Time, string TitleText, string TipText, ToolTipIcon Icon) { try { if (!RegistryHelper.GetBoolean("GeneralSettings", "DisableBalloonHint")) // If it's not disabled { if (!String.IsNullOrEmpty(TitleText) && !String.IsNullOrEmpty(TipText)) { trayIcon.ShowBalloonTip(Time, TitleText, TipText, Icon); } } } catch (Exception) { } }
private void DesktopNotify(string MSG, ToolTipIcon icon) { NotifyIcon notifyIcon1 = new NotifyIcon(); notifyIcon1.Visible = true; notifyIcon1.BalloonTipIcon = icon; notifyIcon1.BalloonTipText = MSG; notifyIcon1.BalloonTipTitle = "Activation"; notifyIcon1.Text = MSG; //The icon is added to the project resources. //Here I assume that the name of the file is 'TrayIcon.ico' notifyIcon1.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); //Optional - handle doubleclicks on the icon: notifyIcon1.BalloonTipClicked += NotifyIcon1_BalloonTipClicked; notifyIcon1.ShowBalloonTip(5000); }
public static void ShowNotify(Form OperationForm, String NotifyTitle, String Message, ToolTipIcon TipIcon) { Form frm = GetNotifyContainsForm(OperationForm); if (frm != null) { if (frm.Tag != null) { object obj = frm.Tag; if (obj.GetType().Equals(typeof(NotifyIcon))) { NotifyIcon notify = (NotifyIcon)frm.Tag; ShowNotifyTip(notify, NotifyTitle, Message, TipIcon); } } } }
public void ChangeInfoText(ToolTipIcon icon, string title, string text) { m_flickerTimer.Stop(); m_balloonTip.TitleIcon = icon; m_balloonTip.Title = title; m_balloonTip.Text = text; int height = pB_info.Height * 4 / 5; int offset = (pB_info.Height - height) / 2; m_timerBmp = new Bitmap(height, height); string infoText = string.Empty; switch (icon) { case ToolTipIcon.Error: //m_timerBmp = Properties.Resources.error; m_timerBmp = SystemIcons.Error.ToBitmap(); infoText = "Error"; break; case ToolTipIcon.Info: //m_timerBmp = Properties.Resources.info; m_timerBmp = SystemIcons.Information.ToBitmap(); infoText = "Info"; break; case ToolTipIcon.Warning: //m_timerBmp = Properties.Resources.warning; m_timerBmp = SystemIcons.Warning.ToBitmap(); infoText = "Warning"; break; } pB_info.Image = new Bitmap(pB_info.Width, pB_info.Height); Graphics g = Graphics.FromImage(pB_info.Image); g.FillRectangle(new SolidBrush(pB_info.BackColor), 0, 0, pB_info.Width, pB_info.Height); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; g.DrawImage(m_timerBmp, offset, (pB_info.Height - height) / 2, height, height); m_timerTickCount = 0; if (icon == ToolTipIcon.Error || icon == ToolTipIcon.Warning) { m_flickerTimer.Start(); } //StringFormat strFormat = new StringFormat(); //strFormat.LineAlignment = StringAlignment.Center; //Font strFont = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Bold); //int pos_x = offset + offset / 2 + height; //Rectangle r = new Rectangle(pos_x, 0, pB_info.Width - pos_x, pB_info.Height); //g.DrawString(infoText, strFont, Brushes.Black, r, strFormat); g.Dispose(); }
private void ReportStatus(IBuildDetail build, string text, ToolTipIcon icon = ToolTipIcon.None) { if (ShouldDisplayNotification(build)) { StringBuilder message = new StringBuilder(); message.AppendFormat("Build Number: {0}\n", build.BuildNumber); message.AppendFormat("User: {0}\n", build.RequestedFor); _notifyIcon.ShowBalloonTip( BalloonTimeout, text, message.ToString(), icon ); } LastBuild = build; }
/// <inheritdoc /> public void ShowBalloonTipFor(int timeoutInMilliseconds, string title, string text, ToolTipIcon icon, Action clickAction = null, Action closeAction = null) { lock (this) { _balloonTipClickHandlers = new BalloonTipClickHandlerRegistration( clickAction, closeAction ); } NotifyIcon.ShowBalloonTip(timeoutInMilliseconds, title, text, icon); }
public void showNotificaiton(string title, string message, ToolTipIcon icon) { createNotificaitonIcon(); nIcon.ShowBalloonTip(5, title, message, icon); // This will let the balloon close after it's 5 second timeout // for demonstration purposes. Comment this out to see what happens // when dispose is called while a balloon is still visible. Thread.Sleep(5000); // The notification should be disposed when you don't need it anymore, // but doing so will immediately close the balloon if it's visible. if (this.WindowState != WindowState.Minimized) { nIcon.Dispose(); } }
/// <summary> /// Displays a notification bubble with the specified icon and text /// </summary> /// <param name="icon">The icon to be shown</param> /// <param name="instruction">The instruction text</param> /// <param name="text">The notification body</param> /// <param name="timeout">The time to wait, in milliseconds, for the notification to be hidden</param> public static void ShowNotification(ToolTipIcon icon, string instruction, string text, int timeout = 5000, System.Action callback = null) { Logger.WriteLine(LogLevel.Verbose, "displaying balloon tip"); mNotifyIcon.ShowBalloonTip(timeout, instruction, text, icon); if (callback != null) { mNotifyIcon.Tag = new EventHandler(delegate(object sender, EventArgs e) { // Detach event handler and call the callback mNotifyIcon.BalloonTipClicked -= (EventHandler)mNotifyIcon.Tag; callback(); }); // Attach event handler for detaching itself before the callback gets called mNotifyIcon.BalloonTipClicked += (EventHandler)mNotifyIcon.Tag; } }
/// <summary> /// バルーンを表示します。 /// </summary> /// <param name="message">表示する内容</param> /// <param name="title">バルーンのタイトル</param> /// <param name="showTime">表示時間(ミリ秒)</param> /// <param name="icon">アイコン表示</param> /// <returns>バルーンが使えるならばtrueを、使えないならばfalseを返します。</returns> public static bool Show(string message, string title, int showTime, ToolTipIcon icon) { if (ReadSetting.Setting.NewMailBalloonOrPopupNotify && (ReadSetting.Setting.NewMailNotifyOperation == ConfigData.NewMailNotification.Balloon) && Program.EnableBalloon) { if (ni != null) { ni.ShowBalloonTip(showTime, title, message, icon); } return(true); } else { return(false); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (MessageBox.Show("你确定要退出?取消则最小化到托盘", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { e.Cancel = false; } else { e.Cancel = true; this.Hide(); int tipShowMilliseconds = 1000; string tipTitle = "ZK工具箱已经隐藏"; string tipContent = "单击击托盘图标以启用"; ToolTipIcon tipType = ToolTipIcon.Info; notifyIcon1.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType); } }
private void button2_Click(object sender, EventArgs e) { m_menu = new ContextMenu(); m_menu.MenuItems.Add(0, new MenuItem("Exit", new System.EventHandler(Exit_Click))); m_menu.MenuItems.Add(0, new MenuItem("Show", new System.EventHandler(Show_Click))); m_notifyicon.Icon = new Icon(GetType(), "icon.ico"); m_notifyicon.Visible = true; m_notifyicon.ContextMenu = m_menu; m_notifyicon.MouseMove += new MouseEventHandler(m_notifyicon_MouseMove); m_notifyicon.MouseClick += new MouseEventHandler(m_notifyicon_MouseClick); ToolTipIcon tipicon = new ToolTipIcon(); m_notifyicon.ShowBalloonTip(1, "Download Statu", "You can see download status here\n" + label3.Text, tipicon); ishidden = true; this.Hide(); }
public static void messageBox(string title, string body, ToolTipIcon icon) { try { if (!isFormVisible(G.form1)) { Form1.notifyIcon1.ShowBalloonTip(10000, title, body, icon); } else { MessageBox.Show(body, title); } } catch (Exception e) { G.print(e.ToString()); } }
/// <summary> /// Diplays the given title, message and icon as a system notification area balloon. /// </summary> /// <param name="title">The title of the balloon.</param> /// <param name="message">The message to display.</param> /// <param name="icon">The icon to show.</param> public void ShowNotificationBalloon(string title, string message, ToolTipIcon icon) { NotificationInfo info; info.Source = null; info.Timeout = 0; info.Icon = icon; info.Title = title; info.Message = message; NotificationsQueue.Add(info); //Can we show the notification immediately? if (NotificationsQueue.Count == 1) { ShowNextNotification(); } }
public void popupMessage(String text, int duration, ToolTipIcon icon) { if (this.enablePopupsToolStripMenuItem.Checked) { if (this.nativePopupsToolStripMenuItem.Checked) { notifyIcon1.BalloonTipText = text; notifyIcon1.BalloonTipIcon = icon; notifyIcon1.BalloonTipTitle = "Info"; notifyIcon1.ShowBalloonTip(duration); } else { // Legacy version //AutoClosingMessageBox.Show(text, "Alert", duration); legacyPopup(text, "Alert", duration); } } }
public void ShowNotification(INotifier source, int timeout, ToolTipIcon icon, string title, string message) { NotificationInfo info; info.Source = source; info.Timeout = timeout; info.Icon = icon; info.Title = title; info.Message = message; NotificationsQueue.Add(info); //Can we show the notification immediately? if (NotificationsQueue.Count == 1) { ShowNextNotification(); } }
// The most useful part of the wrappers in this section is their documentation. /// <summary>Send TTM_SETTITLE message to the tooltip. /// TODO [very low]: implement the custom icon, if needed. </summary> /// <param name="_wndTooltip">HWND of the tooltip</param> /// <param name="_icon">Standard icon</param> /// <param name="_title">The title string</param> internal static int SetTitle(IntPtr _wndTooltip, ToolTipIcon _icon, string _title) { const int TTM_SETTITLE = WM_USER + 33; var tempptr = IntPtr.Zero; try { tempptr = Marshal.StringToHGlobalUni(_title); return(SendMessage(_wndTooltip, TTM_SETTITLE, (int)_icon, tempptr)); } finally { if (IntPtr.Zero != tempptr) { Marshal.FreeHGlobal(tempptr); tempptr = IntPtr.Zero; } } }
internal void NotifyUser(string title, string message, ToolTipIcon icon) { try { isNotifying = true; // May fix issue with notifications loosing parent application identification in certain situations (logoff?) // WriteEventLog(message, icon); // TODO requires Admin privileges and installutil (cmd line) for Installers // Window Notification notifyIcon.ShowBalloonTip(3000, title, message, icon); isNotifying = false; } catch (Exception ex) { Debug.WriteLine(ex.Message); Program.DisplayError(ex); } }
/// <summary> /// Creates a balloon message window near the tray icon. Requires Windows 2000/XP or later. /// </summary> /// <param name="Title"> /// <para>If all parameters are omitted, any TrayTip window currently displayed will be removed.</para> /// <para>Otherwise, this parameter is the title of the window, which can be up to 73 characters long (characters beyond this length are not shown).</para> /// <para>If Title is blank, the title line will be entirely omitted from the balloon window, making it vertically shorter.</para> /// </param> /// <param name="Text"> /// <para>If this parameter is omitted or blank, any TrayTip window currently displayed will be removed.</para> /// <para>Otherwise, specify the message to display, which appears beneath Title. Only the first 265 characters of Text will be displayed. Carriage return (`r) or linefeed (`n) may be used to create multiple lines of text. For example: Line1`nLine2</para> /// <para>If Text is long, it can be broken up into several shorter lines by means of a continuation section, which might improve readability and maintainability.</para> /// </param> /// <param name="Seconds"> /// <para>The approximate number of seconds to display the window, after which it will be automatically removed by the OS. Specifying a number less than 10 or greater than 30 will usually cause the minimum (10) or maximum (30) display time to be used instead. If blank or omitted, the minimum time will usually be used. This parameter can be an expression.</para> /// <para>The actual timeout may vary from the one specified. Microsoft explains, "if the user does not appear to be using the computer, the system does not count this time towards the timeout." (Technical details here.) Therefore, to have precise control over how long the TrayTip is displayed, use the Sleep command followed by TrayTip with no parameters, or use SetTimer as illustrated in the Examples section below.</para> /// </param> /// <param name="Options"> /// <para>Specify one of the following digits to have a small icon appear to the left of Title:</para> /// <list> /// <item>1: Info icon</item> /// <item>2: Warning icon</item> /// <item>3: Error icon</item> /// <para>If omitted, it defaults to 0, which is no icon.</para> /// </list> /// </param> public static void TrayTip(string Title, string Text, int Seconds, int Options) { if (Tray == null) { Tray = new NotifyIcon(); } ToolTipIcon icon = ToolTipIcon.None; switch (Options) { case 1: icon = ToolTipIcon.Info; break; case 2: icon = ToolTipIcon.Warning; break; case 3: icon = ToolTipIcon.Error; break; } Tray.ShowBalloonTip(Seconds * 1000, Title, Text, icon); }
private ToolTipIcon getToolTipIcon(string v) { ToolTipIcon typeIcon = ToolTipIcon.None; switch (v) { case "Error": typeIcon = ToolTipIcon.Error; break; case "Info": typeIcon = ToolTipIcon.Info; break; case "Warning": typeIcon = ToolTipIcon.Warning; break; } return(typeIcon); }
private void OnServerCommandReceived(NamedPipeConnection <BeSafePipeCommand, BeSafePipeCommand> connection, BeSafePipeCommand command) { switch (command.Command) { case PipeCommands.Notification: MessageBox.Show(command.Notification, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); break; case PipeCommands.PluginScanResult: { PluginResult pResult = command.PluginScanResult; notifyIcon.Tag = pResult; ToolTipIcon icon = command.PluginScanResult.RiskRate == ThreatRiskRates.HighRisk ? ToolTipIcon.Error : ToolTipIcon.Warning; string message = $"{pResult.PluginInfo.Name}{Environment.NewLine}{pResult.Message}"; notifyIcon.ShowBalloonTip(3000, Resources.ApplicationName, message, icon); } break; } }
/// <summary> /// Shows the message assigned to the image. (c) Marcel Burger /// </summary> /// <param name="tip"></param> /// <param name="toolTipIcon"></param> /// <param name="control"></param> private void ShowToolTip(string tip, ToolTipIcon toolTipIcon, Control control) { try { if (this.ToolTipCurrent != null) { this.ToolTipCurrent.Dispose(); } this.ToolTipCurrent = new ToolTip(); this.ToolTipCurrent.OwnerDraw = true; this.ToolTipCurrent.Draw += new DrawToolTipEventHandler(toolTip_Draw); this.ToolTipCurrent.Show(tip, control, 0, -30, 1500); } catch (Exception ex) { ShowMessage(MessageType.Error, string.Format("An error occurred while showing a tooltip.{0}Method: {1}.{2}{0}Exception: {3}", Environment.NewLine, ex.Message, this.GetType().Name, MethodBase.GetCurrentMethod().Name)); } }
/// <summary>Log the logging event in Appender specific way.</summary> /// <param name="loggingEvent">The event to log</param> /// <remarks> /// <para> /// This method is called to log a message into this appender. /// </para> /// </remarks> public override void DoAppend(LoggingEvent loggingEvent) { ToolTipIcon toolTip = ToolTipIcon.Info; if (loggingEvent.Level.Value > Level.Warn.Value) { toolTip = ToolTipIcon.Error; } else if (loggingEvent.Level.Value > Level.Info.Value) { toolTip = ToolTipIcon.Warning; } string logger = loggingEvent.LoggerName; int lastIndex = logger.LastIndexOf(".", StringComparison.Ordinal) + 1; logger = logger.Substring(lastIndex, logger.Length - lastIndex); NotifyIcon.ShowBalloonTip(2000, logger, loggingEvent.MessageObject.ToString(), toolTip); }
internal void ActionCompleted(string title, string message, ToolTipIcon icon) { LogMethodEntry(); if (title == null) { title = AppVersion.AppName; } if (Configuration.Instance.FlashWindowWhenDone) { FlashWindow.Flash(this); } if (Configuration.Instance.NotifyWhenDone) { notifyIcon1.Icon = Icon; notifyIcon1.Visible = true; notifyIcon1.ShowBalloonTip(5000, title, message, icon); notifyIcon1.Visible = false; } }
private void ShowVGArchiveInfo() { const string HASH_OK = "... ok", HASH_ERROR = "... error"; const ToolTipIcon TOOLTIP_HASH_OK = ToolTipIcon.Info, TOOLTIP_HASH_ERROR = ToolTipIcon.Error; const string FORMAT_FLAT = "Plano", FORMAT_CHUNK = "Chunk"; int hashNameBuild = Lib.Toolkit.CreateHashName( MotherBrain.ArchiveSelected.FileName.ToCharArray(), MotherBrain.VGIndex.HashRoot); int hashName = MotherBrain.VGIndex.VolumeIndexes[VolumeList.SelectedIndex].HashNames[ArchiveList.SelectedIndex]; HashNameText.Text = Convert.ToString(hashName); HashNameText.Text += (hashNameBuild == hashName) ? HASH_OK : HASH_ERROR; MainToolTip.ToolTipIcon = (hashNameBuild == hashName) ? TOOLTIP_HASH_OK : TOOLTIP_HASH_ERROR; MainToolTip.SetToolTip(HashNameText, "Hash generado: " + Convert.ToString(hashNameBuild)); SizeArchiveText.Text = Convert.ToString(MotherBrain.ArchiveSelected.Size) + " bytes"; IsFlatText.Text = (MotherBrain.ArchiveSelected.IsFlat == true) ? FORMAT_FLAT : FORMAT_CHUNK; }
/// <summary> /// Notifie l'utilisateur le résultat des actions qu'il entreprend avec HylaNotify /// </summary> /// <param name="statut">le type du message</param> /// <param name="title">le titre du balloon</param> /// <param name="text">le contenu du balloon</param> /// <param name="display">booleen pour savoir si par defaut on affiche ou non le balloob</param> public void NotifyUser(string statut, string title, string text, bool display) { ToolTipIcon toolTipIcon = ToolTipIcon.None; Icon icon = null; // ERROR ou INFO switch (statut) { case "ERROR": toolTipIcon = ToolTipIcon.Error; icon = Properties.Resources.Exclamation_mark_icon; Log.Error(text); break; case "INFO": toolTipIcon = ToolTipIcon.Info; Log.Info(text); break; } icone.Text = text; //On ne change pas de l'icone courrante if (icon != null) { icone.Icon = icon; } // Si le curseur est sur l'icone, affichage de BalloonTip //TODO a finir if(CursorOnIcon) //{ // si on doit positionner le curseur sur l'icone icone.BalloonTipText = text; icone.BalloonTipIcon = toolTipIcon; icone.BalloonTipTitle = title; if (display) { icone.ShowBalloonTip(1000); } }
public InspectionText GetInspectionText(Scenario scenario, Rectangle rect, Point pt) { var simpt = DisplayPointToCoordinates(pt, rect); foreach (var agent in scenario.Agents) { if (HitTest(agent, simpt)) { ToolTipIcon icon = ToolTipIcon.Warning; string positiontext = $"{agent.GetPosition()} R:{agent.GetRadius()}"; string decisiontext = "[Stalled]"; if (scenario.AgentDecisions != null && scenario.AgentDecisions.ContainsKey(agent)) { if (scenario.AgentDecisions[agent].WinningContext != null) { decisiontext = scenario.AgentDecisions[agent].WinningContext.ToString(); icon = ToolTipIcon.Info; } } return(new InspectionText { Caption = $"Agent: {agent.GetName()}", Description = $"{positiontext}\r\n{decisiontext}", Icon = icon }); } } foreach (var loc in scenario.Locations) { if (HitTest(loc, simpt)) { string positiontext = $"{loc.GetPosition()} R:{loc.GetRadius()}"; return(new InspectionText { Caption = $"Location: {loc.GetName()}", Description = $"{positiontext}", Icon = ToolTipIcon.Info }); } } return(null); }
private void btn_start_Click(object sender, EventArgs e) { try { bool checkin = txtcheckin(); if (checkin == true) { Win32API.WlanManager.Instance.WlanManagers(); Win32API.WlanManager.Instance.SetConnectionSettings(txt_ssid.Text.Trim(), 128); Win32API.WlanManager.Instance.SetSecondaryKey(txt_pwd.Text.Trim()); Win32API.WlanManager.Instance.QueryStatus(); Win32API.WlanManager.Instance.StartHostedNetwork(); EnableInternetConnectionSharing(cmb_internet.Text.Trim()); #region Tips int tipShowMilliseconds = 1000; string tipTitle = "温馨提示"; string tipContent = txt_ssid.Text.Trim() + " 运行中。 "; ToolTipIcon tipType = ToolTipIcon.Info; notifyIcon1.ShowBalloonTip(tipShowMilliseconds, tipTitle, tipContent, tipType); txt_ssid.Enabled = false; txt_pwd.Enabled = false; label1.Visible = true; lb_online.Visible = true; wifi = true; timer1.Enabled = true; timer1.Start(); btn_start.Visible = false; btn_colse.Visible = true; #endregion } else { return; } } catch (Exception Error) { MessageBox.Show(Error.Message); } }
private void Initialize() { _timeout = 1000; _title = "EventsManager"; _icon = ToolTipIcon.Info; Icon = new NotifyIcon() { ContextMenuStrip = new ContextMenuStrip(), Icon = new Icon("em.ico"), Text = "EventsManager", Visible = true }; Icon.ContextMenu = new ContextMenu(); // Create menu items ShowWindowMenu = new MenuItem("Show"); ExitWindowMenu = new MenuItem("Exit"); // Add menu itmes to context menu Icon.ContextMenu.MenuItems.Add(ShowWindowMenu); Icon.ContextMenu.MenuItems.Add(new MenuItem("-")); Icon.ContextMenu.MenuItems.Add(ExitWindowMenu); }
/* * Вызов всплывающей подсказки статическим методом Show */ #region public static void Show(TextBox textBox, ToolTipIcon toolTipIcon, string toolTipTitle, string toolTipText) /// <summary> /// Показывает всплывающие подсказки /// </summary> /// <param name="textBox"></param> /// <param name="toolTipIcon"></param> /// <param name="toolTipTitle"></param> /// <param name="toolTipText"></param> public static void Show(TextBox textBox, ToolTipIcon toolTipIcon, string toolTipTitle, string toolTipText) { // Не фатально, ошибок вызывать не нужно, достаточно не показывать подсказку if (textBox == null || GetForm(textBox) == null) { return; } // Ставим курсор в редактируемое поле и выделяем текст внутри контрола textBox.Focus(); textBox.SelectAll(); // Задаем свойства всплывающей подсказке activeToolTip.ToolTipIcon = toolTipIcon; activeToolTip.ToolTipTitle = toolTipTitle; // Показываем всплывающую подсказку Show(textBox, toolTipText); // Подписываемся на события контрола, чтобы во время убрать подсказку HandleEvents(textBox); }
public static Rectangle GetBodyRect(IDeviceContext dc, Size minSize, Size maxSize, string text, Rectangle titleRect, ToolTipIcon icon, Padding padding) { Rectangle ret; if (text == null) { ret = new Rectangle(new Point(0, 0), minSize); } else { ret = new Rectangle(new Point(0, 0), maxSize); ret.Width -= padding.Horizontal; if (Application.RenderWithVisualStyles) { VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Balloon.Normal); Rectangle rect = renderer.GetTextExtent(dc, ret, text, TextFormatFlags.Left | TextFormatFlags.WordBreak | TextFormatFlags.VerticalCenter); if (rect.Width + padding.Horizontal > maxSize.Width) ret.Width = maxSize.Width; else if (rect.Width + padding.Horizontal < minSize.Width) ret.Width = minSize.Width; else ret.Width = rect.Width; if (rect.Height > maxSize.Height) ret.Height = maxSize.Height; else ret.Height = rect.Height; } else { throw new NotImplementedException(); } } return ret; }
public void NotifyBalloon(string message, ToolTipIcon icon) { ntfyTray.BalloonTipText = message; ntfyTray.BalloonTipIcon = icon; ntfyTray.ShowBalloonTip(10000); }
/// <summary> /// Set the status message in the main window. /// </summary> /// <param name="message">Status message to set.</param> /// <param name="icon">The type of icon to use on the baloon.</param> public void SetStatusMessage(string title, string message, ToolTipIcon icon) { if (configuration.ShowNotificationPopups) itaTray.ShowBalloonTip(5, title, message, icon); }
private void showBalloon(int _timeout, String _title, String _text, ToolTipIcon _icon) { if (m_trayIcon.Visible) m_trayIcon.ShowBalloonTip(_timeout, _title, _text, _icon); }
/// <summary> /// Show a notification balloon. /// </summary> public void showBalloon(String _title, String _text, ToolTipIcon _icon) { showBalloon(3, _title, _text, _icon); }
public static void Draw(IDeviceContext dc, Size minSize, Size maxSize, string title, string text, Rectangle titleRect, Rectangle rect, ToolTipIcon icon, Padding padding) { if (Application.RenderWithVisualStyles) { VisualStyleRenderer titleRenderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.BalloonTitle.Normal); VisualStyleRenderer balloonRenderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Balloon.Normal); balloonRenderer.DrawBackground(dc, rect); if (icon == ToolTipIcon.None) { titleRenderer.DrawText(dc, new Rectangle(padding.Left, padding.Top, rect.Width - (padding.Left + padding.Right), titleRect.Height), title, false, TextFormatFlags.Left | TextFormatFlags.WordEllipsis | TextFormatFlags.VerticalCenter); Rectangle balloonTextBounds = new Rectangle(padding.Left, padding.Top + titleRect.Height, rect.Width - (padding.Left + padding.Right), rect.Height - (padding.Top + titleRect.Height + padding.Bottom)); balloonRenderer.DrawText(dc, balloonTextBounds, text, false, TextFormatFlags.Left | TextFormatFlags.WordBreak | TextFormatFlags.VerticalCenter); } else { throw new NotImplementedException(); } } else { throw new NotImplementedException(); } }