更改了菜单点击导航模式,新增了设备详情页
This commit is contained in:
@@ -54,6 +54,8 @@ public partial class App : Application
|
|||||||
container.AddSingleton<DataTransformViewModel>();
|
container.AddSingleton<DataTransformViewModel>();
|
||||||
container.AddSingleton<VariableTableViewModel>();
|
container.AddSingleton<VariableTableViewModel>();
|
||||||
container.AddSingleton<VariableTableView>();
|
container.AddSingleton<VariableTableView>();
|
||||||
|
container.AddScoped<DeviceDetailViewModel>();
|
||||||
|
container.AddScoped<DeviceDetailView>();
|
||||||
Services = container.BuildServiceProvider();
|
Services = container.BuildServiceProvider();
|
||||||
// 启动服务
|
// 启动服务
|
||||||
Services.GetRequiredService<GrowlNotificationService>();
|
Services.GetRequiredService<GrowlNotificationService>();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using PMSWPF.Enums;
|
using PMSWPF.Enums;
|
||||||
|
using PMSWPF.ViewModels;
|
||||||
|
|
||||||
namespace PMSWPF.Models;
|
namespace PMSWPF.Models;
|
||||||
|
|
||||||
@@ -11,6 +12,8 @@ public class MenuBean
|
|||||||
public int ParentId { get; set; }
|
public int ParentId { get; set; }
|
||||||
public int DataId { get; set; }
|
public int DataId { get; set; }
|
||||||
public MenuType Type { get; set; }
|
public MenuType Type { get; set; }
|
||||||
|
|
||||||
|
public ViewModelBase ViewModel { get; set; }
|
||||||
public Object? Data { get; set; }
|
public Object? Data { get; set; }
|
||||||
public List<MenuBean> Items { get; set; }
|
public List<MenuBean> Items { get; set; }
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PMSWPF.Data.Repositories;
|
using PMSWPF.Data.Repositories;
|
||||||
using PMSWPF.Enums;
|
using PMSWPF.Enums;
|
||||||
@@ -7,6 +8,7 @@ using PMSWPF.Extensions;
|
|||||||
using PMSWPF.Helper;
|
using PMSWPF.Helper;
|
||||||
using PMSWPF.Message;
|
using PMSWPF.Message;
|
||||||
using PMSWPF.Models;
|
using PMSWPF.Models;
|
||||||
|
using PMSWPF.ViewModels;
|
||||||
|
|
||||||
namespace PMSWPF.Services;
|
namespace PMSWPF.Services;
|
||||||
|
|
||||||
@@ -61,13 +63,16 @@ public partial class DataServices : ObservableRecipient, IRecipient<LoadMessage>
|
|||||||
switch (menuBean.Type)
|
switch (menuBean.Type)
|
||||||
{
|
{
|
||||||
case MenuType.MainMenu:
|
case MenuType.MainMenu:
|
||||||
|
menuBean.ViewModel= GetMainViewModel(menuBean.Name);
|
||||||
break;
|
break;
|
||||||
case MenuType.DeviceMenu:
|
case MenuType.DeviceMenu:
|
||||||
|
menuBean.ViewModel = App.Current.Services.GetRequiredService<DeviceDetailViewModel>();
|
||||||
menuBean.Data= Devices.FirstOrDefault(d => d.Id == menuBean.DataId);
|
menuBean.Data= Devices.FirstOrDefault(d => d.Id == menuBean.DataId);
|
||||||
break;
|
break;
|
||||||
case MenuType.VariableTableMenu:
|
case MenuType.VariableTableMenu:
|
||||||
menuBean.Data= FindVarTableForDevice(menuBean.DataId);
|
var varTableVM = App.Current.Services.GetRequiredService<VariableTableViewModel>();
|
||||||
// menuBean.Data= Devices.FirstOrDefault(d => d.Id == menuBean.DataId);
|
varTableVM.VariableTable = FindVarTableForDevice(menuBean.DataId);
|
||||||
|
menuBean.ViewModel = varTableVM;
|
||||||
break;
|
break;
|
||||||
case MenuType.AddVariableTableMenu:
|
case MenuType.AddVariableTableMenu:
|
||||||
break;
|
break;
|
||||||
@@ -79,6 +84,28 @@ public partial class DataServices : ObservableRecipient, IRecipient<LoadMessage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ViewModelBase GetMainViewModel(string name)
|
||||||
|
{
|
||||||
|
ViewModelBase navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "主页":
|
||||||
|
navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
||||||
|
break;
|
||||||
|
case "设备":
|
||||||
|
navgateVM = App.Current.Services.GetRequiredService<DevicesViewModel>();
|
||||||
|
break;
|
||||||
|
case "数据转换":
|
||||||
|
navgateVM = App.Current.Services.GetRequiredService<DataTransformViewModel>();
|
||||||
|
break;
|
||||||
|
case "设置":
|
||||||
|
navgateVM = App.Current.Services.GetRequiredService<SettingViewModel>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return navgateVM;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private VariableTable FindVarTableForDevice(int vtableId)
|
private VariableTable FindVarTableForDevice(int vtableId)
|
||||||
{
|
{
|
||||||
VariableTable varTable = null;
|
VariableTable varTable = null;
|
||||||
|
|||||||
9
ViewModels/DeviceDetailViewModel.cs
Normal file
9
ViewModels/DeviceDetailViewModel.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace PMSWPF.ViewModels;
|
||||||
|
|
||||||
|
public class DeviceDetailViewModel:ViewModelBase
|
||||||
|
{
|
||||||
|
public override void OnLoaded()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
|
using PMSWPF.Models;
|
||||||
|
|
||||||
namespace PMSWPF.ViewModels;
|
namespace PMSWPF.ViewModels;
|
||||||
|
|
||||||
public class VariableTableViewModel : ViewModelBase
|
partial class VariableTableViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
[ObservableProperty]
|
||||||
|
private VariableTable variableTable;
|
||||||
public override void OnLoaded()
|
public override void OnLoaded()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
12
Views/DeviceDetailView.xaml
Normal file
12
Views/DeviceDetailView.xaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<UserControl x:Class="PMSWPF.Views.DeviceDetailView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:PMSWPF.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="DeviceDetail" FontSize="40" HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
14
Views/DeviceDetailView.xaml.cs
Normal file
14
Views/DeviceDetailView.xaml.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Windows.Controls;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using PMSWPF.ViewModels;
|
||||||
|
|
||||||
|
namespace PMSWPF.Views;
|
||||||
|
|
||||||
|
public partial class DeviceDetailView : UserControl
|
||||||
|
{
|
||||||
|
public DeviceDetailView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = App.Current.Services.GetRequiredService<DeviceDetailViewModel>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -76,7 +76,6 @@
|
|||||||
ItemsSource="{Binding Devices}"
|
ItemsSource="{Binding Devices}"
|
||||||
ItemTemplate="{StaticResource DeviceItemTemplate}"
|
ItemTemplate="{StaticResource DeviceItemTemplate}"
|
||||||
SelectionMode="Single" />
|
SelectionMode="Single" />
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -15,9 +15,4 @@ public partial class DevicesView : UserControl
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void DevicesView_OnLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
// var devicesViewModel = (DevicesViewModel)this.DataContext;
|
|
||||||
// await devicesViewModel.OnLoadedAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -40,45 +40,9 @@
|
|||||||
SelectionFollowsFocus="Disabled"
|
SelectionFollowsFocus="Disabled"
|
||||||
MenuItemsSource="{Binding Menus}"
|
MenuItemsSource="{Binding Menus}"
|
||||||
MenuItemTemplate="{StaticResource NavigationViewMenuItem}"
|
MenuItemTemplate="{StaticResource NavigationViewMenuItem}"
|
||||||
ItemInvoked="NavigationView_OnItemInvoked"
|
SelectionChanged="NavigationView_SelectionChanged"
|
||||||
SelectionChanged="NavigationView_OnSelectionChanged"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- <ui:NavigationView.MenuItems> -->
|
|
||||||
<!-- <ui:NavigationViewItem -->
|
|
||||||
<!-- Content="主页" -->
|
|
||||||
<!-- Tag="Home"> -->
|
|
||||||
<!-- <ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Home}" /> -->
|
|
||||||
<!-- </ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- </ui:NavigationViewItem> -->
|
|
||||||
<!-- <ui:NavigationViewItem -->
|
|
||||||
<!-- Content="设备" -->
|
|
||||||
<!-- Tag="Devices"> -->
|
|
||||||
<!-- <ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Devices2}" /> -->
|
|
||||||
<!-- </ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- </ui:NavigationViewItem> -->
|
|
||||||
<!-- <ui:NavigationViewItem -->
|
|
||||||
<!-- Content="数据转换" -->
|
|
||||||
<!-- Tag="DataTransform"> -->
|
|
||||||
<!-- <ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Switch}" /> -->
|
|
||||||
<!-- </ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- </ui:NavigationViewItem> -->
|
|
||||||
<!-- <ui:NavigationViewItem Tag="Setting" Content="设置"> -->
|
|
||||||
<!-- <ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" /> -->
|
|
||||||
<!-- </ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- </ui:NavigationViewItem> -->
|
|
||||||
<!-- <ui:NavigationViewItem Content="关于"> -->
|
|
||||||
<!-- <ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Info}" /> -->
|
|
||||||
<!-- </ui:NavigationViewItem.Icon> -->
|
|
||||||
<!-- </ui:NavigationViewItem> -->
|
|
||||||
<!-- -->
|
|
||||||
<!-- </ui:NavigationView.MenuItems> -->
|
|
||||||
|
|
||||||
<ui:NavigationView.AutoSuggestBox>
|
<ui:NavigationView.AutoSuggestBox>
|
||||||
<ui:AutoSuggestBox AutomationProperties.Name="Search">
|
<ui:AutoSuggestBox AutomationProperties.Name="Search">
|
||||||
<ui:AutoSuggestBox.QueryIcon>
|
<ui:AutoSuggestBox.QueryIcon>
|
||||||
@@ -89,21 +53,33 @@
|
|||||||
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<!-- 数据模版绑定不同的View显示 -->
|
||||||
<ContentControl Content="{Binding CurrentViewModel}">
|
<ContentControl Content="{Binding CurrentViewModel}">
|
||||||
<ContentControl.Resources>
|
<ContentControl.Resources>
|
||||||
|
<!-- 主页 -->
|
||||||
<DataTemplate DataType="{x:Type vm:HomeViewModel}">
|
<DataTemplate DataType="{x:Type vm:HomeViewModel}">
|
||||||
<local:HomeView />
|
<local:HomeView />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<!-- 设备列表页 -->
|
||||||
<DataTemplate DataType="{x:Type vm:DevicesViewModel}">
|
<DataTemplate DataType="{x:Type vm:DevicesViewModel}">
|
||||||
<local:DevicesView />
|
<local:DevicesView />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<!-- 数据转换页 -->
|
||||||
<DataTemplate DataType="{x:Type vm:DataTransformViewModel}">
|
<DataTemplate DataType="{x:Type vm:DataTransformViewModel}">
|
||||||
<local:DataTransformView />
|
<local:DataTransformView />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<!-- 设置页 -->
|
||||||
<DataTemplate DataType="{x:Type vm:SettingViewModel}">
|
<DataTemplate DataType="{x:Type vm:SettingViewModel}">
|
||||||
<local:SettingView />
|
<local:SettingView />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<!-- 设备详情页 -->
|
||||||
|
<DataTemplate DataType="{x:Type vm:DeviceDetailViewModel}">
|
||||||
|
<local:DeviceDetailView />
|
||||||
|
</DataTemplate>
|
||||||
|
<!-- 设备变量页 -->
|
||||||
|
<DataTemplate DataType="{x:Type vm:VariableTableViewModel}">
|
||||||
|
<local:VariableTableView />
|
||||||
|
</DataTemplate>
|
||||||
</ContentControl.Resources>
|
</ContentControl.Resources>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using CommunityToolkit.Mvvm.Messaging;
|
|||||||
using iNKORE.UI.WPF.Modern.Controls;
|
using iNKORE.UI.WPF.Modern.Controls;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PMSWPF.Enums;
|
||||||
using PMSWPF.Helper;
|
using PMSWPF.Helper;
|
||||||
using PMSWPF.Message;
|
using PMSWPF.Message;
|
||||||
using PMSWPF.Models;
|
using PMSWPF.Models;
|
||||||
@@ -18,6 +19,7 @@ public partial class MainView : Window
|
|||||||
{
|
{
|
||||||
private readonly ILogger<MainView> _logger;
|
private readonly ILogger<MainView> _logger;
|
||||||
private MainViewModel _viewModel;
|
private MainViewModel _viewModel;
|
||||||
|
|
||||||
public MainView(MainViewModel viewModel, ILogger<MainView> logger)
|
public MainView(MainViewModel viewModel, ILogger<MainView> logger)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -34,33 +36,31 @@ public partial class MainView : Window
|
|||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
||||||
{
|
{
|
||||||
var item = args.SelectedItem as NavigationViewItem;
|
try
|
||||||
ViewModelBase navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
|
||||||
switch (item.Tag)
|
|
||||||
{
|
{
|
||||||
case "Home":
|
var menu = args.SelectedItem as MenuBean;
|
||||||
// mainViewModel.NavgateTo<HomeViewModel>();
|
if (menu == null)
|
||||||
navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
throw new ArgumentException("选择的菜单项为空!");
|
||||||
_logger.LogInformation("导航到到主页面");
|
|
||||||
|
switch (menu.Type)
|
||||||
|
{
|
||||||
|
case MenuType.MainMenu:
|
||||||
|
case MenuType.DeviceMenu:
|
||||||
|
case MenuType.VariableTableMenu:
|
||||||
|
if (menu.ViewModel == null)
|
||||||
|
throw new ArgumentException($"菜单项:{menu.Name},没有绑定对象的ViewModel");
|
||||||
|
MessageHelper.SendNavgatorMessage(menu.ViewModel);
|
||||||
|
_logger.LogInformation($"导航到:{menu.Name}");
|
||||||
break;
|
break;
|
||||||
case "Devices":
|
case MenuType.AddVariableTableMenu:
|
||||||
navgateVM = App.Current.Services.GetRequiredService<DevicesViewModel>();
|
|
||||||
// mainViewModel.NavgateTo<DevicesViewModel>();
|
|
||||||
_logger.LogInformation("导航到到设备页面");
|
|
||||||
break;
|
|
||||||
case "DataTransform":
|
|
||||||
navgateVM = App.Current.Services.GetRequiredService<DataTransformViewModel>();
|
|
||||||
// mainViewModel.NavgateTo<DataTransformViewModel>();
|
|
||||||
_logger.LogInformation("导航到到数据转换页面");
|
|
||||||
break;
|
|
||||||
case "Setting":
|
|
||||||
// mainViewModel.NavgateTo<SettingViewModel>();
|
|
||||||
navgateVM = App.Current.Services.GetRequiredService<SettingViewModel>();
|
|
||||||
_logger.LogInformation("导航到到设备页面");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
MessageHelper.SendNavgatorMessage(navgateVM);
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
NotificationHelper.ShowMessage(e.Message, NotificationType.Error);
|
||||||
|
_logger.LogError(e.Message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void MainView_OnLoaded(object sender, RoutedEventArgs e)
|
private async void MainView_OnLoaded(object sender, RoutedEventArgs e)
|
||||||
@@ -71,7 +71,7 @@ public partial class MainView : Window
|
|||||||
private void NavigationView_OnItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
|
private void NavigationView_OnItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
|
||||||
{
|
{
|
||||||
ViewModelBase navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
ViewModelBase navgateVM = App.Current.Services.GetRequiredService<HomeViewModel>();
|
||||||
Object parameter =null;
|
|
||||||
switch (args.InvokedItem)
|
switch (args.InvokedItem)
|
||||||
{
|
{
|
||||||
case "主页":
|
case "主页":
|
||||||
@@ -96,12 +96,6 @@ public partial class MainView : Window
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageHelper.SendNavgatorMessage(navgateVM,parameter);
|
MessageHelper.SendNavgatorMessage(navgateVM);
|
||||||
}
|
|
||||||
|
|
||||||
private void NavigationView_OnSelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
|
||||||
{
|
|
||||||
var selectMenu= args.SelectedItem as MenuBean;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,15 +4,17 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
|
||||||
|
xmlns:vm="clr-namespace:PMSWPF.ViewModels"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance vm:VariableTableViewModel}"
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
<ikw:SimpleStackPanel Spacing="5">
|
<ikw:SimpleStackPanel Spacing="5">
|
||||||
|
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||||
<TextBlock Text="变量表名称:" /> <TextBlock Text="默认变量表" />
|
<TextBlock Text="变量表名称:" /> <TextBlock Text="{Binding VariableTable.Name}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||||
<TextBlock Text="变量表描述:" /> <TextBlock Text="默认变量表" />
|
<TextBlock Text="变量表描述:" /> <TextBlock Text="{Binding VariableTable.Description}" />
|
||||||
</ikw:SimpleStackPanel>
|
</ikw:SimpleStackPanel>
|
||||||
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
<ikw:SimpleStackPanel Orientation="Horizontal" Spacing="10">
|
||||||
<TextBlock Text="所属设备:" /> <TextBlock Text="默认变量表" />
|
<TextBlock Text="所属设备:" /> <TextBlock Text="默认变量表" />
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using PMSWPF.ViewModels;
|
using PMSWPF.ViewModels;
|
||||||
|
|
||||||
namespace PMSWPF.Views;
|
namespace PMSWPF.Views;
|
||||||
|
|
||||||
public partial class VariableTableView : UserControl
|
public partial class VariableTableView : UserControl
|
||||||
{
|
{
|
||||||
public VariableTableView(VariableTableViewModel viewModel)
|
public VariableTableView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataContext = viewModel;
|
DataContext = App.Current.Services.GetRequiredService<VariableTableViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user