在 `App.xaml` 中更新资源字典,添加 `MaterialTrayMenuItem.xaml` 以支持托盘菜单样式。 在 `MainWindow.xaml` 中添加 `Closed` 和 `Loaded` 事件处理程序。 在 `MainWindow.xaml.cs` 中引入 `TrayIconManager`,管理系统托盘图标及其行为。 更新 `chatclient.csproj` 中 `chat.ico` 的属性以确保复制到输出目录。 在 `MaterialTrayMenuItem.xaml` 中定义 Material Design 风格的托盘菜单项和上下文菜单样式。 创建 `TrayIconManager.cs` 类以优化托盘图标的创建和事件处理,提升用户体验。
20 lines
1.4 KiB
XML
20 lines
1.4 KiB
XML
<Application x:Class="chatclient.App"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
xmlns:local="clr-namespace:chatclient"
|
|
StartupUri="MainWindow.xaml">
|
|
<Application.Resources>
|
|
<ResourceDictionary>
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<materialDesign:BundledTheme BaseTheme="Light" PrimaryColor="DeepPurple" SecondaryColor="Lime" />
|
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" />
|
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
|
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign2.Defaults.xaml" />
|
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
|
|
<ResourceDictionary Source="pack://application:,,,/chatclient;component/Data/MaterialTrayMenuItem.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
</ResourceDictionary>
|
|
</Application.Resources>
|
|
</Application>
|