调整Cell-Perm按钮徽标的布局和颜色。

完善Cell-Perm数量统计功能。
This commit is contained in:
DESKTOP-GPE37UV\THINKAPD 2022-12-01 16:38:55 +08:00
parent f6f5384353
commit 652e9f9ae4
4 changed files with 29 additions and 33 deletions

View File

@ -141,6 +141,16 @@ namespace RecipeEditorLib.RecipeModel.Params
this.ToList().ForEach(x => x.ResetHighlight());
}
/// <summary>
/// 计算被赋予访问权限的配方参数。
/// </summary>
/// <returns></returns>
public int GetParamsCountWhoHaveAccessPerm()
{
var total = this.ToList().Sum(x => x.GetHighlightedParams().Count);
return total;
}
#endregion
#region Overrided Methods

View File

@ -1498,9 +1498,9 @@
<materialDesign:Badged
x:Name="txtCellAccessPremCount"
BadgeColorZoneMode="Standard"
BadgeBackground="Green"
BadgeBackground="LimeGreen"
BadgeForeground="White"
Margin="10,0,0,0"
Margin="15,0,0,0"
BadgePlacementMode="TopLeft"
CornerRadius="5,5,5,5"
materialDesign:BadgedAssist.IsMiniBadge="True" VerticalAlignment="Center">
@ -1509,7 +1509,7 @@
Width="100"
Height="30"
Content="{Binding CellAccessPermButtonContent, Mode=OneWay}"
Margin="5,0,0,0"
Margin="0,0,0,0"
ToolTip="Show/Hide Param Values"
Click="BtnCellAccessPermissionEditMode_OnClick">
</Button>

View File

@ -166,6 +166,8 @@ namespace SicUI.Models.RecipeEditors
else
param.Highlight();
}
vm.CountHaveAccessPermParams();
//vm.SelectedGridCellCollection = e.AddedCells;
//vm.ToggleCellAccessPermissionWhitelistMark();
}

View File

@ -2031,34 +2031,12 @@ namespace SicUI.Models.RecipeEditors
#region Cell访问权限编辑
/// <summary>
/// 高亮标出允许访问白名单的Cell
/// 计算具有访问权限白名单的参数的总数
/// </summary>
public void ToggleCellAccessPermissionWhitelistMark()
public void CountHaveAccessPermParams()
{
if (SelectedGridCellCollection != null)
{
foreach (var dataGridCellInfo in SelectedGridCellCollection)
{
if (dataGridCellInfo.Column is EditorDataGridTemplateColumnBase col &&
dataGridCellInfo.Item is RecipeStep step)
{
var controlName = col.ControlName;
var stepUid = step.StepUid;
if(string.IsNullOrEmpty(controlName))
continue;
var param = step.FirstOrDefault(x => x.Name == controlName);
if(param == null)
continue;
if (param.IsHighlighted)
param.ResetHighlight();
else
param.Highlight();
}
}
}
var total = CurrentRecipe.Steps.GetParamsCountWhoHaveAccessPerm();
CellAccessPermCount = total;
}
/// <summary>
@ -2089,6 +2067,8 @@ namespace SicUI.Models.RecipeEditors
UpdateView();
CountHaveAccessPermParams();
return true;
}
@ -2117,6 +2097,8 @@ namespace SicUI.Models.RecipeEditors
UpdateView();
CellAccessPermCount = 0;
}
/// <summary>
@ -2212,7 +2194,6 @@ namespace SicUI.Models.RecipeEditors
#endregion
private void ClearData()
{
_editMode = EditMode.None;
@ -2353,7 +2334,10 @@ namespace SicUI.Models.RecipeEditors
NotifyOfPropertyChange(nameof(EnableStep));
NotifyOfPropertyChange(nameof(EnableSaveTo));
NotifyOfPropertyChange(nameof(EnableSaveToAll));
NotifyOfPropertyChange(nameof(EnableReload));
NotifyOfPropertyChange(nameof(EnableLeftTabPanel));
NotifyOfPropertyChange(nameof(EnableFilterTreeList));
NotifyOfPropertyChange(nameof(EnableRefreshRecipeList));
NotifyOfPropertyChange(nameof(CellAccessPermButtonContent));
NotifyOfPropertyChange(nameof(CurrentRecipe));
}