Browse Source

1. 细节优化
2. 新增物联网纯配置数采系统(百分之五)

Shun 2 years ago
parent
commit
a86380bc55

+ 4 - 0
README.md

@@ -596,3 +596,7 @@ while(true)
 1. 修改OPCUA工具节点浏览的节点导出功能
 2. 新增GE工具
 
+#### 2024-1-10
+1. 细节优化
+2. 新增物联网纯配置数采系统(百分之五)
+

+ 21 - 1
src/YSAI.DAQ.sln

@@ -97,7 +97,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.Windows.Samples", "YSA
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.Windows.Anime.Samples", "YSAI.Windows.Anime.Samples\YSAI.Windows.Anime.Samples.csproj", "{A2F3A1D2-2165-403F-B0CE-311ECF807D33}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YSAI.GE", "YSAI.GE\YSAI.GE.csproj", "{9BEA4BCD-8C92-4B9C-8C8E-C2B56C3E3D3D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "YSAI.GE", "YSAI.GE\YSAI.GE.csproj", "{9BEA4BCD-8C92-4B9C-8C8E-C2B56C3E3D3D}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{C98BB76A-F506-4B4D-AF80-9B5308FD7866}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "物联网数据采集", "物联网数据采集", "{14E533DC-B4E4-4865-9017-848F5A47B444}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YSAI.Iot.Daq.Core", "YSAI.Iot.Daq.Core\YSAI.Iot.Daq.Core.csproj", "{037186D9-6349-4FAB-B7C6-04D17092E443}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "YSAI.Iot.Daq", "YSAI.Iot.Daq\YSAI.Iot.Daq.csproj", "{B88C1650-0296-4E51-AB7E-6B68806FAD4B}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -253,6 +261,14 @@ Global
 		{9BEA4BCD-8C92-4B9C-8C8E-C2B56C3E3D3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{9BEA4BCD-8C92-4B9C-8C8E-C2B56C3E3D3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{9BEA4BCD-8C92-4B9C-8C8E-C2B56C3E3D3D}.Release|Any CPU.Build.0 = Release|Any CPU
+		{037186D9-6349-4FAB-B7C6-04D17092E443}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{037186D9-6349-4FAB-B7C6-04D17092E443}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{037186D9-6349-4FAB-B7C6-04D17092E443}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{037186D9-6349-4FAB-B7C6-04D17092E443}.Release|Any CPU.Build.0 = Release|Any CPU
+		{B88C1650-0296-4E51-AB7E-6B68806FAD4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{B88C1650-0296-4E51-AB7E-6B68806FAD4B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{B88C1650-0296-4E51-AB7E-6B68806FAD4B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{B88C1650-0296-4E51-AB7E-6B68806FAD4B}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -299,6 +315,10 @@ Global
 		{8E8BFF57-ECC4-4D81-A483-A39ABF899838} = {ACE972C1-709F-4074-B085-300D80488AAC}
 		{A2F3A1D2-2165-403F-B0CE-311ECF807D33} = {ACE972C1-709F-4074-B085-300D80488AAC}
 		{9BEA4BCD-8C92-4B9C-8C8E-C2B56C3E3D3D} = {0A264424-1AD7-49FA-B813-D96498066479}
+		{C98BB76A-F506-4B4D-AF80-9B5308FD7866} = {8AB62EDF-2857-497A-889E-14A7CF88F107}
+		{14E533DC-B4E4-4865-9017-848F5A47B444} = {C98BB76A-F506-4B4D-AF80-9B5308FD7866}
+		{037186D9-6349-4FAB-B7C6-04D17092E443} = {14E533DC-B4E4-4865-9017-848F5A47B444}
+		{B88C1650-0296-4E51-AB7E-6B68806FAD4B} = {14E533DC-B4E4-4865-9017-848F5A47B444}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {5D5D3927-6714-40C0-84EA-44C5BA4C5E87}

+ 14 - 0
src/YSAI.Iot.Daq.Core/YSAI.Iot.Daq.Core.csproj

@@ -0,0 +1,14 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <TargetFrameworks>net6.0-windows;net8.0-windows</TargetFrameworks>
+    <Nullable>enable</Nullable>
+    <UseWPF>true</UseWPF>
+    <ImplicitUsings>enable</ImplicitUsings>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\YSAI.Core.Wpf\YSAI.Core.Wpf.csproj" />
+  </ItemGroup>
+
+</Project>

+ 14 - 0
src/YSAI.Iot.Daq/App.xaml

@@ -0,0 +1,14 @@
+<Application x:Class="YSAI.Iot.Daq.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:YSAI.Iot.Daq"
+             StartupUri="Main.xaml">
+    <Application.Resources>
+        <ResourceDictionary>
+            <ResourceDictionary.MergedDictionaries>
+                <!--加载默认样式-->
+                <ResourceDictionary Source="pack://application:,,,/YSAI.Core.Wpf;component/themes/WindowTemplate_Black.xaml" />
+            </ResourceDictionary.MergedDictionaries>
+        </ResourceDictionary>
+    </Application.Resources>
+</Application>

+ 14 - 0
src/YSAI.Iot.Daq/App.xaml.cs

@@ -0,0 +1,14 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace YSAI.Iot.Daq
+{
+    /// <summary>
+    /// Interaction logic for App.xaml
+    /// </summary>
+    public partial class App : Application
+    {
+    }
+
+}

+ 10 - 0
src/YSAI.Iot.Daq/AssemblyInfo.cs

@@ -0,0 +1,10 @@
+using System.Windows;
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None,            //where theme specific resource dictionaries are located
+                                                //(used if a resource is not found in the page,
+                                                // or application resource dictionaries)
+    ResourceDictionaryLocation.SourceAssembly   //where the generic resource dictionary is located
+                                                //(used if a resource is not found in the page,
+                                                // app, or any theme specific resource dictionaries)
+)]

+ 32 - 0
src/YSAI.Iot.Daq/Main.xaml

@@ -0,0 +1,32 @@
+<base:WindowBase x:Class="YSAI.Iot.Daq.Main"
+                 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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+                 xmlns:local="clr-namespace:YSAI.Iot.Daq"
+                 xmlns:base="clr-namespace:YSAI.Core.Wpf;assembly=YSAI.Core.Wpf"
+                 Icon="image\YSAI_One.ico"
+                 FontFamily="{DynamicResource AllFontFamily}" WindowStartupLocation="CenterScreen" IsContentBackgroundPicture="True" ResizeMode="CanResize"
+                 xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
+                 Title="[ 远舢智能 ] 物联网数据采集" >
+    <Window.DataContext>
+        <local:MainController />
+    </Window.DataContext>
+
+    <Grid Background="{DynamicResource Follow.Style.Background}" x:Name="wpfui_Grid">
+        <Grid.Resources>
+            <ResourceDictionary>
+                <ResourceDictionary.MergedDictionaries>
+                    <ui:ThemesDictionary Theme="Dark"/>
+                    <ui:ControlsDictionary />
+                </ResourceDictionary.MergedDictionaries>
+            </ResourceDictionary>
+        </Grid.Resources>
+        <ui:NavigationView
+            MenuItemsSource="{Binding MenuItemsSource}"
+            FooterMenuItemsSource="{Binding FooterMenuItemsSource}"
+            IsBackButtonVisible="Collapsed"
+            IsPaneToggleVisible="True">
+        </ui:NavigationView>
+    </Grid>
+</base:WindowBase>

+ 103 - 0
src/YSAI.Iot.Daq/Main.xaml.cs

@@ -0,0 +1,103 @@
+using System.Windows;
+using YSAI.Core.Wpf;
+using YSAI.Langs;
+
+namespace YSAI.Iot.Daq
+{
+    /// <summary>
+    /// Interaction logic for MainWindow.xaml
+    /// </summary>
+    public partial class Main : WindowBase
+    {
+        public Main()
+        {
+            //当皮肤切换触发事件
+            WindowHelper.OnSkinSwitchEvent += WindowHelper_OnSkinSwitchEvent;
+            //语言发生变化
+            LangsHelper.OnLangSwitchEvent += LangsHelper_OnLangSwitchEvent;
+
+            InitializeComponent();
+
+            //皮肤变化设置控件模版
+            WindowHelper_OnSkinSwitchEvent(WindowHelper.SkinName, null);
+
+            //特殊解决方案,无法直接用此控件NAME 只能使用此方法来设置第一次打开显示的界面
+            Task.Run(() =>
+            {
+                Thread.Sleep(50);
+                //System.Windows.Application.Current?.Dispatcher.Invoke(delegate ()
+                //{
+                //    List<NavigationView> navigationViews = WpfHelperTool.FindVisualChild<NavigationView>(this);
+                //    if (navigationViews.Count > 0)
+                //    {
+                //        //第一次打开显示的界面
+                //        navigationViews[0].Navigate(typeof(YSAI.Tool.Wpf.views.UaClient));
+                //    }
+                //});
+            });
+        }
+        /// <summary>
+        /// 语言发生变化
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void LangsHelper_OnLangSwitchEvent(object? sender, System.EventArgs e)
+        {
+            //暂不使用
+        }
+
+        /// <summary>
+        /// 上一次皮肤名称
+        /// </summary>
+        private string sn { get; set; }
+
+        /// <summary>
+        /// 皮肤发生变化
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void WindowHelper_OnSkinSwitchEvent(object? sender, System.EventArgs e)
+        {
+            string SkinName = string.Empty;
+            string skinName = sender?.ToString() ?? "White";
+            if (skinName.Equals("White"))
+            {
+                SkinName = "Light";
+            }
+            else
+            {
+                SkinName = "Dark";
+            }
+
+            if (sn != SkinName)
+            {
+
+                string strSourceDic = "pack://application:,,,/Wpf.Ui;component/Resources/Theme/" + SkinName + ".xaml";
+
+                //资源开始初始化
+                wpfui_Grid.Resources.BeginInit();
+                //检索资源
+                ResourceDictionary resourceDictionary = null;
+                foreach (var item in wpfui_Grid.Resources.MergedDictionaries)
+                {
+                    if (item.Source.AbsolutePath.Contains("Light") || item.Source.AbsolutePath.Contains("Dark"))
+                    {
+                        resourceDictionary = item;
+                    }
+                }
+                //移除资源
+                wpfui_Grid.Resources.MergedDictionaries.Remove(resourceDictionary);
+                //添加新的资源
+                wpfui_Grid.Resources.MergedDictionaries.Add(new ResourceDictionary()
+                {
+                    Source = new Uri(strSourceDic, UriKind.RelativeOrAbsolute)
+                });
+                //结束资源初始化
+                wpfui_Grid.Resources.EndInit();
+
+                sn = SkinName;
+
+            }
+        }
+    }
+}

+ 58 - 0
src/YSAI.Iot.Daq/MainController.cs

@@ -0,0 +1,58 @@
+using System.Collections.ObjectModel;
+using Wpf.Ui.Controls;
+using YSAI.Core.Wpf.mvvm;
+using YSAI.Langs;
+
+namespace YSAI.Iot.Daq
+{
+    public class MainController : NotifyObject
+    {
+        public MainController()
+        {
+            //设置初始语言
+            LangsHelper.SetLangs(LangsHelper.GetLangs());
+
+
+            MenuItemsSource = new ObservableCollection<object>
+            {
+                 CreationControl("主页",SymbolRegular.Home12,null),
+                 CreationControl("转发",SymbolRegular.Send16,null),
+                 CreationControl("地址",SymbolRegular.MyLocation16,null),
+                 CreationControl("采集",SymbolRegular.Timeline24,null),
+            };
+
+            FooterMenuItemsSource = new ObservableCollection<object>
+            {
+                 CreationControl("设置", SymbolRegular.Settings24, null)
+            };
+        }
+
+        public NavigationViewItem CreationControl(string name, SymbolRegular icon, Type type)
+        {
+            return new NavigationViewItem()
+            {
+                NavigationCacheMode = NavigationCacheMode.Required,
+                Content = name,
+                Icon = new SymbolIcon { Symbol = icon },
+                TargetPageType = type,
+            };
+        }
+
+        /// <summary>
+        /// 菜单项数据源
+        /// </summary>
+        public ICollection<object> MenuItemsSource
+        {
+            get => GetProperty(() => MenuItemsSource);
+            set => SetProperty(() => MenuItemsSource, value);
+        }
+        /// <summary>
+        /// 底部菜单项数据源
+        /// </summary>
+        public ICollection<object> FooterMenuItemsSource
+        {
+            get => GetProperty(() => FooterMenuItemsSource);
+            set => SetProperty(() => FooterMenuItemsSource, value);
+        }
+    }
+}

+ 29 - 0
src/YSAI.Iot.Daq/YSAI.Iot.Daq.csproj

@@ -0,0 +1,29 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net8.0-windows</TargetFramework>
+    <Nullable>enable</Nullable>
+    <ImplicitUsings>enable</ImplicitUsings>
+    <UseWPF>true</UseWPF>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <None Remove="image\YSAI_One.ico" />
+    <None Remove="image\YSAI_Two.ico" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="WPF-UI" Version="3.0.0-preview.13" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <ProjectReference Include="..\YSAI.Iot.Daq.Core\YSAI.Iot.Daq.Core.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Resource Include="image\YSAI_One.ico" />
+    <Resource Include="image\YSAI_Two.ico" />
+  </ItemGroup>
+
+</Project>

BIN
src/YSAI.Iot.Daq/image/YSAI_One.ico


BIN
src/YSAI.Iot.Daq/image/YSAI_Two.ico