Browse Source

Fix the bug of incorrect pop-up position in WaferDialogView && DeviceTimer.dispose in ResourceMonitor

zhouhr 1 year ago
parent
commit
eb64d0ee5a

+ 0 - 2
Venus/Venus_MainPages/ViewModels/OperationOverViewModel.cs

@@ -552,8 +552,6 @@ namespace Venus_MainPages.ViewModels
             {
                 Owner = Application.Current.MainWindow,
             }; 
-            dialog.Left = Application.Current.MainWindow.Width / 2 - 150;
-            dialog.Top = Application.Current.MainWindow.Height / 2 - 200;
             dialog.Height = 300;
             dialog.Width = 400;
             double angel = 0;

+ 1 - 0
Venus/Venus_MainPages/Views/WaferDialogView.xaml

@@ -6,6 +6,7 @@
              mc:Ignorable="d"
              AllowsTransparency="True"
              WindowStyle="None"
+             WindowStartupLocation="CenterOwner"
              xmlns:local="clr-namespace:Venus_MainPages.Views"
              xmlns:ctrl="http://OpenSEMI.Ctrlib.com/presentation"
              d:DesignHeight="300" d:DesignWidth="400">

+ 9 - 3
Venus/Venus_RT/Modules/ResourceMonitor.cs

@@ -19,6 +19,7 @@ namespace Venus_RT.Modules
         private string processname = Process.GetCurrentProcess().ProcessName;
         private int _stringlen = 20;
         private int threshold = 800;
+        Timer _timer;
         //数据波动监测可用
         //List<double> _Numberofhandlesopened = new List<double>() { };
         //List<double> _Numberofmodules = new List<double>() { };
@@ -88,6 +89,12 @@ namespace Venus_RT.Modules
             Occupytime = "占用时间";
             PrivilegeOccupancytime = "特权占用时间";
             Useroccupiedtime = "用户占用时间";
+            
+        }
+
+        ~ResourceMonitor()
+        {
+            _timer.Dispose();//定时器销毁
         }
 
         public bool Initialize()
@@ -95,9 +102,9 @@ namespace Venus_RT.Modules
             //>0 开启否则不开启
             if (SC.GetValue<int>("System.CheckResourceInterval") > 0)
             {
-                Timer _timer = new Timer();
+                _timer = new Timer();
                 _timer.Enabled = true;
-                _timer.Interval = SC.GetValue<int>("System.CheckResourceInterval") * 60 * 1000;
+                _timer.Interval = SC.GetValue<int>("System.CheckResourceInterval")  * 1000;
                 _timer.Elapsed += GetProcessInfo;
                 _timer.Start();
                 //LOG.Write($"{ProcessName}" +
@@ -129,7 +136,6 @@ namespace Venus_RT.Modules
             return true;
         }
 
-
         private void GetProcessInfo(object sender, ElapsedEventArgs e)
         {
             try