[UI.Client]

修正PMProcessView视图打开ProcessMonitor的方式,现在ProcessMonitor视图在Overview视图中注册,此视图中通过EventAggregator响Overview视图发送打开Monitor之消息。
This commit is contained in:
SL 2023-07-03 17:07:43 +08:00
parent 60b130336e
commit 2a53c3a045
3 changed files with 20 additions and 18 deletions

View File

@ -26,6 +26,7 @@ using System.Dynamic;
using Aitex.Core.RT.Device.PmDevices;
using MECF.Framework.RT.EquipmentLibrary.HardwareUnits.MfcCalculation;
using SicUI.Models.PMs;
using SciChart.Core.Messaging;
namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
{
@ -1710,25 +1711,12 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
/// </summary>
public void ShowMonitorWindow()
{
var wins = Application.Current.Windows.OfType<ProcessMonitorView>().ToArray();
if (wins.Any())
{
foreach (var w in wins)
{
if (w.WindowState == WindowState.Minimized)
w.WindowState = WindowState.Normal;
w.Show();
w.Activate();
}
}
// 给 OverviewViewModel 发消息打开Monitor窗口。
if (EventAggregator?.HandlerExistsFor(typeof(ShowCloseMonitorWinEvent)) == true)
EventAggregator?.PublishOnUIThread(new ShowCloseMonitorWinEvent(true));
else
{
var wm = new WindowManager();
var model = new ProcessMonitorViewModel();
dynamic settings = new ExpandoObject();
settings.WindowStartupLocation = WindowStartupLocation.CenterOwner;
wm.ShowWindow(model, null, settings);
}
MessageBox.Show("The process has not been activated, please open Operation->Overview tab to activate the process.", "Warn",
MessageBoxButton.OK, MessageBoxImage.Warning);
}
}

View File

@ -0,0 +1,13 @@
namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
{
public class ShowCloseMonitorWinEvent
{
public ShowCloseMonitorWinEvent(bool isShow)
{
IsShow = isShow;
}
public bool IsShow { get; }
}
}

View File

@ -243,6 +243,7 @@
<Compile Include="CenterViews\Modules\PM\PMProcessViewModel.cs" />
<Compile Include="CenterViews\Modules\PM\ProcessMonitorView.xaml.cs" />
<Compile Include="CenterViews\Modules\PM\ProcessMonitorViewModel.cs" />
<Compile Include="CenterViews\Modules\PM\ShowCloseMonitorWinEvent.cs" />
<Compile Include="Ctrlib\Controls\PanelLocker.xaml.cs">
<DependentUpon>PanelLocker.xaml</DependentUpon>
</Compile>