Create popup “toaster” notifications in Windows with .NET

后端 未结 6 1147
清歌不尽
清歌不尽 2020-12-02 04:12

I am using .NET and am creating a desktop app/service that will display notifications in the corner of my Desktop when certain events are triggered. I don\'t want to use a r

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 04:37

    NotifyIcon notifyIcon = new NotifyIcon();
    Stream iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/Assets/ic_instant_note_tray.ico")).Stream;
    notifyIcon.Icon = new System.Drawing.Icon(iconStream);
    notifyIcon.Text = string.Format(Properties.Resources.InstantNoteAppName, Constants.Application_Name);
    notifyIcon.Visible = true;
    notifyIcon.ShowBalloonTip(5000, "tooltiptitle", "tipMessage", ToolTipIcon.Info);
    notifyIcon.Visible = false;
    notifyIcon.Dispose();
    

提交回复
热议问题