[UI.Client]
简化进入ReadOnly模式时RecipeEditor和PMProcess视图的操作逻辑,仅锁定Recipe,不处理锁定窗口的IsEnabled属性。MainView统一处理鼠标和键盘输入逻辑。
This commit is contained in:
parent
4fff7bb521
commit
c4605ac278
|
@ -17,9 +17,7 @@ using System.Windows.Input;
|
|||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
using System.IO;
|
||||
using MECF.Framework.Common.Account;
|
||||
using MECF.Framework.Common.Account.Permissions;
|
||||
using MECF.Framework.UI.Client.CenterViews.Configs.Roles;
|
||||
using MECF.Framework.UI.Client.Core;
|
||||
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
|
||||
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel;
|
||||
|
@ -29,7 +27,7 @@ using MECF.Framework.UI.Core.Accounts;
|
|||
|
||||
namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
||||
{
|
||||
public class RecipeEditorViewModel : UiViewModelBase, IHandle<UserMode>, IHandle<CommonAggregatedEvents> //BaseModel
|
||||
public class RecipeEditorViewModel : UiViewModelBase, IHandle<UserMode>, IHandle<CommonAggregateEvents> //BaseModel
|
||||
{
|
||||
|
||||
#region Variables
|
||||
|
@ -353,9 +351,6 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
|||
|
||||
UpdateView();
|
||||
|
||||
// 如果在ReadOnly模式,则禁止解锁Recipe。
|
||||
((RecipeEditorView)View!).editorLocker.IsEnabled = BaseApp.Instance.UserMode != UserMode.ReadOnly;
|
||||
|
||||
base.OnActivate();
|
||||
}
|
||||
|
||||
|
@ -1843,23 +1838,20 @@ namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
|||
}
|
||||
}
|
||||
|
||||
public void Handle(CommonAggregatedEvents evt)
|
||||
public void Handle(CommonAggregateEvents message)
|
||||
{
|
||||
switch (evt)
|
||||
switch (message)
|
||||
{
|
||||
case CommonAggregatedEvents.EnterReadOnlyMode:
|
||||
// 如果在白名单编辑模式,则退出
|
||||
case CommonAggregateEvents.EnterReadOnlyMode:
|
||||
if (CurrentRecipe.IsAccessibleWhitelistEditMode)
|
||||
CurrentRecipe.LeaveAccessibleWhitelistEditMode().Wait();
|
||||
|
||||
// 立即锁定Recipe
|
||||
if (View is RecipeEditorView view)
|
||||
{
|
||||
view.editorLocker.IsEnabled = false;
|
||||
view.editorLocker.Lock();
|
||||
CurrentRecipe.LeaveAccessibleWhitelistEditMode().Wait();
|
||||
_editMode = EditMode.Normal;
|
||||
}
|
||||
break;
|
||||
|
||||
if (View is RecipeEditorView v)
|
||||
v.editorLocker.Lock();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ using MECF.Framework.UI.Core.Accounts;
|
|||
|
||||
namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
||||
{
|
||||
public class PMProcessViewModel : SicModuleUIViewModelBase, ISupportMultipleSystem, IHandle<CommonAggregatedEvents>
|
||||
public class PMProcessViewModel : SicModuleUIViewModelBase, ISupportMultipleSystem, IHandle<CommonAggregateEvents>
|
||||
{
|
||||
private double _tmaFlowRatio = 1;
|
||||
private double _tcsFlowRatio = 1;
|
||||
|
@ -362,7 +362,6 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
UpdateRecipeFormat();
|
||||
// 更新Recipe参数值显示状态
|
||||
SetRecipeValueVisibilityByCurrentRole();
|
||||
((PMProcessView)View)?.recipeLocker.Lock();
|
||||
|
||||
//流量需要乘以此系数
|
||||
//_tmaFlowRatio = (double)QueryDataClient.Instance.Service.GetConfig($"PM.{SystemName}.TMAFlowRatio");
|
||||
|
@ -1789,20 +1788,15 @@ namespace MECF.Framework.UI.Client.CenterViews.Modules.PM
|
|||
|
||||
}
|
||||
|
||||
public void Handle(CommonAggregatedEvents evt)
|
||||
public void Handle(CommonAggregateEvents message)
|
||||
{
|
||||
switch (evt)
|
||||
switch (message)
|
||||
{
|
||||
case CommonAggregatedEvents.EnterReadOnlyMode:
|
||||
// 锁定Recipe
|
||||
if (View is PMProcessView view)
|
||||
{
|
||||
view.recipeLocker.IsEnabled = false;
|
||||
view.recipeLocker.Lock();
|
||||
}
|
||||
case CommonAggregateEvents.EnterReadOnlyMode:
|
||||
if(View is PMProcessView v)
|
||||
v.recipeLocker.Lock();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,6 @@
|
|||
namespace MECF.Framework.UI.Client.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 可用于EventAggregator发布和订阅的事件枚举。
|
||||
/// </summary>
|
||||
public enum CommonAggregatedEvents
|
||||
public enum CommonAggregateEvents
|
||||
{
|
||||
/// <summary>
|
||||
/// 锁定Recipe编辑器
|
||||
/// </summary>
|
||||
LockRecipeEditor,
|
||||
|
||||
/// <summary>
|
||||
/// 进入只读模式
|
||||
/// </summary>
|
||||
EnterReadOnlyMode
|
||||
}
|
Loading…
Reference in New Issue