Skip to content

Commit 2733d0c

Browse files
committed
feat: ✨ Add notifyicon
* The app can now run in background * Icon is added to resource (Generated by AI)
1 parent 939d554 commit 2733d0c

File tree

9 files changed

+102
-4
lines changed

9 files changed

+102
-4
lines changed

AI.NET/AI.NET.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<UseWPF>true</UseWPF>
9+
<ApplicationIcon>Resources\Icons\icon.ico</ApplicationIcon>
910
</PropertyGroup>
1011

1112
<ItemGroup>
1213
<None Remove="Logger\Log4Net.config" />
1314
<None Remove="Resources\Icons\file-plus.svg" />
15+
<None Remove="Resources\Icons\icon.ico" />
16+
<None Remove="Resources\Icons\icon.svg" />
1417
<None Remove="Resources\Icons\send.svg" />
1518
<None Remove="Resources\Icons\terminal.svg" />
1619
<None Remove="Resources\Icons\trash.svg" />
@@ -35,6 +38,8 @@
3538

3639
<ItemGroup>
3740
<Resource Include="Resources\Icons\file-plus.svg" />
41+
<Resource Include="Resources\Icons\icon.ico" />
42+
<Resource Include="Resources\Icons\icon.svg" />
3843
<Resource Include="Resources\Icons\info.svg" />
3944
<Resource Include="Resources\Icons\send.svg" />
4045
<Resource Include="Resources\Icons\settings.svg">

AI.NET/Resources/Icons/icon.ico

209 KB
Binary file not shown.

AI.NET/Resources/Icons/icon.svg

Lines changed: 23 additions & 0 deletions
Loading

AI.NET/Resources/Strings/Strings.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AI.NET/Resources/Strings/Strings.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,10 @@
177177
<data name="InfoReadmeUpdating" xml:space="preserve">
178178
<value>Updating README.md...</value>
179179
</data>
180+
<data name="Exit" xml:space="preserve">
181+
<value>Exit</value>
182+
</data>
183+
<data name="Show" xml:space="preserve">
184+
<value>Show</value>
185+
</data>
180186
</root>

AI.NET/Resources/Strings/Strings.zh-CHS.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,10 @@
177177
<data name="InfoReadmeUpdating" xml:space="preserve">
178178
<value>正在更新项目 README...</value>
179179
</data>
180+
<data name="Exit" xml:space="preserve">
181+
<value>退出</value>
182+
</data>
183+
<data name="Show" xml:space="preserve">
184+
<value>显示</value>
185+
</data>
180186
</root>

AI.NET/Resources/Strings/Strings.zh-CN.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,10 @@
177177
<data name="InfoReadmeUpdating" xml:space="preserve">
178178
<value>正在更新项目 README...</value>
179179
</data>
180+
<data name="Exit" xml:space="preserve">
181+
<value>退出</value>
182+
</data>
183+
<data name="Show" xml:space="preserve">
184+
<value>显示</value>
185+
</data>
180186
</root>

AI.NET/Windows/MainWindow.xaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
1212
xmlns:strings="clr-namespace:AI.NET.Resources.Strings"
1313
mc:Ignorable="d"
14+
Icon="/Resources/Icons/icon.ico"
1415
Activated="Window_Activated" Closing="Window_Closing"
1516
Title="AI.NET" Height="500" Width="900" KeyDown="Window_KeyDown">
1617
<Grid>
@@ -80,6 +81,20 @@
8081
</DataTemplate>
8182
</ListBox.ItemTemplate>
8283
</ListBox>
84+
<hc:NotifyIcon x:Name="icon">
85+
<hc:NotifyIcon.Icon>
86+
<BitmapImage UriSource="/Resources/Icons/icon.ico"/>
87+
</hc:NotifyIcon.Icon>
88+
<hc:NotifyIcon.ContextMenu>
89+
<ContextMenu>
90+
<MenuItem Header="{x:Static strings:Strings.About}" Click="AboutButton_Click"/>
91+
<MenuItem Header="{x:Static strings:Strings.Setting}" Click="SettingButton_Click"/>
92+
<MenuItem Header="{x:Static strings:Strings.SystemPrompt}" Click="SystemPromptButton_Click"/>
93+
<MenuItem Header="{x:Static strings:Strings.Show}" Click="ShowMenuItem_Click"/>
94+
<MenuItem Header="{x:Static strings:Strings.Exit}" Click="ExitMenuItem_Click"/>
95+
</ContextMenu>
96+
</hc:NotifyIcon.ContextMenu>
97+
</hc:NotifyIcon>
8398
</Grid>
8499
</Grid>
85100
</hc:Window>

0 commit comments

Comments
 (0)