Browse Source

fix mes crash

Robert 1 year ago
parent
commit
243cda0cdf

+ 4 - 4
MesAdaptor/Properties/AssemblyInfo.cs

@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.9.3.0")]
-[assembly: AssemblyVersion("1.9.3.0")]
-[assembly: AssemblyFileVersion("1.9.3.0")]
-[assembly: AssemblyInformationalVersion("4cf1d59")]
+// [assembly: AssemblyVersion("1.0.2.0")]
+[assembly: AssemblyVersion("1.0.2.0")]
+[assembly: AssemblyFileVersion("1.0.2.0")]
+[assembly: AssemblyInformationalVersion("7811547")]

+ 7 - 0
ST-LINK_MES/App.xaml.cs

@@ -18,5 +18,12 @@ namespace ST_LINK_MES
         {
             AppSettingService.Instance.Load();
         }
+
+        protected override void OnExit(ExitEventArgs e)
+        {
+            var stopResult = SajetConnect.SajetTransClose();
+
+            base.OnExit(e);
+        }
     }
 }

+ 9 - 5
ST-LINK_MES/MainWindow.xaml.cs

@@ -61,8 +61,6 @@ namespace ST_LINK_MES
                 BinPath = uxBinFilePath.Text
             };
             currentSetting.Save(setting);
-
-            var stopResult = SajetConnect.SajetTransClose();
         }
 
         private void MainWindow_Loaded(object sender, RoutedEventArgs e)
@@ -160,13 +158,17 @@ namespace ST_LINK_MES
             {
                 reportDatas.Add(logData.Key, logData.Value, true);
             }
-            SajetConnect.SajetTransReport(reportDatas);
+            this.Dispatcher.Invoke(() => { 
+                SajetConnect.SajetTransReport(reportDatas);
+            });
 
             if (!result.IsSuccess)
             {
                 var errCode = GetErrorCode(result.Step);
                 //report
-                SajetConnect.SajetTranFinishFail(errCode);
+                this.Dispatcher.Invoke(() => {
+                    SajetConnect.SajetTranFinishFail(errCode);
+                });
                 resultDialog.MouseDown += ResultDialog_MouseDown;
                 resultDialog.ShowResult(false);
             }
@@ -174,7 +176,9 @@ namespace ST_LINK_MES
             if (result.IsSuccess)
             {
                 //report
-                SajetConnect.SajetTranFinishSuccess();
+                this.Dispatcher.Invoke(() => {
+                    SajetConnect.SajetTranFinishSuccess();
+                });
                 resultDialog.MouseDown += ResultDialog_MouseDown;
                 resultDialog.ShowResult(true);
             }

+ 4 - 3
ST-LINK_MES/Properties/AssemblyInfo.cs

@@ -50,6 +50,7 @@ using System.Windows;
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.1.0")]
-[assembly: AssemblyFileVersion("1.0.1.0")]
+// [assembly: AssemblyVersion("1.0.2.0")]
+[assembly: AssemblyVersion("1.0.2.0")]
+[assembly: AssemblyFileVersion("1.0.2.0")]
+[assembly: AssemblyInformationalVersion("7811547")]