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

View File

@@ -25,4 +25,5 @@ public enum AppSymbols
new_window,
time_machine,
settings,
link,
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="240" height="240">
<path fill="#0078d4" d="M7.782,40.218c3.71,3.71,9.725,3.71,13.435,0c1.733-1.733,5.267-5.267,7-7c3.71-3.71,3.71-9.725,0-13.435c-3.71-3.71-9.725-3.71-13.435,0c-1.733,1.733-5.267,5.267-7,7C4.073,30.492,4.073,36.508,7.782,40.218z M11.318,30.318c1.02-1.02,6.237-6.237,7-7c1.757-1.757,4.607-1.757,6.364,0c1.757,1.757,1.757,4.607,0,6.364c-0.763,0.763-5.98,5.98-7,7c-1.757,1.757-4.607,1.757-6.364,0C9.561,34.925,9.561,32.075,11.318,30.318z" />
<path d="M23.609,22.509c0,0-0.609-1.509,0.77-3.131l1.369-1.37c-3.165-1.583-7.022-1.285-9.926,0.888C15,22,16.197,25.439,16.197,25.439c1.04-1.04,1.872-1.872,2.121-2.121C19.758,21.879,21.851,21.613,23.609,22.509z" opacity=".05" />
<path d="M22.827,22.193c-0.082-0.664-0.178-2.024,1.022-3.345c0.07-0.07,0.92-0.94,1.143-1.163c-2.642-1.109-5.689-0.896-8.192,0.57c-0.849,2.578-0.317,5.522,0,6.582c0.743-0.743,1.324-1.324,1.519-1.519C19.548,22.088,21.254,21.714,22.827,22.193z" opacity=".07" />
<path fill="#1b9de2" d="M40.218,7.782c-3.71-3.71-9.725-3.71-13.435,0c-1.733,1.733-5.267,5.267-7,7c-3.71,3.71-3.71,9.725,0,13.435c3.71,3.71,9.725,3.71,13.435,0c1.733-1.733,5.267-5.267,7-7C43.927,17.508,43.927,11.492,40.218,7.782z M36.682,17.682c-1.02,1.02-6.237,6.237-7,7c-1.757,1.757-4.607,1.757-6.364,0c-1.757-1.757-1.757-4.607,0-6.364c0.763-0.763,5.98-5.98,7-7c1.757-1.757,4.607-1.757,6.364,0C38.439,13.075,38.439,15.925,36.682,17.682z" />
<path d="M24.386,25.476c0,0,0.614,1.524-0.765,3.146l-1.369,1.37c3.165,1.583,7.022,1.285,9.926-0.888C33,26,31.803,22.561,31.803,22.561c-1.04,1.04-1.872,1.872-2.121,2.121C28.242,26.121,26.09,26.395,24.386,25.476z" opacity=".05" />
<path d="M25.188,25.806c0.082,0.664,0.163,2.025-1.037,3.346c-0.07,0.07-0.92,0.92-1.143,1.143c2.642,1.109,5.718,0.897,8.196-0.628c0.849-2.578,0.314-5.445-0.004-6.504c-0.743,0.743-1.324,1.324-1.519,1.519C28.452,25.912,26.673,26.271,25.188,25.806z" opacity=".07" />
<path fill="#0078d4" d="M24.682,23.318c1.757,1.757,1.757,4.607,0,6.364c-0.763,0.763-5.98,5.98-7,7l3.536,3.536c1.733-1.733,5.267-5.267,7-7c3.71-3.71,3.71-9.725,0-13.435L24.682,23.318z" />
</svg>