Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.cs @ 2915

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
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using System.IO;
10using HeuristicLab.PluginInfrastructure.Manager;
11
12namespace HeuristicLab.PluginInfrastructure.Advanced {
13  public partial class InstallationManagerForm : Form {
14    private InstallationManager installationManager;
15
16    public InstallationManagerForm() {
17      InitializeComponent();
18      this.installationManager = new InstallationManager(Path.GetDirectoryName(Application.ExecutablePath));
19
20      UpdatePluginsList();
21    }
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    }
47  }
48}
Note: See TracBrowser for help on using the repository browser.