lixun 2 anni fa
parent
commit
02060535e7

+ 23 - 2
src/YSAI.DAQ/YSAI.Manage.Windows/MainWindow.xaml

@@ -5,10 +5,31 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:YSAI.Manage.Windows"
         xmlns:base="clr-namespace:YSAI.Window;assembly=YSAI.Window"
+        xmlns:hm="clr-namespace:YSAI.Controls.hamburgermenu;assembly=YSAI.Controls"
+        xmlns:tc="clr-namespace:YSAI.Controls.transition;assembly=YSAI.Controls"
         Icon="YSAI_One.ico" 
         FontFamily="{DynamicResource AllFontFamily}" WindowStartupLocation="CenterScreen" IsContentBackgroundPicture="True"
-        Title="采集库调试工具" Height="800" Width="900">
+        Title="采集库调试工具">
+    <Window.DataContext>
+        <local:MainWindowController/>
+    </Window.DataContext>
     <Grid>
-
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="auto"/>
+            <ColumnDefinition Width="*"/>
+        </Grid.ColumnDefinitions>
+        <Border Grid.Column="0" Margin="0,0,0,0">
+            <Border.Effect>
+                <DropShadowEffect BlurRadius="10" ShadowDepth="5"  Opacity="0.1" Direction="-10"/>
+            </Border.Effect>
+            <hm:HamburgerMenu ToWidth="100" Background="{DynamicResource Follow.Style.Background}" MenuIconColor="{DynamicResource Follow.Style.ImageColor}"  HorizontalAlignment="Left" x:Name="hmc">
+                <hm:HamburgerMenu.Content>
+                    <hm:HamburgerMenuItem  Icon="{DynamicResource AboutUs}"  Text="关于" ToolTip="关于我们" SelectionIndicatorColor="{DynamicResource Follow.Style.ImageColor}" Foreground="{DynamicResource Follow.Style.Foreground}"  SelectionCommand="{Binding AboutUs}"/>
+                </hm:HamburgerMenu.Content>
+            </hm:HamburgerMenu>
+        </Border>
+        <tc:TransitionControl IsActive="{Binding TransitionIsActive}" Type="Zoom" Grid.Column="1">
+            <ContentControl Content="{Binding UserControl}" />
+        </tc:TransitionControl>
     </Grid>
 </base:WindowBase>

+ 103 - 0
src/YSAI.DAQ/YSAI.Manage.Windows/MainWindowController.cs

@@ -0,0 +1,103 @@
+using YSAI.Langs;
+using YSAI.Mvvm;
+using YSAI.Window;
+using YSAI.WindowMessage;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection.Metadata;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows.Input;
+using MessageBox = YSAI.WindowMessage.MessageBox;
+using YSAI.Tool.Windows.aboutUs;
+
+namespace YSAI.Manage.Windows
+{
+    public class MainWindowController : NotifyObject
+    {
+        public MainWindowController()
+        {
+            //绑定触发事件
+            LangsHelper.OnLangSwitchEvent += LangsHelper_OnLangSwitchEvent;
+            //设置初始语言
+            LangsHelper.SetLangs(LangsHelper.GetLangs());
+            //当皮肤切换触发事件
+            WindowHelper.OnSkinSwitchEvent += WindowHelper_OnSkinSwitchEvent;
+            //添加控件集合
+            UserControls.AddOrUpdate("AboutUsTool", new AboutUsTool(), (k, v) => new AboutUsTool());
+            //打开动画
+            TransitionIsActive = true;
+            //显示用户控件
+            UserControl = UserControls["AboutUsTool"];
+        }
+        /// <summary>
+        /// 语言切换了发生的通知
+        /// </summary>
+        private void LangsHelper_OnLangSwitchEvent(object? sender, EventArgs e)
+        {
+            
+        }
+
+        /// <summary>
+        /// 当皮肤切换发送通知
+        /// </summary>
+        private void WindowHelper_OnSkinSwitchEvent(object? sender, object e)
+        {
+
+        }
+
+
+        /// <summary>
+        /// 展示的地方
+        /// </summary>
+        public object UserControl
+        {
+            get => GetProperty(() => UserControl);
+            set
+            {
+                if (value != UserControl)
+                {
+                    TransitionIsActive = true;
+                    SetProperty(() => UserControl, value);
+                    False();
+                }
+            }
+        }
+        /// <summary>
+        /// 动画状态
+        /// </summary>
+        public bool TransitionIsActive
+        {
+            get => GetProperty(() => TransitionIsActive);
+            set => SetProperty(() => TransitionIsActive, value);
+        }
+        /// <summary>
+        /// 关闭动画
+        /// </summary>
+        private void False()
+        {
+            Task.Run(() => {
+                Thread.Sleep(300);
+                System.Windows.Application.Current?.Dispatcher?.InvokeAsync(new Action(() =>
+                {
+                    TransitionIsActive = false;
+                }));
+            });
+        }
+        /// <summary>
+        /// 控件集合
+        /// </summary>
+        ConcurrentDictionary<string, UserControl> UserControls = new ConcurrentDictionary<string, UserControl>();
+
+        /// <summary>
+        /// 关于页面
+        /// </summary>
+        public ICommand AboutUs { get => new CommandX(() => { UserControl = UserControls["AboutUsTool"]; }); }
+
+
+    }
+}

+ 4 - 0
src/YSAI.DAQ/YSAI.Tool.Windows/YSAI.Tool.Windows.csproj

@@ -11,4 +11,8 @@
     <ProjectReference Include="..\YSAI.WindowMessage\YSAI.WindowMessage.csproj" />
   </ItemGroup>
 
+  <ItemGroup>
+    <Folder Include="config\" />
+  </ItemGroup>
+
 </Project>

+ 10 - 0
src/YSAI.DAQ/YSAI.Tool.Windows/aboutUs/AboutUsTool.xaml

@@ -0,0 +1,10 @@
+<UserControl x:Class="YSAI.Tool.Windows.aboutUs.AboutUsTool"
+             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:YSAI.Tool.Windows.aboutUs" Height="500" Width="1500">
+    <Grid>
+        <WebBrowser Source="http://www.yuanshan-ai.com/list/45.html" Height="auto" Width="auto" />
+    </Grid>
+</UserControl>

+ 28 - 0
src/YSAI.DAQ/YSAI.Tool.Windows/aboutUs/AboutUsTool.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 YSAI.Tool.Windows.aboutUs
+{
+    /// <summary>
+    /// AboutUsTool.xaml 的交互逻辑
+    /// </summary>
+    public partial class AboutUsTool : UserControl
+    {
+        public AboutUsTool()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 13 - 0
src/YSAI.DAQ/YSAI.Tool.Windows/aboutUs/AboutUsToolController.cs

@@ -0,0 +1,13 @@
+using YSAI.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace YSAI.Tool.Windows.aboutUs
+{
+    public class AboutUsToolController: NotifyObject
+    {
+    }
+}