Last change
on this file since 2915 was
2753,
checked in by gkronber, 15 years ago
|
Implemented rudimentary form to display a list of all plugins and details. #699 (Refactor ManagerForm)
|
File size:
1.5 KB
|
Rev | Line | |
---|
[2748] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.Data;
|
---|
| 5 | using System.Drawing;
|
---|
| 6 | using System.Linq;
|
---|
| 7 | using System.Text;
|
---|
| 8 | using System.Windows.Forms;
|
---|
[2753] | 9 | using System.IO;
|
---|
| 10 | using HeuristicLab.PluginInfrastructure.Manager;
|
---|
[2748] | 11 |
|
---|
| 12 | namespace HeuristicLab.PluginInfrastructure.Advanced {
|
---|
| 13 | public partial class InstallationManagerForm : Form {
|
---|
[2753] | 14 | private InstallationManager installationManager;
|
---|
| 15 |
|
---|
[2748] | 16 | public InstallationManagerForm() {
|
---|
| 17 | InitializeComponent();
|
---|
[2753] | 18 | this.installationManager = new InstallationManager(Path.GetDirectoryName(Application.ExecutablePath));
|
---|
| 19 |
|
---|
| 20 | UpdatePluginsList();
|
---|
[2748] | 21 | }
|
---|
[2753] | 22 |
|
---|
| 23 | private void UpdatePluginsList() {
|
---|
| 24 | foreach (var plugin in installationManager.Plugins) {
|
---|
| 25 | pluginsListView.Items.Add(CreatePluginItem(plugin));
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | private static ListViewItem CreatePluginItem(IPluginDescription plugin) {
|
---|
| 30 | ListViewItem item = new ListViewItem();
|
---|
| 31 | item.Tag = plugin;
|
---|
| 32 | item.Text = plugin.Name + "-" + plugin.Version.ToString();
|
---|
| 33 | return item;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | private void pluginsListView_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
| 37 | if (pluginsListView.SelectedItems.Count > 0) {
|
---|
| 38 | ListViewItem selecteditem = pluginsListView.SelectedItems[0];
|
---|
| 39 | IPluginDescription desc = (IPluginDescription)selecteditem.Tag;
|
---|
| 40 | UpdateDetailsBox((PluginDescription)desc);
|
---|
| 41 | }
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | private void UpdateDetailsBox(PluginDescription desc) {
|
---|
| 45 | detailsTextBox.Text = installationManager.GetInformation(desc.Name);
|
---|
| 46 | }
|
---|
[2748] | 47 | }
|
---|
| 48 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.