重构项目,将项目拆分(临时提交)
This commit is contained in:
126
DMS.WPF/Views/MainView.xaml
Normal file
126
DMS.WPF/Views/MainView.xaml
Normal file
@@ -0,0 +1,126 @@
|
||||
<Window x:Class="DMS.Views.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
||||
xmlns:local="clr-namespace:DMS.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:DMS.ViewModels"
|
||||
xmlns:mo="clr-namespace:DMS.Models"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:tb="http://hardcodet.net/taskbar"
|
||||
xmlns:taskbarNotification="http://www.hardcodet.net/taskbar"
|
||||
Title="设备管理系统"
|
||||
Width="1080"
|
||||
Height="800"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
WindowState="Maximized"
|
||||
Loaded="MainView_OnLoaded"
|
||||
Closing="Window_Closing"
|
||||
ui:WindowHelper.UseModernWindowStyle="True"
|
||||
ui:WindowHelper.SystemBackdropType="Mica"
|
||||
d:DataContext="{d:DesignInstance vm:MainViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
|
||||
<ContextMenu x:Key="MyMenuItemContextMenu">
|
||||
<MenuItem Header="添加" />
|
||||
<MenuItem Header="编辑" />
|
||||
<Separator />
|
||||
<MenuItem Header="删除" />
|
||||
</ContextMenu>
|
||||
<DataTemplate x:Key="NavigationViewMenuItem"
|
||||
DataType="{x:Type mo:MenuBean}">
|
||||
<ui:NavigationViewItem Content="{Binding Name}"
|
||||
MenuItemsSource="{Binding Items }">
|
||||
<ui:NavigationViewItem.Icon>
|
||||
<ui:FontIcon Glyph="{Binding Icon}" />
|
||||
</ui:NavigationViewItem.Icon>
|
||||
</ui:NavigationViewItem>
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<taskbarNotification:TaskbarIcon x:Name="MyNotifyIcon"
|
||||
ToolTipText="设备管理系统"
|
||||
IconSource="/AppIcon2.ico"
|
||||
DoubleClickCommand="{Binding ShowWindowCommand}">
|
||||
<taskbarNotification:TaskbarIcon.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="显示窗口" Command="{Binding ShowWindowCommand}" />
|
||||
<MenuItem Header="退出" Command="{Binding ExitApplicationCommand}" />
|
||||
</ContextMenu>
|
||||
</taskbarNotification:TaskbarIcon.ContextMenu>
|
||||
</taskbarNotification:TaskbarIcon>
|
||||
<ui:NavigationView ExpandedModeThresholdWidth="500"
|
||||
IsTabStop="False"
|
||||
PaneDisplayMode="Left"
|
||||
PaneTitle="设备管理系统"
|
||||
IsSettingsVisible="False"
|
||||
AlwaysShowHeader="True"
|
||||
IsBackButtonVisible="Collapsed"
|
||||
IsBackEnabled="False"
|
||||
SelectionFollowsFocus="Disabled"
|
||||
MenuItemsSource="{Binding Menus}"
|
||||
MenuItemTemplate="{StaticResource NavigationViewMenuItem}"
|
||||
SelectionChanged="NavigationView_SelectionChanged">
|
||||
|
||||
|
||||
<ui:NavigationView.AutoSuggestBox>
|
||||
<ui:AutoSuggestBox AutomationProperties.Name="Search">
|
||||
<ui:AutoSuggestBox.QueryIcon>
|
||||
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Search}" />
|
||||
</ui:AutoSuggestBox.QueryIcon>
|
||||
</ui:AutoSuggestBox>
|
||||
</ui:NavigationView.AutoSuggestBox>
|
||||
|
||||
|
||||
<Grid>
|
||||
<!-- 数据模版绑定不同的View显示 -->
|
||||
<ContentControl Content="{Binding CurrentViewModel}">
|
||||
<ContentControl.Resources>
|
||||
<!-- 主页 -->
|
||||
<DataTemplate DataType="{x:Type vm:HomeViewModel}">
|
||||
<local:HomeView />
|
||||
</DataTemplate>
|
||||
<!-- 设备列表页 -->
|
||||
<DataTemplate DataType="{x:Type vm:DevicesViewModel}">
|
||||
<local:DevicesView />
|
||||
</DataTemplate>
|
||||
<!-- 数据转换页 -->
|
||||
<DataTemplate DataType="{x:Type vm:DataTransformViewModel}">
|
||||
<local:DataTransformView />
|
||||
</DataTemplate>
|
||||
<!-- Mqtt服务器页 -->
|
||||
<DataTemplate DataType="{x:Type vm:MqttsViewModel}">
|
||||
<local:MqttsView />
|
||||
</DataTemplate>
|
||||
<!-- 设置页 -->
|
||||
<DataTemplate DataType="{x:Type vm:SettingViewModel}">
|
||||
<local:SettingView />
|
||||
</DataTemplate>
|
||||
<!-- 设备详情页 -->
|
||||
<DataTemplate DataType="{x:Type vm:DeviceDetailViewModel}">
|
||||
<local:DeviceDetailView />
|
||||
</DataTemplate>
|
||||
<!-- 设备变量页 -->
|
||||
<DataTemplate DataType="{x:Type vm:VariableTableViewModel}">
|
||||
<local:VariableTableView DataContext="{Binding }"/>
|
||||
</DataTemplate>
|
||||
<!-- Mqtt服务器详情页 -->
|
||||
<DataTemplate DataType="{x:Type vm:MqttServerDetailViewModel}">
|
||||
<local:MqttServerDetailView DataContext="{Binding }"/>
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Hidden"
|
||||
HorizontalAlignment="Right">
|
||||
<StackPanel hc:Growl.GrowlParent="True"
|
||||
VerticalAlignment="Top"
|
||||
Margin="0,10,10,10" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
</ui:NavigationView>
|
||||
</Grid>
|
||||
</Window>
|
||||
Reference in New Issue
Block a user