Skip to content

Commit f389fe2

Browse files
committed
Added functionality for bundle select links to AppMan
1 parent 00debc0 commit f389fe2

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

External/Tools/AppMan/MainForm.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

External/Tools/AppMan/MainForm.cs

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,29 @@ private void UpdatesLinkLabelLinkClicked(Object sender, LinkLabelLinkClickedEven
580580
}
581581
}
582582

583+
/// <summary>
584+
/// On bundle link click, selects all bundled items.
585+
/// </summary>
586+
private void BundleLinkLabelLinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
587+
{
588+
try
589+
{
590+
if (this.isLoading) return;
591+
this.listView.BeginUpdate();
592+
foreach (ListViewItem item in this.listView.Items)
593+
{
594+
DepEntry entry = item.Tag as DepEntry;
595+
if (Array.IndexOf(entry.Bundles, e.Link.LinkData.ToString()) != -1) item.Checked = true;
596+
else item.Checked = false;
597+
}
598+
this.listView.EndUpdate();
599+
}
600+
catch (Exception ex)
601+
{
602+
DialogHelper.ShowError(ex.ToString());
603+
}
604+
}
605+
583606
/// <summary>
584607
/// Disables the item checking when downloading.
585608
/// </summary>
@@ -671,6 +694,7 @@ private void PopulateListView()
671694
if (this.appGroups.Count > 1) this.listView.ShowGroups = true;
672695
else this.listView.ShowGroups = false;
673696
this.UpdateEntryStates();
697+
this.GenerateBundleLinks();
674698
this.listView.EndUpdate();
675699
}
676700
catch (Exception ex)
@@ -679,6 +703,32 @@ private void PopulateListView()
679703
}
680704
}
681705

706+
/// <summary>
707+
/// Generates the bundle selection links.
708+
/// </summary>
709+
private void GenerateBundleLinks()
710+
{
711+
List<String> bundleLinks = new List<String>();
712+
foreach (DepEntry entry in this.depEntries)
713+
{
714+
foreach (String bundle in entry.Bundles)
715+
{
716+
if (!bundleLinks.Contains(bundle))
717+
{
718+
LinkLabel linkLabel = new LinkLabel();
719+
linkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
720+
linkLabel.Location = new Point(this.updateLinkLabel.Bounds.Right + 5, this.updateLinkLabel.Location.Y);
721+
linkLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(this.BundleLinkLabelLinkClicked);
722+
linkLabel.Links[0].LinkData = bundle;
723+
linkLabel.AutoSize = true;
724+
linkLabel.Text = bundle;
725+
bundleLinks.Add(bundle);
726+
this.Controls.Add(linkLabel);
727+
}
728+
}
729+
}
730+
}
731+
682732
/// <summary>
683733
/// Adds the entry into a new or existing group.
684734
/// </summary>
@@ -1388,6 +1438,9 @@ public class DepEntry
13881438
[XmlArrayItem("Url")]
13891439
public String[] Urls = new String[0];
13901440

1441+
[XmlArrayItem("Bundle")]
1442+
public String[] Bundles = new String[0];
1443+
13911444
[XmlIgnore]
13921445
public Dictionary<String, String> Temps;
13931446

@@ -1396,14 +1449,15 @@ public DepEntry()
13961449
this.Type = MainForm.TYPE_ARCHIVE;
13971450
this.Temps = new Dictionary<String, String>();
13981451
}
1399-
public DepEntry(String id, String name, String desc, String group, String version, String build, String type, String info, String cmd, String[] urls)
1452+
public DepEntry(String id, String name, String desc, String group, String version, String build, String type, String info, String cmd, String[] urls, String[] bundles)
14001453
{
14011454
this.Id = id;
14021455
this.Name = name;
14031456
this.Desc = desc;
14041457
this.Group = group;
14051458
this.Build = build;
14061459
this.Version = version;
1460+
this.Bundles = bundles;
14071461
this.Temps = new Dictionary<String, String>();
14081462
if (!String.IsNullOrEmpty(type)) this.Type = type;
14091463
else this.Type = MainForm.TYPE_ARCHIVE;
Binary file not shown.

0 commit comments

Comments
 (0)