Browse Source

Indroduce vstation slave mode

jimmy.jiang@vinno.com 7 months ago
parent
commit
0e49fa0e5e

BIN
fis.Loader/.vs/ProjectEvaluation/fis.loader.metadata.v2


BIN
fis.Loader/.vs/ProjectEvaluation/fis.loader.metadata.v6.1


BIN
fis.Loader/.vs/ProjectEvaluation/fis.loader.projects.v2


BIN
fis.Loader/.vs/ProjectEvaluation/fis.loader.projects.v6.1


BIN
fis.Loader/.vs/fis.Loader/DesignTimeBuild/.dtbcache.v2


BIN
fis.Loader/.vs/fis.Loader/v17/.suo


+ 6 - 8
fis/App.axaml.cs

@@ -51,14 +51,12 @@ namespace fis
             AvaloniaXamlLoader.Load(this);
             DataContext = new AppViewModel();
             Logger.WriteShellLog("App initialize end");
-            //Task.Run(() => {
-            //    Thread.Sleep(10000);
-            //    var asd=AudioRecorderHelpler.GetAudioDevices(AudioDeviceTypeEnum.Mic);
-            //    var xxx = asd.Last();
-            //    Thread.Sleep(3000);
-            //    AudioRecorderHelpler.SetSystemAudioDevice(xxx);
-            //    ;
-            //});
+            Task.Run(() =>
+            {
+                //Thread.Sleep(10000);
+              var data=  DongleHelper.ReadDongleData();
+                
+            });
         }
 
         public override async void OnFrameworkInitializationCompleted()

+ 4 - 0
fis/IPlatformService.cs

@@ -740,6 +740,10 @@ namespace fis
         /// <param name="x"></param>
         /// <param name="y"></param>
         void SetCursorPosition(int x, int y);
+
+        bool IsVStaionSlave();
+        
+        
     }
 
 }

+ 3 - 0
fis/Managers/AppManager.cs

@@ -48,6 +48,7 @@ namespace fis.Managers
         public static MainWindow MainWindow { get; set; }
 
         public const string SlaveWindowName = "SlaveWindow";
+        public const string SlaveWindowAndVStaionName = "SlaveWindow&VStation";
         public const string MainFisWindowPipe = "MainFisWindowPipe";
         public const string SlaveFisWindowPipe = "SlaveFisWindowPipe";
 
@@ -144,6 +145,8 @@ namespace fis.Managers
         /// </summary>
         public static bool IsSlaveWindow { get; set; } = false;
 
+        public static bool IsVStation { get; set; }=false;
+
         /// <summary>
         /// Current vCloud is cart system or not
         /// </summary>

+ 5 - 0
fis/Managers/PipeServerManager.cs

@@ -130,6 +130,11 @@ namespace fis.Win.Dev.Managers
                                     _secondaryWindowManager.SlaveWindow.Close();
                                 }
                                 break;
+                            case TargetMethodName.AutoLoginWithGivenAccount:
+                                windowType = WindowType.StudyAnalysis;
+                                DoRouter(string.Empty, windowType);
+                                Logger.WriteShellLog($"Workstation:{message}");
+                                break;
                             default:
                                 var bytes = Encoding.UTF8.GetBytes("Invalid message");
                                 Logger.WriteShellLog($"Invalid message:{message}");

+ 1 - 0
fis/Managers/SecondaryWindowManager.cs

@@ -88,6 +88,7 @@ namespace fis.Managers
             }
         }
 
+       
         private void SlaveWindow_Closed(object? sender, EventArgs e)
         {
             IsVisible = false;

+ 4 - 0
fis/PlatformService.cs

@@ -1107,5 +1107,9 @@ namespace fis
             exportManager.ExportDatasAsync(result, path,imageType,videoType);
         }
 
+        public bool IsVStaionSlave()
+        {
+            return AppManager.IsSlaveWindow && AppManager.IsVStation;
+        }
     }
 }

+ 33 - 2
fis/Program.cs

@@ -16,6 +16,8 @@ using NPOI.POIFS.Crypt.Dsig;
 using fis.Utilities;
 using NPOI.SS.Formula.Functions;
 using System.Diagnostics;
+using System.Threading.Tasks;
+using System.Threading;
 
 namespace fis
 {
@@ -35,10 +37,20 @@ namespace fis
             {
                 Logger.Init(new DefaultLogEngine());
             }
-            if (args != null && args.Length > 0 && args[0] == AppManager.SlaveWindowName)
+            if (args != null && args.Length > 0)
             {
-                AppManager.IsSlaveWindow = true;
+                if (args[0] == AppManager.SlaveWindowName)
+                {
+                    AppManager.IsSlaveWindow = true;
+                }
+                if (args[0] == AppManager.SlaveWindowAndVStaionName)
+                {
+                    AppManager.IsSlaveWindow = true;
+                    AppManager.IsVStation = true;
+                    SmileTheVStation();
+                }
             }
+
             Logger.WriteShellLog("HttpHelper warmUp start");
             HttpHelper.WarmUp();
             Logger.WriteShellLog("Main build");
@@ -49,6 +61,25 @@ namespace fis
             Logger.WriteShellLog("Main build end");
         }
 
+        private static void SmileTheVStation()
+        {
+            Task.Run(() =>
+            {
+
+                while (true)
+                {
+                    Thread.Sleep(2500);
+                  var stations=  Process.GetProcessesByName("vStation");
+                    if (stations.Length <= 0)
+                    {
+                       Process.GetCurrentProcess().Kill();
+                    }
+                }
+
+            });
+
+        }
+
         // Avalonia configuration, don't remove; also used by visual designer.
         public static AppBuilder BuildAvaloniaApp(string[] args)
         {

+ 5 - 0
fis/Resources/lang/Chinese.json

@@ -263,5 +263,10 @@
     "Key": "NoData",
     "Content": "未填写",
     "State": 1
+  },
+  {
+    "Key": "StudyAnalysis",
+    "Content": "科研分析",
+    "State": 1
   }
 ]

+ 5 - 0
fis/Resources/lang/English.json

@@ -264,5 +264,10 @@
     "Key": "NoData",
     "Content": "Not filled",
     "State": 1
+  },
+  {
+    "Key": "StudyAnalysis",
+    "Content": "Study Analysis",
+    "State": 1
   }
 ]

+ 15 - 6
fis/SlaveWindow.axaml.cs

@@ -275,19 +275,25 @@ namespace fis
                 case WindowType.LiveCourse:
                     targetMethodName = TargetMethodName.OpenLiveCoursePage;
                     break;
+                case WindowType.StudyAnalysis:
+                    targetMethodName = TargetMethodName.AutoLoginWithGivenAccount;
+                    break;
                 default:
                     targetMethodName = TargetMethodName.OpenMeasurePage;
                     break;
             }
 
             _lastRouteName = targetMethodName;
-            await DoRoute(executeContent);
+            await DoRoute(executeContent,windowType);
         }
 
-        private async Task  DoRoute(string executeContent)
-        {         
-            Logger.WriteShellLog("excute js begin");
-            BrowserManager.SlaveBrowser.ExecuteJavaScript(executeContent);
+        private async Task  DoRoute(string executeContent, WindowType windowType)
+        {
+            if (windowType != WindowType.StudyAnalysis)
+            {
+                Logger.WriteShellLog("excute js begin");
+                BrowserManager.SlaveBrowser.ExecuteJavaScript(executeContent);
+            }
             await Dispatcher.UIThread.InvokeAsync(() =>
             {
                 Logger.WriteShellLog("start show slave window,ShowInTaskbar:" + ShowInTaskbar.ToString());
@@ -328,7 +334,10 @@ namespace fis
                 }
                 Dispatcher.UIThread.InvokeAsync(() =>
                 {
-                    BrowserManager.SlaveBrowser.ExecuteJS(TargetMethodName.RouterToDefaultPage, new List<string>());
+                    if (_lastRouteName != TargetMethodName.AutoLoginWithGivenAccount)
+                    {
+                        BrowserManager.SlaveBrowser.ExecuteJS(TargetMethodName.RouterToDefaultPage, new List<string>());
+                    }
                     _isRoutedOnSecondWindow = false;
                     ShowActivated = false;
                     Hide();

+ 1 - 0
fis/Utilities/TargetMethodName.cs

@@ -97,5 +97,6 @@
         SelectedFilePath,
         /// 安装打印驱动状态变更
         OnInstallPrinterDriverChange,
+        AutoLoginWithGivenAccount,
     }
 }

+ 1 - 0
fis/Utilities/WindowType.cs

@@ -12,5 +12,6 @@
         LiveConsultation,//会诊直播间
         DeviceLive,//设备直播
         LiveCourse,
+        StudyAnalysis
     }
 }