Zixuan 1 week ago
parent
commit
770e62c132

+ 7 - 0
EEMSMain.sln

@@ -37,6 +37,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KeplerAnalizer", "Analizer\
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProximaAnalizer", "Analizer\ProximaAnalizer\ProximaAnalizer.csproj", "{F7F2BC09-A8FD-4F79-82B1-BC578D50C9D8}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DashBoard", "Module\DashBoard\DashBoard.csproj", "{C3B8BA88-50CB-48C9-954E-811B68280DE8}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -95,6 +97,10 @@ Global
 		{F7F2BC09-A8FD-4F79-82B1-BC578D50C9D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{F7F2BC09-A8FD-4F79-82B1-BC578D50C9D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{F7F2BC09-A8FD-4F79-82B1-BC578D50C9D8}.Release|Any CPU.Build.0 = Release|Any CPU
+		{C3B8BA88-50CB-48C9-954E-811B68280DE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{C3B8BA88-50CB-48C9-954E-811B68280DE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{C3B8BA88-50CB-48C9-954E-811B68280DE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{C3B8BA88-50CB-48C9-954E-811B68280DE8}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -109,6 +115,7 @@ Global
 		{A7B0EC60-758A-3F1B-07BD-E6BDC72911F8} = {B8FCC141-1383-4797-AAD9-17F53945876E}
 		{2735D064-47D5-4905-87D0-D10619806546} = {62F6EEA5-0B5B-44BC-88B8-8F875BF95424}
 		{F7F2BC09-A8FD-4F79-82B1-BC578D50C9D8} = {62F6EEA5-0B5B-44BC-88B8-8F875BF95424}
+		{C3B8BA88-50CB-48C9-954E-811B68280DE8} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {331844F6-59F5-4D02-BFA4-2329C0EAB6EF}

+ 34 - 0
Module/DashBoard/DashBoard.csproj

@@ -0,0 +1,34 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+	<PropertyGroup>
+		<OutputType>Library</OutputType>
+		<TargetFramework>net8.0-windows</TargetFramework>
+		<OutputPath>$(SolutionDir)Binary\Modules</OutputPath>
+		<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+		<Nullable>enable</Nullable>
+		<ImplicitUsings>enable</ImplicitUsings>
+		<UseWPF>true</UseWPF>
+		<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
+	</PropertyGroup>
+
+	<ItemGroup>
+	  <None Remove="dashboard.png" />
+	</ItemGroup>
+
+	<ItemGroup>
+	  <PackageReference Include="CommunityToolkit.Mvvm" />
+	  <PackageReference Include="Prism.DryIoc" />
+	</ItemGroup>
+
+	<ItemGroup>
+	  <ProjectReference Include="..\..\Data\GeneralData\GeneralData.csproj" />
+	  <ProjectReference Include="..\..\Data_ViewModel\GlobalData\GlobalData.csproj" />
+	  <ProjectReference Include="..\..\UICommon\UICommon.csproj" />
+	  <ProjectReference Include="..\..\Universal\Universal.csproj" />
+	</ItemGroup>
+
+	<ItemGroup>
+	  <Resource Include="dashboard.png" />
+	</ItemGroup>
+
+</Project>

+ 9 - 0
Module/DashBoard/DashBoard.csproj.user

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup />
+  <ItemGroup>
+    <Compile Update="View\DashBoardMain.xaml.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+</Project>

+ 27 - 0
Module/DashBoard/DashBoardModule.cs

@@ -0,0 +1,27 @@
+namespace DashBoard;
+
+[Module(ModuleName = "DashBoard", OnDemand = false)]
+public class DashBoardModule : IModule
+{
+    public DashBoardModule(ICommonContainer commonContainer)
+    {
+        commonContainer.AddModule("DashBoard");
+        ImageSource source = new BitmapImage(new Uri("/DashBoard;component/dashboard.png", UriKind.Relative));
+
+        commonContainer.AddNavigation(new(4, "实时监控", "DashBoard", false, source));
+    }
+
+    void IModule.OnInitialized(IContainerProvider containerProvider)
+    {
+        IRegionManager regionManager = containerProvider.Resolve<IRegionManager>();
+
+        ICommonContainer commonContainer = containerProvider.Resolve<ICommonContainer>();
+        regionManager.RegisterViewWithRegion(commonContainer.MainReginName, typeof(DashBoardMain));
+    }
+
+    void IModule.RegisterTypes(IContainerRegistry containerRegistry)
+    {
+        containerRegistry.RegisterForNavigation<DashBoardMain, DashBoardMainViewModel>("DashBoard");
+        //containerRegistry.RegisterDialog<EditDevice, EditDeviceViewModel>("EditDevice");
+    }
+}

+ 12 - 0
Module/DashBoard/View/DashBoardMain.xaml

@@ -0,0 +1,12 @@
+<UserControl x:Class="DashBoard.View.DashBoardMain"
+             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:DashBoard.View"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+            
+    </Grid>
+</UserControl>

+ 28 - 0
Module/DashBoard/View/DashBoardMain.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace DashBoard.View
+{
+    /// <summary>
+    /// Interaction logic for DashBoardMain.xaml
+    /// </summary>
+    public partial class DashBoardMain : UserControl
+    {
+        public DashBoardMain()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 32 - 0
Module/DashBoard/ViewModel/DashBoardMainViewModel.cs

@@ -0,0 +1,32 @@
+namespace DashBoard.ViewModel;
+
+internal partial class DashBoardMainViewModel : ObservableObject
+{
+    public DashBoardMainViewModel(DeviceCollection deviceCollection, IDialogService dialogService)
+    {
+        this._DeviceCollection = deviceCollection;
+        this._DialogService = dialogService;
+        deviceCollection.DeviceList.CollectionChanged += DeviceList_CollectionChanged;
+        this.DeviceList_CollectionChanged(deviceCollection.DeviceList, null);
+    }
+    private void DeviceList_CollectionChanged(object? sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs? e)
+    {
+        if (sender is not ObservableDictionary<Guid, DeviceInfo_VM> deviceList)
+            return;
+
+        this.Devices.Clear();
+        foreach (DeviceInfo_VM device in deviceList.Values)
+        {
+            this.Devices[device.DeviceModel] ??= [];
+            this.Devices[device.DeviceModel].Add(device);
+        }
+    }
+
+
+    private readonly IDialogService _DialogService;
+    private readonly DeviceCollection _DeviceCollection;
+
+    [ObservableProperty]
+    private ObservableDictionary<DeviceModel, ObservableCollection<DeviceInfo_VM>> _Devices = [];
+
+}

BIN
Module/DashBoard/dashboard.png


+ 11 - 0
Module/DashBoard/properties/_global.cs

@@ -0,0 +1,11 @@
+global using CommunityToolkit.Mvvm.ComponentModel;
+global using DashBoard.View;
+global using DashBoard.ViewModel;
+global using GeneralData;
+global using GlobalData;
+global using System.Collections.ObjectModel;
+global using System.Windows.Controls;
+global using System.Windows.Media;
+global using System.Windows.Media.Imaging;
+global using UICommon.CommonContainer;
+global using UICommon.DataType;

+ 1 - 1
Module/DeviceManagement/DeviceManagementModule.cs

@@ -12,7 +12,7 @@ public class DeviceManagementModule : IModule
         commonContainer.AddModule("DeviceManagement");
         ImageSource source = new BitmapImage(new Uri("/DeviceManagement;component/Icon.png", UriKind.Relative));
 
-        commonContainer.AddNavigation(new(1, "设备信息", "DeviceManagement", false, source));
+        commonContainer.AddNavigation(new(1, "设备管理", "DeviceManagement", false, source));
     }
 
     void IModule.OnInitialized(IContainerProvider containerProvider)