Selaa lähdekoodia

修复PM界面钟摆阀与加热可以打开多个窗体的bug

lixiang 1 vuosi sitten
vanhempi
commit
fdb9fa780e

+ 6 - 0
Venus/Venus_MainPages/Venus_MainPages.csproj.user

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectView>ProjectFiles</ProjectView>
+  </PropertyGroup>
+</Project>

+ 11 - 9
Venus/Venus_MainPages/ViewModels/OverKepler2200AViewModel.cs

@@ -1366,17 +1366,16 @@ namespace Venus_MainPages.ViewModels
         }
         private void OnOpenButterflyValveView()
         {
-            //if (butterflyValveMessageBox == null)
-            //{
-                var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
+            var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
+            if (butterflyValveMessageBox == null || butterflyValveMessageBox.IsVisible == false)
+            {
                 butterflyValveMessageBox = new ButterflyValveView(ModuleName.ToString());
                 butterflyValveMessageBox.WindowStartupLocation = WindowStartupLocation.Manual;
                 butterflyValveMessageBox.Left = 700;
                 butterflyValveMessageBox.Top = 600;
                 butterflyValveMessageBox.Show();
                 butterflyValveMessageBox.Owner = _mainWindow;
-            //}
-           
+            }
         }
         private void OnLoadRecipe()
         {
@@ -1439,10 +1438,13 @@ namespace Venus_MainPages.ViewModels
             }
             AITHeaterData heaterData = obj as AITHeaterData;
             var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
-            heaterView = new HeaterView(heaterData, ModuleName);
-            heaterView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
-            heaterView.Owner = _mainWindow;
-            heaterView.Show();
+            if (heaterView == null || heaterView.IsVisible == false)
+            {
+                heaterView = new HeaterView(heaterData, ModuleName);
+                heaterView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
+                heaterView.Owner = _mainWindow;
+                heaterView.Show();
+            }
         }
         private void OnOnline()
         {

+ 16 - 13
Venus/Venus_MainPages/ViewModels/OverKepler2200BViewModel.cs

@@ -1365,16 +1365,16 @@ namespace Venus_MainPages.ViewModels
         }
         private void OnOpenButterflyValveView()
         {
-            //if (butterflyValveMessageBox == null)
-            //{
             var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
-            butterflyValveMessageBox = new ButterflyValveView(ModuleName.ToString());
-            butterflyValveMessageBox.WindowStartupLocation = WindowStartupLocation.Manual;
-            butterflyValveMessageBox.Left = 700;
-            butterflyValveMessageBox.Top = 600;
-            butterflyValveMessageBox.Show();
-            butterflyValveMessageBox.Owner = _mainWindow;
-            //}
+            if (butterflyValveMessageBox == null || butterflyValveMessageBox.IsVisible == false)
+            {
+                butterflyValveMessageBox = new ButterflyValveView(ModuleName.ToString());
+                butterflyValveMessageBox.WindowStartupLocation = WindowStartupLocation.Manual;
+                butterflyValveMessageBox.Left = 700;
+                butterflyValveMessageBox.Top = 600;
+                butterflyValveMessageBox.Show();
+                butterflyValveMessageBox.Owner = _mainWindow;
+            }
 
         }
         private void OnLoadRecipe()
@@ -1438,10 +1438,13 @@ namespace Venus_MainPages.ViewModels
             }
             AITHeaterData heaterData = obj as AITHeaterData;
             var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
-            heaterView = new HeaterView(heaterData, ModuleName);
-            heaterView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
-            heaterView.Owner = _mainWindow;
-            heaterView.Show();
+            if (heaterView == null || heaterView.IsVisible == false)
+            {
+                heaterView = new HeaterView(heaterData, ModuleName);
+                heaterView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
+                heaterView.Owner = _mainWindow;
+                heaterView.Show();
+            }
         }
         private void OnOnline()
         {

+ 16 - 10
Venus/Venus_MainPages/ViewModels/OverKepler2300ViewModel.cs

@@ -1336,12 +1336,15 @@ namespace Venus_MainPages.ViewModels
         private void OnOpenButterflyValveView()
         {
             var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
-            butterflyValveMessageBox = new ButterflyValveView(ModuleName.ToString());
-            butterflyValveMessageBox.WindowStartupLocation = WindowStartupLocation.Manual;
-            butterflyValveMessageBox.Left = 700;
-            butterflyValveMessageBox.Top = 600;
-            butterflyValveMessageBox.Show();
-            butterflyValveMessageBox.Owner = _mainWindow;
+            if (butterflyValveMessageBox == null || butterflyValveMessageBox.IsVisible == false)
+            {
+                butterflyValveMessageBox = new ButterflyValveView(ModuleName.ToString());
+                butterflyValveMessageBox.WindowStartupLocation = WindowStartupLocation.Manual;
+                butterflyValveMessageBox.Left = 700;
+                butterflyValveMessageBox.Top = 600;
+                butterflyValveMessageBox.Show();
+                butterflyValveMessageBox.Owner = _mainWindow;
+            }
         }
         private void OnLoadRecipe()
         {
@@ -1432,10 +1435,13 @@ namespace Venus_MainPages.ViewModels
             }
             AITHeaterData heaterData = obj as AITHeaterData;
             var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
-            heaterView = new HeaterView(heaterData, ModuleName);
-            heaterView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
-            heaterView.Owner = _mainWindow;
-            heaterView.Show();
+            if (heaterView == null || heaterView.IsVisible == false)
+            {
+                heaterView = new HeaterView(heaterData, ModuleName);
+                heaterView.WindowStartupLocation = WindowStartupLocation.CenterScreen;
+                heaterView.Owner = _mainWindow;
+                heaterView.Show();
+            }
         }
 
         private void OnEndStep()

+ 9 - 9
Venus/Venus_MainPages/ViewModels/OverVenusViewModel.cs

@@ -1356,16 +1356,16 @@ namespace Venus_MainPages.ViewModels
         }
         private void OnOpenButterflyValveView()
         {
-            //if (butterflyValveMessageBox == null)
-            //{
             var _mainWindow = Application.Current.Windows.Cast<Window>().FirstOrDefault(window => window is Window) as Window;
-            butterflyValveMessageBox = new ButterflyValveView(ModuleName.ToString());
-            butterflyValveMessageBox.WindowStartupLocation = WindowStartupLocation.Manual;
-            butterflyValveMessageBox.Left = 700;
-            butterflyValveMessageBox.Top = 600;
-            butterflyValveMessageBox.Show();
-            butterflyValveMessageBox.Owner = _mainWindow;
-            //}
+            if (butterflyValveMessageBox == null || butterflyValveMessageBox.IsVisible == false)
+            {
+                butterflyValveMessageBox = new ButterflyValveView(ModuleName.ToString());
+                butterflyValveMessageBox.WindowStartupLocation = WindowStartupLocation.Manual;
+                butterflyValveMessageBox.Left = 700;
+                butterflyValveMessageBox.Top = 600;
+                butterflyValveMessageBox.Show();
+                butterflyValveMessageBox.Owner = _mainWindow;
+            }
 
         }
         private void OnLoadRecipe()