|
|
@@ -8,6 +8,7 @@ using FurnaceUI.Models;
|
|
|
using FurnaceUI.Views.Editors;
|
|
|
using MECF.Framework.Common.CommonData;
|
|
|
using MECF.Framework.Common.DataCenter;
|
|
|
+using MECF.Framework.Common.OperationCenter;
|
|
|
using MECF.Framework.Common.Utilities;
|
|
|
using MECF.Framework.UI.Client.CenterViews.Editors;
|
|
|
using MECF.Framework.UI.Client.CenterViews.Editors.Recipe;
|
|
|
@@ -22,6 +23,7 @@ using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
using System.Linq;
|
|
|
+using System.Threading;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
using System.Windows.Input;
|
|
|
@@ -2219,11 +2221,26 @@ namespace FurnaceUI.Views.Recipes
|
|
|
private string oldName { get; set; }
|
|
|
|
|
|
private string oldStepName { get; set; }
|
|
|
-
|
|
|
+ private Timer locktimer;
|
|
|
+ public void RequestRecipeEditLock()
|
|
|
+ {
|
|
|
+ locktimer?.Dispose();
|
|
|
+ locktimer = new Timer(LockCallBack, null, 0, 5000);
|
|
|
+ }
|
|
|
+ void LockCallBack(object state)
|
|
|
+ {
|
|
|
+ InvokeClient.Instance.Service.DoOperation("RecipeEditLock", true);
|
|
|
+ }
|
|
|
private bool PopupPage()
|
|
|
{
|
|
|
+ if (QueryDataClient.Instance.Service.GetData("RecipeEditLock") is bool locked && locked)
|
|
|
+ {
|
|
|
+ DialogBox.ShowInfo($"Others is editing recipe{Environment.NewLine}Please wait...");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
if (CurrentFileNode == null || !CurrentFileNode.IsFile)
|
|
|
return false;
|
|
|
+
|
|
|
var windowManager = IoC.Get<IWindowManager>();
|
|
|
RecipeProcessEditViewModel recipeEditViewModel = new RecipeProcessEditViewModel(CurrentFileNode.PrefixPath, CurrentFileNode.FullPath, CurrentFileNode.Permission);
|
|
|
recipeEditViewModel.SetParent(Window.GetWindow((UIElement)GetView()));
|
|
|
@@ -2234,15 +2251,26 @@ namespace FurnaceUI.Views.Recipes
|
|
|
{
|
|
|
recipeEditViewModel.SelectedStepName = oldStepName;
|
|
|
}
|
|
|
- bool? bret = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeEditViewModel, this, null, $"Recipe Edit");
|
|
|
- if (recipeEditViewModel.CurrentRecipe != null && recipeEditViewModel.selectStep != null)
|
|
|
+ RequestRecipeEditLock();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ bool? bret = (windowManager as WindowManager)?.ShowDialogWithTitle(recipeEditViewModel, this, null, $"Recipe Edit");
|
|
|
+ if (recipeEditViewModel.CurrentRecipe != null && recipeEditViewModel.selectStep != null)
|
|
|
+ {
|
|
|
+ oldPrefix = recipeEditViewModel.CurrentRecipe.PrefixPath;
|
|
|
+ oldName = recipeEditViewModel.CurrentRecipe.Name;
|
|
|
+ oldStepName = recipeEditViewModel.SelectedRecipeStep.Name;
|
|
|
+ }
|
|
|
+ return bret == true;
|
|
|
+
|
|
|
+ }
|
|
|
+ finally
|
|
|
{
|
|
|
- oldPrefix = recipeEditViewModel.CurrentRecipe.PrefixPath;
|
|
|
- oldName = recipeEditViewModel.CurrentRecipe.Name;
|
|
|
- oldStepName = recipeEditViewModel.SelectedRecipeStep.Name;
|
|
|
+ this.locktimer?.Dispose();
|
|
|
+ InvokeClient.Instance.Service.DoOperation("RecipeEditLock", false);
|
|
|
}
|
|
|
|
|
|
- return bret == true;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|