增加打开窗体 在底部通知栏显示相应的图标
|
|
@ -5,9 +5,10 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
|
||||
xmlns:local="clr-namespace:WpfApp.src.components"
|
||||
|
||||
mc:Ignorable="d"
|
||||
Title="MainWindow" Height="800" Width="1200">
|
||||
Title="MainWindow" Height="800" Width="1200"
|
||||
Icon="/src/public/Icons/programIcons/FMSDGAUGE-main.ico"
|
||||
>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
|
|
|
|||
|
|
@ -85,32 +85,32 @@ public partial class MainWindow : Window
|
|||
|
||||
private void OnFilePageButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowHelper.ShowPageDialog(new FilePage(), "记录列表", 810, 600);
|
||||
WindowHelper.ShowPageDialog(new FilePage(), "记录列表", 810, 600,isResizable: false, "..\\..\\..\\src\\public\\Icons\\programIcons\\main1-File.ico");
|
||||
}
|
||||
|
||||
private void OnConfigPageButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowHelper.ShowPageDialog(new ConfigPage(), "配置", 972, 648);
|
||||
WindowHelper.ShowPageDialog(new ConfigPage(), "配置", 972, 648, isResizable: false, "..\\..\\..\\src\\public\\Icons\\programIcons\\main2-Config.ico");
|
||||
}
|
||||
|
||||
private void OnStandardPageButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowHelper.ShowPageDialog(new StandardPage(), "主标定", 972, 648, isResizable: true);
|
||||
WindowHelper.ShowPageDialog(new StandardPage(), "主标定", 972, 648, isResizable: true, "..\\..\\..\\src\\public\\Icons\\programIcons\\main3-Standard.ico");
|
||||
}
|
||||
|
||||
private void OnGaugePageButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowHelper.ShowPageDialog(new GaugePage(), "Gauge R&&R", 1080, 720);
|
||||
WindowHelper.ShowPageDialog(new GaugePage(), "Gauge R&&R", 1080, 720, isResizable:false, "..\\..\\..\\src\\public\\Icons\\programIcons\\main4-Gauge.ico");
|
||||
}
|
||||
|
||||
private void OnCgCgkPageButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowHelper.ShowPageDialog(new CgCgkPage(), "CgCgk", 972, 648, isResizable: true);
|
||||
WindowHelper.ShowPageDialog(new CgCgkPage(), "CgCgk", 972, 648, isResizable: true, "..\\..\\..\\src\\public\\Icons\\programIcons\\main5-CgCgk.ico");
|
||||
}
|
||||
|
||||
private void OnSysSetPageButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
WindowHelper.ShowPageDialog(new SysSetPage(), "系统设置", 810, 600);
|
||||
WindowHelper.ShowPageDialog(new SysSetPage(), "系统设置", 810, 600, isResizable:false, "..\\..\\..\\src\\public\\Icons\\programIcons\\main6-SysSet.ico");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
using System.Windows;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace WpfApp.Utils;
|
||||
|
||||
namespace WpfApp.Utils
|
||||
{
|
||||
public static class WindowHelper
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -14,7 +16,8 @@ public static class WindowHelper
|
|||
/// <param name="width">窗口宽度</param>
|
||||
/// <param name="height">窗口高度</param>
|
||||
/// <param name="isResizable">是否允许调整大小</param>
|
||||
public static void ShowPageDialog(Page page, string title, double width = 900, double height = 600, bool isResizable = false)
|
||||
/// <param name="iconPath">可选图标路径,如果为空使用默认图标</param>
|
||||
public static void ShowPageDialog(Page page, string title, double width = 900, double height = 600, bool isResizable = false, string iconPath = null)
|
||||
{
|
||||
var navWin = new NavigationWindow
|
||||
{
|
||||
|
|
@ -28,7 +31,23 @@ public static class WindowHelper
|
|||
Owner = Application.Current.MainWindow,
|
||||
ResizeMode = isResizable ? ResizeMode.CanResize : ResizeMode.NoResize
|
||||
};
|
||||
string defaultIconPath = null;
|
||||
if (iconPath == null)
|
||||
defaultIconPath = @"..\..\..\src\public\Icons\programIcons\FMSDGAUGE-main.ico";
|
||||
else
|
||||
defaultIconPath = iconPath;
|
||||
|
||||
try
|
||||
{
|
||||
navWin.Icon = new BitmapImage(new Uri(System.IO.Path.GetFullPath(defaultIconPath), UriKind.Absolute));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"设置图标失败: {ex.Message}");
|
||||
}
|
||||
|
||||
|
||||
navWin.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,15 @@
|
|||
<None Remove="src\public\Icons\main6-cgCgk-icon.png" />
|
||||
<None Remove="src\public\Icons\main7-sysSet-icon.png" />
|
||||
<None Remove="src\public\Icons\main8-exit-icon.png" />
|
||||
<None Remove="src\public\Icons\programIcons\CgCgk.png" />
|
||||
<None Remove="src\public\Icons\programIcons\FMSDGAUGE-main.ico" />
|
||||
<None Remove="src\public\Icons\programIcons\FMSDGAUGE.png" />
|
||||
<None Remove="src\public\Icons\programIcons\main1-File.ico" />
|
||||
<None Remove="src\public\Icons\programIcons\main2-Config.ico" />
|
||||
<None Remove="src\public\Icons\programIcons\main3-Standard.ico" />
|
||||
<None Remove="src\public\Icons\programIcons\main4-Gauge.ico" />
|
||||
<None Remove="src\public\Icons\programIcons\main5-CgCgk.ico" />
|
||||
<None Remove="src\public\Icons\programIcons\main6-SysSet.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -31,6 +40,13 @@
|
|||
<Resource Include="src\public\Icons\main5-gauge-icon.png" />
|
||||
<Resource Include="src\public\Icons\main7-sysSet-icon.png" />
|
||||
<Resource Include="src\public\Icons\main8-exit-icon.png" />
|
||||
<Resource Include="src\public\Icons\programIcons\FMSDGAUGE-main.ico" />
|
||||
<Resource Include="src\public\Icons\programIcons\main1-File.ico" />
|
||||
<Resource Include="src\public\Icons\programIcons\main2-Config.ico" />
|
||||
<Resource Include="src\public\Icons\programIcons\main3-Standard.ico" />
|
||||
<Resource Include="src\public\Icons\programIcons\main4-Gauge.ico" />
|
||||
<Resource Include="src\public\Icons\programIcons\main5-CgCgk.ico" />
|
||||
<Resource Include="src\public\Icons\programIcons\main6-SysSet.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
BIN
src/public/Icons/programIcons/FMSDGAUGE-main.ico
Normal file
|
After Width: | Height: | Size: 102 KiB |
BIN
src/public/Icons/programIcons/main1-File.ico
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
src/public/Icons/programIcons/main2-Config.ico
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
src/public/Icons/programIcons/main3-Standard.ico
Normal file
|
After Width: | Height: | Size: 104 KiB |
BIN
src/public/Icons/programIcons/main4-Gauge.ico
Normal file
|
After Width: | Height: | Size: 100 KiB |
BIN
src/public/Icons/programIcons/main5-CgCgk.ico
Normal file
|
After Width: | Height: | Size: 101 KiB |
BIN
src/public/Icons/programIcons/main6-SysSet.ico
Normal file
|
After Width: | Height: | Size: 103 KiB |
|
|
@ -7,7 +7,8 @@
|
|||
xmlns:local="clr-namespace:WpfApp.src.view"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800"
|
||||
Title="CgCgkPage">
|
||||
Title="CgCgkPage"
|
||||
>
|
||||
|
||||
<Grid x:Name="MainGrid">
|
||||
<Grid.RowDefinitions>
|
||||
|
|
|
|||