|
@@ -2897,7 +2897,22 @@ namespace PRSDesktop
|
|
|
}
|
|
|
if (CurrentPanel?.GetType().HasInterface(typeof(IPropertiesPanel<>)) == true && Security.IsAllowed<CanConfigurePanels>())
|
|
|
{
|
|
|
- menu.AddItem("Configure Panel", PRSDesktop.Resources.edit, ConfigurePanel_Click);
|
|
|
+ var securityInterface = CurrentPanel?.GetType().GetInterfaceDefinition(typeof(IPropertiesPanel<,>));
|
|
|
+
|
|
|
+ var canConfigure = false;
|
|
|
+ if (securityInterface is not null)
|
|
|
+ {
|
|
|
+ var token = securityInterface.GenericTypeArguments[1];
|
|
|
+ canConfigure = Security.IsAllowed(token);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ canConfigure = Security.IsAllowed<CanConfigurePanels>();
|
|
|
+ }
|
|
|
+ if (canConfigure)
|
|
|
+ {
|
|
|
+ menu.AddItem("Configure Panel", PRSDesktop.Resources.edit, ConfigurePanel_Click);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (menu.Items.Count == 0)
|
|
@@ -2944,9 +2959,21 @@ namespace PRSDesktop
|
|
|
where TProperties : BaseObject, IGlobalConfigurationSettings, new()
|
|
|
{
|
|
|
var properties = LoadPanelProperties<TPanel, TProperties>();
|
|
|
- var editor = new DynamicEditorForm(typeof(TProperties));
|
|
|
- editor.Items = new BaseObject[] { properties };
|
|
|
- if (editor.ShowDialog() == true)
|
|
|
+
|
|
|
+ bool result;
|
|
|
+ if(DynamicGridUtils.TryFindDynamicGrid(typeof(DynamicGrid<>), typeof(TProperties), out var gridType))
|
|
|
+ {
|
|
|
+ var grid = (Activator.CreateInstance(gridType) as DynamicGrid<TProperties>)!;
|
|
|
+ result = grid.EditItems(new TProperties[] { properties });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var editor = new DynamicEditorForm(typeof(TProperties));
|
|
|
+ editor.Items = new BaseObject[] { properties };
|
|
|
+ result = editor.ShowDialog() == true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result)
|
|
|
{
|
|
|
SavePanelProperties<TPanel, TProperties>(properties);
|
|
|
}
|