|
|
@@ -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"]; }); }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|