feat(navigation): 重构导航系统引入导航参数和类型
- 新增NavigationType枚举定义导航类型 - 新增NavigationParameter类用于传递导航参数 - 重构INavigationService和INavigatable接口 - 更新NavigationService实现以支持新的导航方式 - 更新DeviceDetailViewModel, DevicesViewModel, VariableHistoryViewModel, VariableTableViewModel, MqttsViewModel等 - 使ViewModelBase实现INavigatable接口 - 更新MainView中的菜单选择导航逻辑 - 优化VariableHistoryView界面布局,添加返回变量表按钮
This commit is contained in:
@@ -4,6 +4,8 @@ using DMS.WPF.ViewModels;
|
||||
using iNKORE.UI.WPF.Modern.Controls;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using DMS.Core.Enums;
|
||||
using DMS.Core.Models;
|
||||
using DMS.WPF.Interfaces;
|
||||
using DMS.WPF.ViewModels.Items;
|
||||
|
||||
namespace DMS.WPF.Views;
|
||||
@@ -60,7 +62,24 @@ public partial class MainView : Window
|
||||
var menu = args.SelectedItem as MenuItemViewModel;
|
||||
if (menu != null)
|
||||
{
|
||||
await _viewModel.MenuSelectionChanged(menu);
|
||||
|
||||
NavigationType navigationType = NavigationType.None;
|
||||
switch (menu.MenuType)
|
||||
{
|
||||
case MenuType.DeviceMenu:
|
||||
navigationType=NavigationType.Device;
|
||||
break;
|
||||
case MenuType.VariableTableMenu:
|
||||
navigationType=NavigationType.VariableTable;
|
||||
break;
|
||||
case MenuType.MqttMenu:
|
||||
navigationType=NavigationType.Mqtt;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
var navigationService= App.Current.Services.GetRequiredService<INavigationService>();
|
||||
navigationService.NavigateToAsync(this,new NavigationParameter(menu.TargetViewKey,menu.TargetId,navigationType));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,76 +34,102 @@
|
||||
</UserControl.Resources>
|
||||
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Top">
|
||||
<!-- 操作菜单栏 -->
|
||||
<ui:CommandBar DefaultLabelPosition="Right" IsOpen="False">
|
||||
<!-- 重新加载 -->
|
||||
<ui:AppBarButton Command="{Binding ReloadCommand}" Label="重新加载">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Refresh}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
<ui:AppBarButton x:Name="ExportButton" Label="导出">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Save}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
<ui:AppBarButton x:Name="ShareButton" Label="分享">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Share}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
<ui:CommandBar.SecondaryCommands>
|
||||
<ui:AppBarButton
|
||||
x:Name="SettingsButton"
|
||||
Icon="Setting"
|
||||
Label="设置" />
|
||||
</ui:CommandBar.SecondaryCommands>
|
||||
</ui:CommandBar>
|
||||
<Border DockPanel.Dock="Top" Background="White" BorderBrush="#E0E0E0" BorderThickness="1" CornerRadius="8"
|
||||
Margin="20,10" Padding="15">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="2"
|
||||
BlurRadius="5"
|
||||
Opacity="0.1"
|
||||
Color="#888888"/>
|
||||
</Border.Effect>
|
||||
|
||||
<!-- 时间范围选择器和详细信息区域 -->
|
||||
<Border Background="White"
|
||||
BorderBrush="#E0E0E0"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Margin="20,10"
|
||||
Padding="15">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="2"
|
||||
BlurRadius="5"
|
||||
Opacity="0.1"
|
||||
Color="#888888"/>
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<ikw:SimpleStackPanel Spacing="15">
|
||||
<!-- 时间范围选择 -->
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Text="开始时间:"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="#666666"
|
||||
FontSize="14"/>
|
||||
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding StartTime}" />
|
||||
|
||||
<TextBlock Text="结束时间:"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="#666666"
|
||||
FontSize="14"
|
||||
Margin="10,0,0,0"/>
|
||||
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding EndTime}" />
|
||||
|
||||
<Button Content="重新加载"
|
||||
Command="{Binding ReloadCommand}"
|
||||
Style="{StaticResource ButtonPrimary}"
|
||||
Margin="10,0,0,0"/>
|
||||
</ikw:SimpleStackPanel>
|
||||
<!-- 返回变量表按钮 -->
|
||||
<Button Grid.Column="0"
|
||||
Content="返回变量表"
|
||||
Command="{Binding NavigateToVariableTableCommand}"
|
||||
Style="{StaticResource ButtonPrimary}"
|
||||
Margin="0,0,10,0"/>
|
||||
|
||||
<!-- 操作菜单栏 -->
|
||||
<ui:CommandBar Grid.Column="1"
|
||||
DefaultLabelPosition="Right"
|
||||
IsOpen="False"
|
||||
HorizontalAlignment="Right">
|
||||
<!-- 重新加载 -->
|
||||
<ui:AppBarButton Command="{Binding ReloadCommand}" Label="重新加载">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Refresh}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
|
||||
<ui:AppBarButton x:Name="ExportButton" Label="导出">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Save}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
<ui:AppBarButton x:Name="ShareButton" Label="分享">
|
||||
<ui:AppBarButton.Icon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Share}" />
|
||||
</ui:AppBarButton.Icon>
|
||||
</ui:AppBarButton>
|
||||
|
||||
<ui:CommandBar.SecondaryCommands>
|
||||
<ui:AppBarButton
|
||||
x:Name="SettingsButton"
|
||||
Icon="Setting"
|
||||
Label="设置" />
|
||||
</ui:CommandBar.SecondaryCommands>
|
||||
</ui:CommandBar>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- 时间范围选择器和详细信息区域 -->
|
||||
<Border DockPanel.Dock="Top"
|
||||
Background="White"
|
||||
BorderBrush="#E0E0E0"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
Margin="20,10"
|
||||
Padding="15">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="2"
|
||||
BlurRadius="5"
|
||||
Opacity="0.1"
|
||||
Color="#888888"/>
|
||||
</Border.Effect>
|
||||
|
||||
<ikw:SimpleStackPanel Spacing="15">
|
||||
<!-- 时间范围选择 -->
|
||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||
<TextBlock Text="开始时间:"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="#666666"
|
||||
FontSize="14"/>
|
||||
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding StartTime}" />
|
||||
|
||||
<TextBlock Text="结束时间:"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="#666666"
|
||||
FontSize="14"
|
||||
Margin="10,0,0,0"/>
|
||||
<hc:DateTimePicker Width="200" SelectedDateTime="{Binding EndTime}" />
|
||||
|
||||
<Button Content="重新加载"
|
||||
Command="{Binding ReloadCommand}"
|
||||
Style="{StaticResource ButtonPrimary}"
|
||||
Margin="10,0,0,0"/>
|
||||
</ikw:SimpleStackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</ikw:SimpleStackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- 变量历史记录列表和图表 -->
|
||||
<TabControl Margin="20">
|
||||
|
||||
Reference in New Issue
Block a user