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

@@ -90,8 +90,9 @@ partial class Form1
//
//
splitPanel1.RootElement.MinSize = new Size(25, 25);
splitPanel1.Size = new Size(246, 422);
splitPanel1.Size = new Size(200, 422);
splitPanel1.SizeInfo.AutoSizeScale = new SizeF(-0.190954775F, 0F);
splitPanel1.SizeInfo.SizeMode = Telerik.WinControls.UI.Docking.SplitPanelSizeMode.Absolute;
splitPanel1.SizeInfo.SplitterCorrection = new Size(-152, 0);
splitPanel1.TabIndex = 0;
splitPanel1.TabStop = false;
@@ -106,7 +107,7 @@ partial class Form1
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.RowCount = 1;
tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel2.Size = new Size(246, 422);
tableLayoutPanel2.Size = new Size(200, 422);
tableLayoutPanel2.TabIndex = 1;
//
// radTreeView_Updates
@@ -117,20 +118,20 @@ partial class Form1
radTreeView_Updates.LineStyle = Telerik.WinControls.UI.TreeLineStyle.Solid;
radTreeView_Updates.Location = new Point(3, 3);
radTreeView_Updates.Name = "radTreeView_Updates";
radTreeView_Updates.Size = new Size(240, 416);
radTreeView_Updates.Size = new Size(194, 416);
radTreeView_Updates.TabIndex = 0;
radTreeView_Updates.SelectedNodeChanged += RadTreeView_Updates_SelectedNodeChanged;
//
// splitPanel2
//
splitPanel2.Controls.Add(tableLayoutPanel1);
splitPanel2.Location = new Point(250, 0);
splitPanel2.Location = new Point(204, 0);
splitPanel2.Name = "splitPanel2";
//
//
//
splitPanel2.RootElement.MinSize = new Size(25, 25);
splitPanel2.Size = new Size(550, 422);
splitPanel2.Size = new Size(596, 422);
splitPanel2.SizeInfo.AutoSizeScale = new SizeF(0.190954745F, 0F);
splitPanel2.SizeInfo.SplitterCorrection = new Size(152, 0);
splitPanel2.TabIndex = 1;
@@ -146,7 +147,7 @@ partial class Form1
tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.RowCount = 1;
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel1.Size = new Size(550, 422);
tableLayoutPanel1.Size = new Size(596, 422);
tableLayoutPanel1.TabIndex = 0;
//
// radGridView_Actions
@@ -156,10 +157,18 @@ partial class Form1
//
//
//
radGridView_Actions.MasterTemplate.AllowAddNewRow = false;
radGridView_Actions.MasterTemplate.AllowColumnChooser = false;
radGridView_Actions.MasterTemplate.AllowDeleteRow = false;
radGridView_Actions.MasterTemplate.AllowDragToGroup = false;
radGridView_Actions.MasterTemplate.AllowRowResize = false;
radGridView_Actions.MasterTemplate.AllowSearchRow = true;
radGridView_Actions.MasterTemplate.EnableGrouping = false;
radGridView_Actions.MasterTemplate.ViewDefinition = tableViewDefinition1;
radGridView_Actions.Name = "radGridView_Actions";
radGridView_Actions.Size = new Size(544, 416);
radGridView_Actions.Size = new Size(590, 416);
radGridView_Actions.TabIndex = 0;
radGridView_Actions.CellFormatting += RadGridView_Actions_CellFormatting;
//
// radMenuItem_Workspace
//
@@ -254,6 +263,7 @@ partial class Form1
Name = "Form1";
StartPosition = FormStartPosition.CenterScreen;
Text = "Minecraft Modpack Updates Manager";
WindowState = FormWindowState.Maximized;
Load += Form1_Load;
((System.ComponentModel.ISupportInitialize)radSplitContainer1).EndInit();
radSplitContainer1.ResumeLayout(false);

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);
}
}
}