101 lines
3.2 KiB
C#
101 lines
3.2 KiB
C#
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Input;
|
|
using MECF.Framework.UI.Client.Ctrlib.Controls;
|
|
using MECF.Framework.UI.Client.RecipeEditorLib.DGExtension.CustomColumn;
|
|
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel;
|
|
using MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params;
|
|
using DataGridRowEventArgs = ExtendedGrid.Microsoft.Windows.Controls.DataGridRowEventArgs;
|
|
using ExDataGridRow = ExtendedGrid.Microsoft.Windows.Controls.DataGridRow;
|
|
|
|
namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for RecipePM1View.xaml
|
|
/// </summary>
|
|
public partial class RecipeEditorView
|
|
{
|
|
public RecipeEditorView()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
EditorDataGridTemplateColumnBase _PreColumn = null;
|
|
|
|
private void DgCustom_OnLoadingRow(object sender, DataGridRowEventArgs e)
|
|
{
|
|
e.Row.Selected += RowOnSelected;
|
|
e.Row.Unselected += RowOnUnselected;
|
|
}
|
|
|
|
private void DgCustom_OnUnloadingRow(object sender, DataGridRowEventArgs e)
|
|
{
|
|
e.Row.Selected -= RowOnSelected;
|
|
e.Row.Unselected -= RowOnUnselected;
|
|
}
|
|
|
|
private void RowOnSelected(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!(e.Source is ExDataGridRow dgr))
|
|
return;
|
|
|
|
if (!(dgr.DataContext is RecipeStep recipeStep))
|
|
return;
|
|
|
|
var param = recipeStep.FindParamByControlName(RecipeControlNames.STEP_NO);
|
|
if (param is StepParam sp)
|
|
{
|
|
sp.IsChecked = true;
|
|
}
|
|
}
|
|
|
|
|
|
private void RowOnUnselected(object sender, RoutedEventArgs e)
|
|
{
|
|
if (!(e.Source is ExDataGridRow dgr))
|
|
return;
|
|
|
|
if (!(dgr.DataContext is RecipeStep recipeStep))
|
|
return;
|
|
|
|
var param = recipeStep.FindParamByControlName(RecipeControlNames.STEP_NO);
|
|
if (param is StepParam sp)
|
|
{
|
|
sp.IsChecked = false;
|
|
}
|
|
}
|
|
|
|
private void UIElement_OnPreviewMouseDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if (DataContext is RecipeEditorViewModel vm)
|
|
{
|
|
// 仅在编辑AccessPermissionWhitelist编辑模式下有效。
|
|
if (!vm.IsCellAccessPermissionEditMode)
|
|
return;
|
|
|
|
if (sender is Border bdr && bdr.DataContext is Param param)
|
|
{
|
|
if (param.IsHighlighted)
|
|
param.ResetHighlight();
|
|
else
|
|
param.Highlight();
|
|
}
|
|
|
|
vm.CountHaveAccessPermParams();
|
|
//vm.SelectedGridCellCollection = e.AddedCells;
|
|
//vm.ToggleCellAccessPermissionWhitelistMark();
|
|
}
|
|
}
|
|
|
|
private void btnLock_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
editorLocker.Lock();
|
|
}
|
|
|
|
private void btnChangePassword_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var dlg = new PanelLockerPasswordChanger();
|
|
dlg.ShowDialog();
|
|
}
|
|
}
|
|
}
|