jimmy.jiang@vinno.com 8 сар өмнө
parent
commit
040a56d041

+ 1 - 23
fis/MainWindow.axaml.cs

@@ -198,13 +198,6 @@ namespace fis
             _browserContainer.IsVisible = false;
             //托盘行为事件监听
             TrayIconManager.TrayIconChanged += OnTrayChanged;
-            if (AppManager.IsVStation)
-            {
-                Logger.WriteShellLog("ShowInTaskbar cancelled");
-                ShowInTaskbar = false;
-                Hide();
-    
-            }
         }
 
 
@@ -357,22 +350,7 @@ 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)

+ 5 - 0
fis/Managers/BrowserManager.cs

@@ -218,6 +218,11 @@ 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)

+ 19 - 2
fis/Managers/ExportDataManager.cs

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

+ 8 - 1
fis/Managers/URMImporterManager.cs

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

+ 8 - 1
fis/Managers/UpgradManager.cs

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

+ 1 - 1
fis/PlatformService.cs

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

+ 1 - 0
fis/Program.cs

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