jimmy.jiang@vinno.com 8 月之前
父节点
当前提交
e18502b36c

+ 31 - 0
fis/MainWindow.axaml.cs

@@ -25,6 +25,7 @@ using Vinno.Modules.ExamInfoModule;
 using NPOI.POIFS.Properties;
 using System.IO;
 using Avalonia.Visuals.Media.Imaging;
+using System.ComponentModel;
 
 namespace fis
 {
@@ -197,8 +198,22 @@ namespace fis
             _browserContainer.IsVisible = false;
             //托盘行为事件监听
             TrayIconManager.TrayIconChanged += OnTrayChanged;
+            if (AppManager.IsVStation)
+            {
+                Logger.WriteShellLog("ShowInTaskbar cancelled");
+                ShowInTaskbar = false;
+                var windowTitleBar = this.FindControl<WindowsTitleBar>("WinTitleBar");
+                if (windowTitleBar != null)
+                {
+                    windowTitleBar.IsVisible = true;
+                    windowTitleBar.Height = 32;
+                }
+                Hide();
+    
+            }
         }
 
+
         private System.IO.Stream  GetBgImage()
         {
             var resourcesManager = AppManager.Get<IResourceManager>();
@@ -348,6 +363,22 @@ namespace fis
             }));
         }
 
+        protected override void OnClosing(CancelEventArgs e)
+        {
+            ///若非强制关闭副窗口,则隐藏副窗口
+            ///用于保持Flutter在内存中不被销毁
+            if (!AppManager.IsVStation)
+            {
+                OnClosing(e);
+            }
+            else
+            {
+                e.Cancel = true;
+                ShowActivated = false;
+                Hide();
+            }
+        }
+
         private void OnBrowserCloseTheWindow(object? sender, string e)
         {
             if (e == WindowName)

+ 0 - 5
fis/Managers/BrowserManager.cs

@@ -218,11 +218,6 @@ namespace fis.Managers
                 Logger.WriteShellLog("Get Main browser");
                 if (_mainBrowser == null)
                 {
-                    if (AppManager.IsVStation)
-                    {
-                        Logger.WriteShellLog("Get Main browser converted to slave browser");
-                        return SlaveBrowser;
-                    }
                     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                     {
                         _mainBrowser = new WinFisBrowser(_platformService)

+ 2 - 17
fis/Managers/ExportDataManager.cs

@@ -63,14 +63,7 @@ namespace fis.Win.Dev.Managers
 
         private void UpdateProgress(List<string> args)
         {
-            if (AppManager.IsVStation)
-            {
-                BrowserManager.SlaveBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
-            else
-            {
-                BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
+            BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
         }
 
         public async void ExportDatas(List<ExportDataInfo> exportDataInfos, string name, string path)
@@ -116,15 +109,7 @@ namespace fis.Win.Dev.Managers
                 var dialog = new OpenFolderDialog();
                 dialog.Directory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                 Window window;
-                if (AppManager.IsVStation)
-                {
-                    var manager = AppManager.Get<ISecondaryWindowManager>();
-                    window = manager.SlaveWindow;
-                }
-                else 
-                {
-                    window = AppManager.MainWindow;
-                }
+                window = AppManager.MainWindow;
                 var result = await dialog.ShowAsync(window);
                 if (result != null)
                 {

+ 1 - 8
fis/Managers/FileExporterManager.cs

@@ -1070,14 +1070,7 @@ namespace fis.Managers
 
         private void UpdateProgress(List<string> args)
         {
-            if (AppManager.IsVStation) 
-            {
-                BrowserManager.SlaveBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
-            else
-            {
-                BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
+            BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
         }
         #endregion
 

+ 2 - 0
fis/Managers/PipeServerManager.cs

@@ -35,10 +35,12 @@ namespace fis.Win.Dev.Managers
             Task.Factory.StartNew(() => ReceiveMessage());
         }
 
+     
         private static void ReceiveMessage()
         {
             try
             {
+               
                 while (_server.IsConnected)
                 {
                     var count = _server.Read(_receiveData, 0, _receiveData.Length);

+ 1 - 7
fis/Managers/URMImporterManager.cs

@@ -98,13 +98,7 @@ namespace fis.Win.Dev.Managers
               ((int)ExportStatus.Downloading).ToString(),
                id,
             };
-            if (AppManager.IsVStation)
-            {
-                BrowserManager.SlaveBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
-            else {
-                BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
+            BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
         }
 
     }

+ 1 - 8
fis/Managers/UpgradManager.cs

@@ -162,14 +162,7 @@ namespace  fis.Managers
 
         private void UpdateProgress(List<string> args)
         {
-            if (AppManager.IsVStation) 
-            {
-                BrowserManager.SlaveBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
-            else
-            {
-                BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
-            }
+            BrowserManager.MainBrowser.ExecuteJS(TargetMethodName.UpdateExportProgess, args);
         }
     }
 

+ 1 - 1
fis/PlatformService.cs

@@ -1114,7 +1114,7 @@ namespace fis
 
         public bool IsVStaionSlave()
         {
-            return AppManager.IsSlaveWindow&&AppManager.IsVStation;
+            return AppManager.IsVStation;
         }
     }
 }

+ 1 - 2
fis/Program.cs

@@ -46,9 +46,8 @@ namespace fis
                 }
                 if (args[0] == AppManager.SlaveWindowAndVStaionName)
                 {
-                    AppManager.IsSlaveWindow = true;
                     AppManager.IsVStation = true;
-    
+ 
                     SmileTheVStation();
                 }
             }