2023-03-03 15:42:13 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows;
|
2023-03-14 15:03:45 +08:00
|
|
|
|
using MECF.Framework.UI.Client.Ctrlib.Controls;
|
2023-03-03 15:42:13 +08:00
|
|
|
|
using OpenSEMI.Controls.Controls;
|
|
|
|
|
using RecipeEditorLib.DGExtension.CustomColumn;
|
|
|
|
|
using RecipeEditorLib.RecipeModel.Params;
|
|
|
|
|
using DataGridRowEventArgs = ExtendedGrid.Microsoft.Windows.Controls.DataGridRowEventArgs;
|
|
|
|
|
using ExDataGridRow = ExtendedGrid.Microsoft.Windows.Controls.DataGridRow;
|
|
|
|
|
|
|
|
|
|
namespace SicUI.Models.RecipeEditors
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for RecipePM1View.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class RecipeEditorView
|
|
|
|
|
{
|
|
|
|
|
public RecipeEditorView()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
EditorDataGridTemplateColumnBase _PreColumn = null;
|
2023-03-14 15:03:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region Events
|
|
|
|
|
|
|
|
|
|
|
2023-03-03 15:42:13 +08:00
|
|
|
|
private void dgCustom_CurrentCellChanged(object sender, System.EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var datagrid = sender as XDataGrid;
|
|
|
|
|
if (datagrid == null) return;
|
|
|
|
|
var column = datagrid.CurrentColumn as EditorDataGridTemplateColumnBase;
|
|
|
|
|
if (column == null) return;
|
|
|
|
|
|
|
|
|
|
if (_PreColumn == datagrid.CurrentColumn) return;
|
|
|
|
|
|
|
|
|
|
if (_PreColumn != null)
|
|
|
|
|
{
|
|
|
|
|
_PreColumn.IsColumnSelected = false;
|
|
|
|
|
foreach (var item in datagrid.Items)
|
|
|
|
|
{
|
|
|
|
|
var list = item as System.Collections.ObjectModel.ObservableCollection<RecipeEditorLib.RecipeModel.Params.Param>;
|
|
|
|
|
if (list == null) continue;
|
|
|
|
|
foreach (var p in list)
|
|
|
|
|
{
|
|
|
|
|
if (p.Name == _PreColumn.ControlName) p.IsColumnSelected = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
column.IsColumnSelected = true;
|
|
|
|
|
_PreColumn = column;
|
|
|
|
|
//var jj = datagrid.Items as System.Collections.ObjectModel.ObservableCollection<RecipeEditorLib.RecipeModel.Params.Param>;
|
|
|
|
|
foreach (var item in datagrid.Items)
|
|
|
|
|
{
|
|
|
|
|
var list = item as System.Collections.ObjectModel.ObservableCollection<RecipeEditorLib.RecipeModel.Params.Param>;
|
|
|
|
|
if (list == null) continue;
|
|
|
|
|
foreach (var p in list)
|
|
|
|
|
{
|
|
|
|
|
if (p.Name == column.ControlName) p.IsColumnSelected = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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.FirstOrDefault(x => x.Name == RecipColNo.StepNo.ToString());
|
|
|
|
|
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.FirstOrDefault(x => x.Name == RecipColNo.StepNo.ToString());
|
|
|
|
|
if (param is StepParam sp)
|
|
|
|
|
{
|
|
|
|
|
sp.IsChecked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-14 15:03:45 +08:00
|
|
|
|
|
|
|
|
|
private void btnLock_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
editorLocker.Lock();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnChangePassword_Click(object sender, RoutedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var dlg = new PanelLockerPasswordChanger();
|
|
|
|
|
dlg.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
2023-03-03 15:42:13 +08:00
|
|
|
|
}
|
|
|
|
|
}
|