Zixuan 2 weeks ago
parent
commit
88f088d12e

+ 13 - 0
Data/Config/Config.csproj

@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\GeneralData\GeneralData.csproj" />
+  </ItemGroup>
+
+</Project>

+ 14 - 0
Data/Config/ConfigInfo.cs

@@ -0,0 +1,14 @@
+using GeneralData;
+
+namespace Config;
+
+public class ConfigInfo
+{
+    public DeviceModel DeviceModel { get; set; }
+    public object? DeviceSubModel { get; set; }
+    public string? DeviceName { get; set; }
+    public string? SoftwareVersion { get; set; }
+
+}
+
+

+ 4 - 0
Data/Device/Device.csproj

@@ -6,4 +6,8 @@
     <Nullable>enable</Nullable>
   </PropertyGroup>
 
+  <ItemGroup>
+    <ProjectReference Include="..\GeneralData\GeneralData.csproj" />
+  </ItemGroup>
+
 </Project>

+ 6 - 29
Data/Device/DeviceInfo.cs

@@ -1,4 +1,4 @@
-using System.ComponentModel;
+using GeneralData;
 
 namespace Device;
 
@@ -8,32 +8,9 @@ public class DeviceInfo
     public object? DeviceSubModel { get; set; }
     public string? DeviceName { get; set; }
     public string? Position { get; set; }
-
-    public Guid Guid { get; set; }
-}
-
-public enum DeviceModel
-{
-    JetKepler,
-    Proxima
-}
-
-public enum KeplerSubModel
-{
-    [Description("2200A")]
-    JetKepler_2200A,
-    [Description("2200B")]
-    JetKepler_2200B,
-    [Description("2300")]
-    JetKepler_2300,
-    [Description("DSE")]
-    JetKepler_DSE
-}
-
-public enum ProximaSubModel
-{
-    NTP,
-    SiBN,
-    NTP_HRP,
-    ELK
+    public string? SoftwareVersion { get; set; }
+    public Guid? Guid { get; set; }
+    public string? IP { get; set; }
+    public ushort Port { get; set; }
+    public string? DBConnectionString { get; set; }
 }

+ 28 - 0
Data/GeneralData/Class1.cs

@@ -0,0 +1,28 @@
+using System.ComponentModel;
+
+namespace GeneralData;
+public enum DeviceModel
+{
+    JetKepler,
+    Proxima
+}
+
+public enum KeplerSubModel
+{
+    [Description("2200A")]
+    JetKepler_2200A,
+    [Description("2200B")]
+    JetKepler_2200B,
+    [Description("2300")]
+    JetKepler_2300,
+    [Description("DSE")]
+    JetKepler_DSE
+}
+
+public enum ProximaSubModel
+{
+    NTP,
+    SiBN,
+    NTP_HRP,
+    ELK
+}

+ 9 - 0
Data/GeneralData/GeneralData.csproj

@@ -0,0 +1,9 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFramework>net8.0</TargetFramework>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <Nullable>enable</Nullable>
+  </PropertyGroup>
+
+</Project>

+ 14 - 7
EEMSMain.sln

@@ -13,8 +13,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Universal", "Universal\Univ
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceManagement", "Module\DeviceManagement\DeviceManagement.csproj", "{0A62EFDF-39BD-4E87-83A6-3DE740D7EEE5}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Module\Test\Test.csproj", "{1A395497-0267-8951-39EC-844ED65CA4B0}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{F81EF7E9-27B9-4DE0-95C9-CD1E7B58BA89}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Device", "Data\Device\Device.csproj", "{ACDE294E-7198-4D4B-A3B0-3D806494C284}"
@@ -27,6 +25,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigFileManager", "Module
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceScanner", "Module\DeviceScanner\DeviceScanner.csproj", "{338FCF76-39EE-4D7F-B863-F1D3CF8B88A2}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Config", "Data\Config\Config.csproj", "{4165E2E5-632E-4A7D-82E1-A1F256517B70}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeneralData", "Data\GeneralData\GeneralData.csproj", "{46863C36-9D19-40E7-8A0B-03EAB0944F1A}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -49,10 +51,6 @@ Global
 		{0A62EFDF-39BD-4E87-83A6-3DE740D7EEE5}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{0A62EFDF-39BD-4E87-83A6-3DE740D7EEE5}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{0A62EFDF-39BD-4E87-83A6-3DE740D7EEE5}.Release|Any CPU.Build.0 = Release|Any CPU
-		{1A395497-0267-8951-39EC-844ED65CA4B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{1A395497-0267-8951-39EC-844ED65CA4B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{1A395497-0267-8951-39EC-844ED65CA4B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{1A395497-0267-8951-39EC-844ED65CA4B0}.Release|Any CPU.Build.0 = Release|Any CPU
 		{ACDE294E-7198-4D4B-A3B0-3D806494C284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{ACDE294E-7198-4D4B-A3B0-3D806494C284}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{ACDE294E-7198-4D4B-A3B0-3D806494C284}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -69,17 +67,26 @@ Global
 		{338FCF76-39EE-4D7F-B863-F1D3CF8B88A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{338FCF76-39EE-4D7F-B863-F1D3CF8B88A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{338FCF76-39EE-4D7F-B863-F1D3CF8B88A2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{4165E2E5-632E-4A7D-82E1-A1F256517B70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{4165E2E5-632E-4A7D-82E1-A1F256517B70}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{4165E2E5-632E-4A7D-82E1-A1F256517B70}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{4165E2E5-632E-4A7D-82E1-A1F256517B70}.Release|Any CPU.Build.0 = Release|Any CPU
+		{46863C36-9D19-40E7-8A0B-03EAB0944F1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{46863C36-9D19-40E7-8A0B-03EAB0944F1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{46863C36-9D19-40E7-8A0B-03EAB0944F1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{46863C36-9D19-40E7-8A0B-03EAB0944F1A}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
 		{0A62EFDF-39BD-4E87-83A6-3DE740D7EEE5} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
-		{1A395497-0267-8951-39EC-844ED65CA4B0} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
 		{ACDE294E-7198-4D4B-A3B0-3D806494C284} = {F81EF7E9-27B9-4DE0-95C9-CD1E7B58BA89}
 		{812C3EA9-C703-4119-8D9E-BAD38115FB8D} = {B8FCC141-1383-4797-AAD9-17F53945876E}
 		{0122760C-70F6-47CD-86C2-E834D9D91E67} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
 		{338FCF76-39EE-4D7F-B863-F1D3CF8B88A2} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
+		{4165E2E5-632E-4A7D-82E1-A1F256517B70} = {F81EF7E9-27B9-4DE0-95C9-CD1E7B58BA89}
+		{46863C36-9D19-40E7-8A0B-03EAB0944F1A} = {F81EF7E9-27B9-4DE0-95C9-CD1E7B58BA89}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {331844F6-59F5-4D02-BFA4-2329C0EAB6EF}

+ 6 - 9
EEMSMain/App.xaml.cs

@@ -1,6 +1,9 @@
-using EEMSMain.Data;
+using Device;
+using EEMSMain.Data;
 using EEMSMain.Views;
+using GeneralData;
 using GlobalData;
+using Prism.Ioc;
 using System.IO;
 using System.Windows;
 using UICommon.CommonContainer;
@@ -21,6 +24,7 @@ public partial class App : PrismApplication
     {
         containerRegistry.Register<ICommonContainer, CommonContainer>();
         containerRegistry.RegisterSingleton<ContainerManager>();
+        containerRegistry.RegisterSingleton<DeviceCollection>();
     }
 
 
@@ -48,14 +52,7 @@ public class CommonContainer(IRegionManager regionManager,
             return;
         App.Current.Dispatcher.Invoke(() =>
         {
-
-            containerManager.Containers.Add(containerInfo.Index, containerInfo);
-            var t = containerManager.Containers.OrderBy(t => t.Key);
-            //containerManager.Containers.Clear();
-            //foreach (var item in t)
-            //{
-            //    containerManager.Containers.Add(item.Key, item.Value);
-            //}
+            containerManager.Containers.TryAdd(containerInfo.Index, containerInfo);
         });
 
     }

+ 56 - 3
EEMSMain/ViewModels/MainWindowViewModel.cs

@@ -1,14 +1,67 @@
 using CommunityToolkit.Mvvm.ComponentModel;
 using CommunityToolkit.Mvvm.Input;
+using Device;
 using EEMSMain.Data;
+using GeneralData;
+using GlobalData;
 using UICommon.CommonContainer;
 
 namespace EEMSMain.ViewModels;
 
-public partial class MainWindowViewModel(ICommonContainer commonContainer, ContainerManager containerManager) : ObservableObject
+public partial class MainWindowViewModel : ObservableObject
 {
-    private readonly ICommonContainer _commonContainer = commonContainer;
-    public ContainerManager ContainerManager { get; } = containerManager;
+    public MainWindowViewModel(ICommonContainer commonContainer, ContainerManager containerManager, DeviceCollection deviceCollection)
+    {
+        this._commonContainer = commonContainer;
+        this.ContainerManager = containerManager;
+        this._deviceCollection = deviceCollection;
+        this.FakeData();
+
+    }
+
+    private readonly ICommonContainer _commonContainer;
+    public ContainerManager ContainerManager { get; }
+
+    private readonly DeviceCollection _deviceCollection;
+
+    void FakeData()
+    {
+        _deviceCollection.Devices ??= [];
+        _deviceCollection.Devices[DeviceModel.JetKepler] = [];
+        for (int i = 1; i <= 6; i++)
+        {
+            DeviceInfo device = new()
+            {
+                DeviceModel = DeviceModel.JetKepler,
+                DeviceSubModel = KeplerSubModel.JetKepler_2200A,
+                DeviceName = $"Device {i}",
+                Position = $"position-{i}",
+                SoftwareVersion = "1.0.0.0",
+                Guid = Guid.NewGuid(),
+            };
+
+            _deviceCollection.Devices[DeviceModel.JetKepler].Add(device);
+        }
+
+        _deviceCollection.Devices[DeviceModel.Proxima] = [];
+
+        for (int i = 1; i <= 3; i++)
+        {
+            DeviceInfo device = new()
+            {
+                DeviceModel = DeviceModel.Proxima,
+                DeviceSubModel = ProximaSubModel.ELK,
+                DeviceName = $"Device {i}",
+                Position = $"position-{i}",
+                SoftwareVersion = "1.0.0.0",
+                Guid = Guid.NewGuid(),
+            };
+
+            _deviceCollection.Devices[DeviceModel.Proxima].Add(device);
+        }
+
+    }
+
 
     [ObservableProperty]
     private string? _CurrentModule;

+ 1 - 2
EEMSMain/Views/MainWindow.xaml

@@ -10,12 +10,11 @@
         Title="MainWindow" Height="450" Width="800">
     <Grid>
         <Grid.ColumnDefinitions>
-            <ColumnDefinition Width="200"/>
+            <ColumnDefinition Width="auto"/>
             <ColumnDefinition Width="auto"/>
             <ColumnDefinition Width="*"/>
         </Grid.ColumnDefinitions>
 
-
         <ItemsControl Grid.Column="0" ItemsSource="{Binding ContainerManager.Containers}">
             <ItemsControl.ItemTemplate>
                 <DataTemplate>

+ 1 - 0
GlobalData/GlobalData/DeviceCollection.cs

@@ -1,5 +1,6 @@
 using CommunityToolkit.Mvvm.ComponentModel;
 using Device;
+using GeneralData;
 using System.Collections.ObjectModel;
 using UICommon.DataType;
 

+ 3 - 0
Module/ConfigFileManager/ConfigFileManager.csproj.user

@@ -2,6 +2,9 @@
 <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup />
   <ItemGroup>
+    <Compile Update="Controls\ConfigFilePlot.xaml.cs">
+      <SubType>Code</SubType>
+    </Compile>
     <Compile Update="Views\ConfigFileManager.xaml.cs">
       <SubType>Code</SubType>
     </Compile>

+ 100 - 0
Module/ConfigFileManager/Controls/ConfigFilePlot.xaml

@@ -0,0 +1,100 @@
+<UserControl x:Class="ConfigFileManager.Controls.ConfigFilePlot"
+             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:ConfigFileManager.Controls"
+             mc:Ignorable="d" 
+             x:Name="This"
+             d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+        <ResourceDictionary Source="/ConfigFileManager;component/Resources.xaml"/>
+    </UserControl.Resources>
+    <Border BorderBrush="DarkGray" Background="#f2f2f2" CornerRadius="16" BorderThickness="1" Margin="8" VerticalAlignment="Center" HorizontalAlignment="Center">
+        <Grid Margin="16,8" VerticalAlignment="Top">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="120"/>
+                <ColumnDefinition/>
+            </Grid.ColumnDefinitions>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="*"/>
+                <RowDefinition Height="16"/>
+                <RowDefinition Height="auto"/>
+            </Grid.RowDefinitions>
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition Height="2"/>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition Height="2"/>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition Height="2"/>
+                    <RowDefinition Height="auto"/>
+                    <RowDefinition Height="2"/>
+                    <RowDefinition Height="auto"/>
+                </Grid.RowDefinitions>
+                <TextBlock Grid.Row="0" FontSize="14" FontWeight="Bold" Text="{Binding ElementName=This,Path=DeviceInfo.DeviceModel}"/>
+                <TextBlock Grid.Row="2" VerticalAlignment="Center" Text="{Binding ElementName=This,Path=DeviceInfo.DeviceSubModel}"/>
+
+                <TextBlock Grid.Row="4" VerticalAlignment="Center" Text="{Binding ElementName=This,Path=DeviceInfo.DeviceName}"/>
+                <TextBlock Grid.Row="6" VerticalAlignment="Center" Text="{Binding ElementName=This,Path=DeviceInfo.Position}"/>
+                <TextBlock Grid.Row="8" VerticalAlignment="Center" Text="{Binding ElementName=This,Path=DeviceInfo.SoftwareVersion}"/>
+            </Grid>
+
+            <Grid Grid.Column="1"  VerticalAlignment="Center">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="auto"/>
+                    <ColumnDefinition Width="8"/>
+                    <ColumnDefinition Width="auto"/>
+                </Grid.ColumnDefinitions>
+                <CheckBox VerticalAlignment="Center" HorizontalAlignment="Center">
+                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="auto"/>
+                            <RowDefinition Height="8"/>
+                            <RowDefinition Height="auto"/>
+                        </Grid.RowDefinitions>
+                        <Image Source="{StaticResource Icon_File}" Height="48"></Image>
+                        <TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center">Configs</TextBlock>
+                    </Grid>
+                </CheckBox>
+
+                <CheckBox Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center">
+                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
+                        <Grid.RowDefinitions>
+                            <RowDefinition Height="auto"/>
+                            <RowDefinition Height="8"/>
+                            <RowDefinition Height="auto"/>
+                        </Grid.RowDefinitions>
+                        <Image Source="{StaticResource Icon_File}" Height="48"></Image>
+                        <TextBlock Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Center">Recipes</TextBlock>
+                    </Grid>
+                </CheckBox>
+
+            </Grid>
+
+            <Grid Grid.Row="2" Grid.ColumnSpan="3">
+                <Grid.ColumnDefinitions>
+                    <ColumnDefinition Width="60"/>
+                    <ColumnDefinition Width="8"/>
+                    <ColumnDefinition Width="60"/>
+                    <ColumnDefinition Width="*"/>
+                    <ColumnDefinition Width="auto"/>
+                </Grid.ColumnDefinitions>
+
+                <Button Grid.Column="0" Background="Transparent"  
+                        BorderBrush="{StaticResource ThemeColor}" TextElement.Foreground="{StaticResource ThemeColor}"
+                        Command="{Binding ElementName=This, Path=UpdateCommand}"
+                        CommandParameter="{Binding ElementName=This, Path=DeviceInfo}">更新</Button>
+                <Button Grid.Column="2" Background="Transparent"  
+                        BorderBrush="{StaticResource ThemeColor}" TextElement.Foreground="{StaticResource ThemeColor}"
+                        Command="{Binding ElementName=This,Path=MigrateCommand}"
+                        CommandParameter="{Binding ElementName=This, Path=DeviceInfo}">迁移</Button>
+                <StackPanel Grid.Column="4">
+                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="更新时间:"></TextBlock>
+                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="2024-06-24 12:23:33"></TextBlock>
+                </StackPanel>
+            </Grid>
+        </Grid>
+    </Border>
+</UserControl>

+ 52 - 0
Module/ConfigFileManager/Controls/ConfigFilePlot.xaml.cs

@@ -0,0 +1,52 @@
+using Device;
+using System.Reflection.Metadata.Ecma335;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+
+namespace ConfigFileManager.Controls;
+
+/// <summary>
+/// Interaction logic for ConfigFilePlot.xaml
+/// </summary>
+public partial class ConfigFilePlot : UserControl
+{
+    public ConfigFilePlot()
+    {
+        InitializeComponent();
+    }
+
+    public DeviceInfo DeviceInfo
+    {
+        get { return (DeviceInfo)GetValue(DeviceInfoProperty); }
+        set { SetValue(DeviceInfoProperty, value); }
+    }
+
+    public static readonly DependencyProperty DeviceInfoProperty =
+        DependencyProperty.Register("DeviceInfo", typeof(DeviceInfo), typeof(ConfigFilePlot), new PropertyMetadata(default));
+
+    public ICommand UpdateCommand
+    {
+        get { return (ICommand)GetValue(UpdateCommandProperty); }
+        set { SetValue(UpdateCommandProperty, value); }
+    }
+
+    public static readonly DependencyProperty UpdateCommandProperty =
+        DependencyProperty.Register("UpdateCommand", typeof(ICommand), typeof(ConfigFilePlot), new PropertyMetadata(default));
+
+
+
+
+    public ICommand MigrateCommand
+    {
+        get { return (ICommand)GetValue(MigrateCommandProperty); }
+        set { SetValue(MigrateCommandProperty, value); }
+    }
+
+    public static readonly DependencyProperty MigrateCommandProperty =
+        DependencyProperty.Register("MigrateCommand", typeof(ICommand), typeof(ConfigFilePlot), new PropertyMetadata(default));
+
+
+
+
+}

+ 12 - 0
Module/ConfigFileManager/Resources.xaml

@@ -0,0 +1,12 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+            <ResourceDictionary.MergedDictionaries>
+                <ResourceDictionary Source="/UICommon;component/Brush.xaml"/>
+                <ResourceDictionary Source="/UICommon;component/Styles/ButtonStyle.xaml"/>
+                <ResourceDictionary Source="/UICommon;component/Styles/CheckBoxStyle.xaml"/>
+                <ResourceDictionary Source="/UICommon;component/Styles/ComboBoxStyle.xaml"/>
+                <ResourceDictionary Source="/UICommon;component/DrawImage.xaml"/>
+                <ResourceDictionary Source="/UICommon;component/Styles/OtherStyle.xaml"/>
+                <ResourceDictionary Source="/UICommon;component/Styles/RadioButtonStyle.xaml"/>
+            </ResourceDictionary.MergedDictionaries>
+</ResourceDictionary>

+ 26 - 6
Module/ConfigFileManager/ViewModels/ConfigFileManagerViewModel.cs

@@ -1,11 +1,31 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Device;
+using GlobalData;
 
 namespace ConfigFileManager.ViewModels;
 
-internal class ConfigFileManagerViewModel
+public partial class ConfigFileManagerViewModel : ObservableObject
 {
+    public ConfigFileManagerViewModel(DeviceCollection deviceCollection)
+    {
+        this.DeviceCollection = deviceCollection;
+    }
+
+    [ObservableProperty]
+    private DeviceCollection _DeviceCollection;
+
+
+    [RelayCommand]
+    private void Migrate(DeviceInfo deviceInfo)
+    {
+
+    }
+
+    [RelayCommand]
+    private void Update(DeviceInfo deviceInfo)
+    {
+
+    }
+
 }

+ 42 - 1
Module/ConfigFileManager/Views/ConfigFileManager.xaml

@@ -5,8 +5,49 @@
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
              xmlns:local="clr-namespace:ConfigFileManager.Views"
              mc:Ignorable="d" 
+             xmlns:contorls="clr-namespace:ConfigFileManager.Controls"
              d:DesignHeight="450" d:DesignWidth="800">
+    <UserControl.Resources>
+        <ResourceDictionary Source="/ConfigFileManager;component/Resources.xaml"/>
+    </UserControl.Resources>
     <Grid>
-            
+        <!--<contorls:ConfigFilePlot/>-->
+        <ScrollViewer>
+
+            <ItemsControl ItemsSource="{Binding DeviceCollection.Devices}">
+                <ItemsControl.ItemTemplate>
+                    <DataTemplate>
+
+                        <Expander Margin="8" IsExpanded="True">
+                            <Expander.Header>
+                                <TextBlock Text="{Binding Key}" FontSize="13"></TextBlock>
+                            </Expander.Header>
+
+                            <ItemsControl ItemsSource="{Binding Value}">
+                                <ItemsControl.ItemTemplate>
+                                    <DataTemplate>
+                                        <contorls:ConfigFilePlot DeviceInfo="{Binding}"
+                                                                 MigrateCommand="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ConfigFileManager}, Path=DataContext.MigrateCommand}"
+                                                                 UpdateCommand="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:ConfigFileManager}, Path=DataContext.UpdateCommand}"/>
+                                    </DataTemplate>
+                                </ItemsControl.ItemTemplate>
+                                <ItemsControl.ItemsPanel>
+                                    <ItemsPanelTemplate>
+                                        <WrapPanel/>
+                                    </ItemsPanelTemplate>
+                                </ItemsControl.ItemsPanel>
+                            </ItemsControl>
+                        </Expander>
+
+                    </DataTemplate>
+                </ItemsControl.ItemTemplate>
+
+                <ItemsControl.ItemsPanel>
+                    <ItemsPanelTemplate>
+                        <StackPanel/>
+                    </ItemsPanelTemplate>
+                </ItemsControl.ItemsPanel>
+            </ItemsControl>
+        </ScrollViewer>
     </Grid>
 </UserControl>

+ 0 - 7
Module/DeviceManagement/DeviceManagement.csproj

@@ -19,13 +19,6 @@
 	</PropertyGroup>
 
 	<ItemGroup>
-		<Compile Remove="NewFolder\**" />
-		<EmbeddedResource Remove="NewFolder\**" />
-		<None Remove="NewFolder\**" />
-		<Page Remove="NewFolder\**" />
-	</ItemGroup>
-
-	<ItemGroup>
 		<None Remove="Resources\Furnace.png" />
 		<None Remove="Resources\Kepler.png" />
 	</ItemGroup>

+ 1 - 8
Module/DeviceManagement/DeviceManagementModule.cs

@@ -1,11 +1,6 @@
-using DeviceManagement.ViewModels;
-using DeviceManagement.Views;
-using GlobalData;
-using UICommon.CommonContainer;
+namespace DeviceManagement;
 
-namespace DeviceManagement;
 [Module(ModuleName = "DeviceManagement", OnDemand = false)]
-
 public class DeviceManagementModule : IModule
 {
     public DeviceManagementModule(ICommonContainer commonContainer)
@@ -25,7 +20,5 @@ public class DeviceManagementModule : IModule
     void IModule.RegisterTypes(IContainerRegistry containerRegistry)
     {
         containerRegistry.RegisterForNavigation<DeviceManager, DeviceManagerViewModel>("DeviceManagement");
-        containerRegistry.RegisterSingleton<DeviceCollection>();
-
     }
 }

+ 8 - 8
Module/DeviceManagement/ViewModels/DeviceManagerViewModel.cs

@@ -1,15 +1,11 @@
-using CommunityToolkit.Mvvm.ComponentModel;
-using CommunityToolkit.Mvvm.Input;
-using Device;
-using GlobalData;
-
-namespace DeviceManagement.ViewModels;
+namespace DeviceManagement.ViewModels;
 
 public partial class DeviceManagerViewModel : ObservableObject
 {
     public DeviceManagerViewModel(DeviceCollection deviceCollection)
     {
         this.DeviceCollection = deviceCollection;
+
         FakeData();
     }
     void FakeData()
@@ -23,7 +19,9 @@ public partial class DeviceManagerViewModel : ObservableObject
                 DeviceModel = DeviceModel.JetKepler,
                 DeviceSubModel = KeplerSubModel.JetKepler_2200A,
                 DeviceName = $"Device {i}",
-                Position = $"position-{i}"
+                Position = $"position-{i}",
+                SoftwareVersion = "1.0.0.0",
+                Guid = Guid.NewGuid(),
             };
 
             DeviceCollection.Devices[DeviceModel.JetKepler].Add(device);
@@ -38,7 +36,9 @@ public partial class DeviceManagerViewModel : ObservableObject
                 DeviceModel = DeviceModel.Proxima,
                 DeviceSubModel = ProximaSubModel.ELK,
                 DeviceName = $"Device {i}",
-                Position = $"position-{i}"
+                Position = $"position-{i}",
+                SoftwareVersion = "1.0.0.0",
+                Guid = Guid.NewGuid(),
             };
 
             DeviceCollection.Devices[DeviceModel.Proxima].Add(device);

+ 2 - 2
Module/DeviceManagement/Views/DeviceManager.xaml

@@ -28,8 +28,8 @@
                                 <ItemsControl.ItemTemplate>
                                     <DataTemplate>
                                         <controls:DevicePlot DeviceInfo="{Binding}" 
-                                DetailCommand="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:DeviceManager}, Path=DataContext.CheckDetailCommand}"
-                                SettingCommand="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:DeviceManager}, Path=DataContext.SettingCommand}"/>
+                                    DetailCommand="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:DeviceManager}, Path=DataContext.CheckDetailCommand}"
+                                    SettingCommand="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:DeviceManager}, Path=DataContext.SettingCommand}"/>
                                     </DataTemplate>
                                 </ItemsControl.ItemTemplate>
                                 <ItemsControl.ItemsPanel>

+ 8 - 0
Module/DeviceManagement/properties/_global.cs

@@ -0,0 +1,8 @@
+global using CommunityToolkit.Mvvm.ComponentModel;
+global using CommunityToolkit.Mvvm.Input;
+global using Device;
+global using GlobalData;
+global using GeneralData;
+global  using DeviceManagement.ViewModels;
+global using DeviceManagement.Views;
+global using UICommon.CommonContainer;