1 feat(navigation): 统一添加返回按钮并调整导航宽度
2 3 - 为VariableTableView和DeviceDetailView添加返回上级页面的按钮 4 - 将VariableHistoryView的返回按钮改为图标样式,保持一致性 5 - 调整MainView中NavigationView的展开宽度,从500减小到200 6 - 清理未使用的命名空间引用
This commit is contained in:
@@ -12,6 +12,7 @@ using DMS.WPF.Interfaces;
|
|||||||
using DMS.WPF.ViewModels.Dialogs;
|
using DMS.WPF.ViewModels.Dialogs;
|
||||||
using DMS.WPF.ViewModels.Items;
|
using DMS.WPF.ViewModels.Items;
|
||||||
using iNKORE.UI.WPF.Modern.Common.IconKeys;
|
using iNKORE.UI.WPF.Modern.Common.IconKeys;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace DMS.WPF.ViewModels;
|
namespace DMS.WPF.ViewModels;
|
||||||
|
|
||||||
@@ -209,4 +210,22 @@ public partial class DeviceDetailViewModel : ViewModelBase
|
|||||||
new NavigationParameter(nameof(VariableTableViewModel), SelectedVariableTable.Id,
|
new NavigationParameter(nameof(VariableTableViewModel), SelectedVariableTable.Id,
|
||||||
NavigationType.VariableTable));
|
NavigationType.VariableTable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回到设备列表页命令
|
||||||
|
/// </summary>
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task NavigateToDevicesList()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 导航到设备列表页面
|
||||||
|
var navigationService = App.Current.Services.GetRequiredService<INavigationService>();
|
||||||
|
await navigationService.NavigateToAsync(this, new NavigationParameter(nameof(DevicesViewModel), 0, NavigationType.Device));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_notificationService.ShowError($"导航到设备列表失败: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -744,6 +744,24 @@ partial class VariableTableViewModel : ViewModelBase, INavigatable
|
|||||||
new NavigationParameter(nameof(VariableHistoryViewModel), SelectedVariable.Id, NavigationType.Variable));
|
new NavigationParameter(nameof(VariableHistoryViewModel), SelectedVariable.Id, NavigationType.Variable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回到设备详情页命令
|
||||||
|
/// </summary>
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task NavigateToDeviceDetail()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 导航到设备详情页面
|
||||||
|
var navigationService = App.Current.Services.GetRequiredService<INavigationService>();
|
||||||
|
await navigationService.NavigateToAsync(this, new NavigationParameter(nameof(DeviceDetailViewModel), CurrentVariableTable.DeviceId, NavigationType.Device));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_notificationService.ShowError($"导航到设备详情失败: {ex.Message}", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改选定变量的历史记录设置。
|
/// 修改选定变量的历史记录设置。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -73,25 +73,49 @@
|
|||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<ikw:SimpleStackPanel Spacing="10">
|
<ikw:SimpleStackPanel Spacing="10">
|
||||||
<!-- Command Bar for Variable Tables -->
|
<Border Margin="10" Padding="5">
|
||||||
<ui:CommandBar Grid.Row="1" DefaultLabelPosition="Right" IsOpen="False" VerticalAlignment="Top">
|
|
||||||
<ui:AppBarButton Command="{Binding AddVariableTableCommand}" Label="添加变量表">
|
<Grid>
|
||||||
<ui:AppBarButton.Icon>
|
<Grid.ColumnDefinitions>
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Add}" />
|
<ColumnDefinition Width="Auto"/>
|
||||||
</ui:AppBarButton.Icon>
|
<ColumnDefinition Width="*"/>
|
||||||
</ui:AppBarButton>
|
</Grid.ColumnDefinitions>
|
||||||
<ui:AppBarButton Command="{Binding EditVariableTableCommand}" Label="编辑变量表">
|
|
||||||
<ui:AppBarButton.Icon>
|
<!-- 返回设备列表按钮 -->
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}" />
|
<Button Grid.Column="0"
|
||||||
</ui:AppBarButton.Icon>
|
Command="{Binding NavigateToDevicesListCommand}"
|
||||||
</ui:AppBarButton>
|
Style="{StaticResource ButtonDefault}"
|
||||||
<ui:AppBarButton Command="{Binding DeleteVariableTableCommand}" Label="删除变量表">
|
ToolTip="返回设备列表"
|
||||||
<ui:AppBarButton.Icon>
|
Margin="0,0,10,0">
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Delete}" />
|
<Button.Content>
|
||||||
</ui:AppBarButton.Icon>
|
<StackPanel Orientation="Horizontal">
|
||||||
</ui:AppBarButton>
|
<ui:FontIcon
|
||||||
<!-- Add more variable table-specific commands here if needed -->
|
Icon="{x:Static ui:SegoeFluentIcons.ArrowLeft8}" />
|
||||||
</ui:CommandBar>
|
</StackPanel>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- Command Bar for Variable Tables -->
|
||||||
|
<ui:CommandBar Grid.Column="1" DefaultLabelPosition="Right" IsOpen="False" VerticalAlignment="Top">
|
||||||
|
<ui:AppBarButton Command="{Binding AddVariableTableCommand}" Label="添加变量表">
|
||||||
|
<ui:AppBarButton.Icon>
|
||||||
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Add}" />
|
||||||
|
</ui:AppBarButton.Icon>
|
||||||
|
</ui:AppBarButton>
|
||||||
|
<ui:AppBarButton Command="{Binding EditVariableTableCommand}" Label="编辑变量表">
|
||||||
|
<ui:AppBarButton.Icon>
|
||||||
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Edit}" />
|
||||||
|
</ui:AppBarButton.Icon>
|
||||||
|
</ui:AppBarButton>
|
||||||
|
<ui:AppBarButton Command="{Binding DeleteVariableTableCommand}" Label="删除变量表">
|
||||||
|
<ui:AppBarButton.Icon>
|
||||||
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Delete}" />
|
||||||
|
</ui:AppBarButton.Icon>
|
||||||
|
</ui:AppBarButton>
|
||||||
|
<!-- Add more variable table-specific commands here if needed -->
|
||||||
|
</ui:CommandBar>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<!-- Device Details Section -->
|
<!-- Device Details Section -->
|
||||||
<StackPanel Grid.Row="0" Margin="10">
|
<StackPanel Grid.Row="0" Margin="10">
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:mo="clr-namespace:DMS.Core.Models;assembly=DMS.Core"
|
xmlns:mo="clr-namespace:DMS.Core.Models;assembly=DMS.Core"
|
||||||
xmlns:taskbarNotification="http://www.hardcodet.net/taskbar"
|
xmlns:taskbarNotification="http://www.hardcodet.net/taskbar"
|
||||||
xmlns:tb="http://hardcodet.net/taskbar"
|
|
||||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||||
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
xmlns:vm="clr-namespace:DMS.WPF.ViewModels"
|
||||||
Title="设备管理系统"
|
Title="设备管理系统"
|
||||||
@@ -57,7 +56,7 @@
|
|||||||
</taskbarNotification:TaskbarIcon>
|
</taskbarNotification:TaskbarIcon>
|
||||||
<ui:NavigationView
|
<ui:NavigationView
|
||||||
AlwaysShowHeader="True"
|
AlwaysShowHeader="True"
|
||||||
ExpandedModeThresholdWidth="500"
|
ExpandedModeThresholdWidth="200"
|
||||||
IsBackButtonVisible="Collapsed"
|
IsBackButtonVisible="Collapsed"
|
||||||
IsBackEnabled="False"
|
IsBackEnabled="False"
|
||||||
IsSettingsVisible="False"
|
IsSettingsVisible="False"
|
||||||
|
|||||||
@@ -34,14 +34,7 @@
|
|||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<Border DockPanel.Dock="Top" Background="White" BorderBrush="#E0E0E0" BorderThickness="1" CornerRadius="8"
|
<Border DockPanel.Dock="Top" Margin="20,10" Padding="15">
|
||||||
Margin="20,10" Padding="15">
|
|
||||||
<Border.Effect>
|
|
||||||
<DropShadowEffect ShadowDepth="2"
|
|
||||||
BlurRadius="5"
|
|
||||||
Opacity="0.1"
|
|
||||||
Color="#888888"/>
|
|
||||||
</Border.Effect>
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -51,10 +44,17 @@
|
|||||||
|
|
||||||
<!-- 返回变量表按钮 -->
|
<!-- 返回变量表按钮 -->
|
||||||
<Button Grid.Column="0"
|
<Button Grid.Column="0"
|
||||||
Content="返回变量表"
|
|
||||||
Command="{Binding NavigateToVariableTableCommand}"
|
Command="{Binding NavigateToVariableTableCommand}"
|
||||||
Style="{StaticResource ButtonPrimary}"
|
Style="{StaticResource ButtonDefault}"
|
||||||
Margin="0,0,10,0"/>
|
ToolTip="返回变量表"
|
||||||
|
Margin="0,0,10,0">
|
||||||
|
<Button.Content>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ui:FontIcon
|
||||||
|
Icon="{x:Static ui:SegoeFluentIcons.ArrowLeft8}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<!-- 操作菜单栏 -->
|
<!-- 操作菜单栏 -->
|
||||||
<ui:CommandBar Grid.Column="1"
|
<ui:CommandBar Grid.Column="1"
|
||||||
|
|||||||
@@ -41,12 +41,32 @@
|
|||||||
|
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
|
|
||||||
<ikw:SimpleStackPanel Margin="10" DockPanel.Dock="Top">
|
<ikw:SimpleStackPanel DockPanel.Dock="Top" Margin="10" >
|
||||||
<!-- 操作菜单 -->
|
<Grid >
|
||||||
<controls:CommandBar
|
<Grid.ColumnDefinitions>
|
||||||
x:Name="PrimaryCommandBar"
|
<ColumnDefinition Width="Auto"/>
|
||||||
DefaultLabelPosition="Right"
|
<ColumnDefinition Width="*"/>
|
||||||
IsOpen="False">
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<!-- 返回设备详情按钮 -->
|
||||||
|
<Button Grid.Column="0"
|
||||||
|
Command="{Binding NavigateToDeviceDetailCommand}"
|
||||||
|
Style="{StaticResource ButtonDefault}"
|
||||||
|
ToolTip="返回设备详情"
|
||||||
|
Margin="0,0,10,0">
|
||||||
|
<Button.Content>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<ui:FontIcon
|
||||||
|
Icon="{x:Static ui:SegoeFluentIcons.ArrowLeft8}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<!-- 操作菜单 -->
|
||||||
|
<controls:CommandBar Grid.Column="1"
|
||||||
|
x:Name="PrimaryCommandBar"
|
||||||
|
DefaultLabelPosition="Right"
|
||||||
|
IsOpen="False">
|
||||||
<ui:AppBarButton Command="{Binding AddVariableCommand}" Label="添加变量">
|
<ui:AppBarButton Command="{Binding AddVariableCommand}" Label="添加变量">
|
||||||
<ui:AppBarButton.Icon>
|
<ui:AppBarButton.Icon>
|
||||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Add}" />
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Add}" />
|
||||||
@@ -98,7 +118,8 @@
|
|||||||
Label="Settings" />
|
Label="Settings" />
|
||||||
</ui:CommandBar.SecondaryCommands>
|
</ui:CommandBar.SecondaryCommands>
|
||||||
|
|
||||||
</controls:CommandBar>
|
</controls:CommandBar>
|
||||||
|
</Grid>
|
||||||
<!-- 变量表的名称描述等信息 -->
|
<!-- 变量表的名称描述等信息 -->
|
||||||
<ikw:SimpleStackPanel
|
<ikw:SimpleStackPanel
|
||||||
Margin="5"
|
Margin="5"
|
||||||
@@ -129,7 +150,6 @@
|
|||||||
|
|
||||||
|
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
|
|
||||||
<DataGrid
|
<DataGrid
|
||||||
x:Name="BasicGridView"
|
x:Name="BasicGridView"
|
||||||
Margin="10"
|
Margin="10"
|
||||||
|
|||||||
Reference in New Issue
Block a user