Giter Club home page Giter Club logo

notifyicon's Introduction

NotifyIcon

在通知区域创建图标的组件。

包引用方式(二选一)

  1. 运行时自动匹配平台实现 NuGet version (NotifyIcon)
    • Install-Package NotifyIcon
  2. 仅单个平台实现
    • Windows NuGet version (NotifyIcon.Windows)
      • Install-Package NotifyIcon.Windows
    • Linux NuGet version (NotifyIcon.Linux)
      • Install-Package NotifyIcon.Linux
    • macOS NuGet version (NotifyIcon.Mac)
      • Install-Package NotifyIcon.Mac

平台支持与目标框架

  • Windows
    • .NET Framework 3.5 ~ 4.8+
    • .NET Core 2.0+
    • .NET 5+
    • .NET Standard 2.0+
  • Linux
    • .NET Framework 4.6.1+ / Mono 5.4+
    • .NET Core 2.0+
    • .NET 5+
    • .NET Standard 2.0+
  • macOS
    • .NET Framework 4.6.1+ / Mono 5.4+
    • .NET Core 2.0+
    • .NET 5+
    • .NET Standard 2.0+

使用方式

  1. 直接使用
    • NotifyIcon notifyIcon = NotifyIcon.Create();
  2. 通过 Microsoft.Extensions.DependencyInjection 使用
    • 添加到依赖注入服务中
      • services.AddSingleton(typeof(NotifyIcon), NotifyIcon.ImplType);

添加右键菜单项

notifyIcon.ContextMenuStrip.Items.Add(new ContextMenuStrip.MenuItem() { Text = "Menu Text 01", Command = ReactiveCommand.Create(() =>
{
    // ...
})});

示例项目

Platform ProjectFileName
NotifyIcon for WPF Samples.WpfApp1.csproj
NotifyIcon for Console Samples.ConsoleApp1.csproj
NotifyIcon for Avalonia Samples.AvaloniaApp1.csproj
NotifyIcon for WinUI3 Samples.WinUI3App1.csproj
NotifyIcon for MAUI Samples.MauiApp1.csproj

notifyicon's People

Contributors

aigiol avatar rmbadmin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

notifyicon's Issues

windows平台使用抛出 “方法没有实现”异常

        public static void Main(string[] args)
        {
            NotifyIcon notifyIcon = NotifyIcon.Create();
            notifyIcon.Visible = true;
            BuildAvaloniaApp()
                .StartWithClassicDesktopLifetime(args);
        }

异常:

Unhandled exception. System.NotImplementedException: The method or operation is not implemented.
   at System.Windows.NotifyIcon.GetImplType()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at System.Windows.NotifyIcon.get_Type()
   at System.Windows.NotifyIcon.Create()
   at Todo.Program.Main(String[] args) in D:\Source\Todo\Todo\Program.cs:line 16

依赖:
image

希望能增加子级菜单和菜单分割线

希望能增加子级菜单和菜单分割线
通过winui3的使用用例,目前仅能简单的创建菜单,但目前没有看见添加多级菜单和分割线的用例,未来能否完善一下呢?
同时希望未来创建菜单时可以直接通过xaml前端快速创建,绑定使用命令

在 Windows 平台下应用会不定时闪退

我使用的是 WinUI 3 UI 库来制作的应用程序。在我生成并运行后,应用程序正常运行。但是在过了几秒之后,应用程序闪退,没有捕获到异常,应用程序的输出也没有提示任何异常。我已经尝试在各大搜索平台上寻找 WinUI 3 下的托盘库,但是不是报错就是闪退。
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.