add icon for source type & minor fixes

This commit is contained in:
2024-09-08 09:57:03 +02:00
parent 8087c0539a
commit 4b964e548f
4 changed files with 60 additions and 9 deletions

View File

@@ -156,6 +156,7 @@ public partial class Form1 : RadForm, IMainApi
Name = "utype",
HeaderText = ActionsListLangRes.Col_UpdateType,
Width = 150,
DataSource = Enum.GetValues<UpdateActionType>(),
IsVisible = infos is UpdateInfo,
},
new GridViewCheckBoxColumn
@@ -168,7 +169,7 @@ public partial class Form1 : RadForm, IMainApi
{
Name = "zippath",
HeaderText = ActionsListLangRes.Col_ZipPath,
Width = 250,
Width = 200,
},
new GridViewCheckBoxColumn
{
@@ -194,12 +195,13 @@ public partial class Form1 : RadForm, IMainApi
{
Name = "srcurl",
HeaderText = ActionsListLangRes.Col_SrcUrl,
Width = 250,
Width = 350,
},
new GridViewComboBoxColumn
{
Name = "srctype",
HeaderText = ActionsListLangRes.Col_SrcType,
DataSource = Enum.GetValues<SourceType>(),
Width = 150,
},
new GridViewTextBoxColumn
@@ -230,6 +232,7 @@ public partial class Form1 : RadForm, IMainApi
{
Name = "side",
HeaderText = ActionsListLangRes.Col_Side,
DataSource = Enum.GetValues<Side>(),
Width = 150,
},
new GridViewCheckBoxColumn
@@ -250,6 +253,7 @@ public partial class Form1 : RadForm, IMainApi
row.Cells["zippath"].Value = action.ZipPath;
row.Cells["destpath"].Value = action.DestPath;
row.Cells["srcurl"].Value = action.SourceUrl;
row.Cells["srctype"].Value = action.SourceType;
row.Cells["srcowner"].Value = action.SourceOwner;
row.Cells["srcname"].Value = action.SourceName;
row.Cells["srcregex"].Value = action.SourceRegex;
@@ -297,4 +301,30 @@ public partial class Form1 : RadForm, IMainApi
if (e.Node?.Tag is IActionSetInfos infos)
LoadActionSet(infos);
}
private void RadGridView_Actions_CellFormatting(object sender, CellFormattingEventArgs e)
{
var cellElement = e.CellElement;
var cellInfo = e.Row.Cells[e.Column.Name];
if (e.Column.Name == "srctype" && cellInfo?.Value is string sourceTypeStr && Enum.Parse<SourceType>(sourceTypeStr) is SourceType sourceType)
{
cellElement.SvgImage = sourceType switch
{
SourceType.DirectLink => AppGlobals.Symbols.GetSvgImage(AppSymbols.link, SymbolSize.Small),
SourceType.GitHub => AppGlobals.Symbols.GetSvgImage(AppSymbols.github, SymbolSize.Small),
_ => null,
};
cellElement.DrawImage = cellElement.SvgImage != null;
cellElement.TextImageRelation = TextImageRelation.ImageBeforeText;
cellElement.ImageAlignment = ContentAlignment.MiddleLeft;
}
else
{
cellElement.ResetValue(LightVisualElement.SvgImageProperty, ValueResetFlags.Local);
cellElement.ResetValue(LightVisualElement.DrawImageProperty, ValueResetFlags.Local);
cellElement.ResetValue(LightVisualElement.TextImageRelationProperty, ValueResetFlags.Local);
cellElement.ResetValue(LightVisualElement.ImageAlignmentProperty, ValueResetFlags.Local);
}
}
}