Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2753 for trunk/sources


Ignore:
Timestamp:
02/04/10 13:13:16 (15 years ago)
Author:
gkronber
Message:

Implemented rudimentary form to display a list of all plugins and details. #699 (Refactor ManagerForm)

Location:
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManager.cs

    r2690 r2753  
    4141    internal event EventHandler<PluginInfrastructureEventArgs> PluginInstalled;
    4242
     43
     44    public IEnumerable<PluginDescription> Plugins {
     45      get { return pluginManager.Plugins; }
     46    }
     47
    4348    private string pluginDir;
    4449    private string updateLocationUrl;
     
    6671      builder.Append("Version: ").AppendLine(desc.Version.ToString());
    6772      builder.AppendLine("Description:").AppendLine(desc.Description);
    68       builder.Append("Build date: ").AppendLine(desc.BuildDate.ToString());
     73      builder.AppendLine("This plugin is " + desc.PluginState.ToString().ToLowerInvariant() + ".");
     74      builder.Append("Build date: ").AppendLine(desc.BuildDate.ToString()).AppendLine();
    6975      builder.AppendLine("Files: ");
    70       foreach (string fileName in from file in desc.Files select file.Name) {
    71         builder.AppendLine(fileName);
    72       }
    73       builder.AppendLine("Directly depends on:");
     76      foreach (var file in desc.Files) {
     77        builder.AppendLine(file.Type + " " + file.Name);
     78      }
     79      builder.AppendLine().AppendLine("Directly depends on:");
    7480      if (desc.Dependencies.Count() == 0) builder.AppendLine("None");
    7581      foreach (var dependency in desc.Dependencies) {
    76         builder.AppendLine(dependency.Name);
    77       }
    78       builder.AppendFormat("Plugins directly dependent on {0}:\n", desc.Name);
     82        builder.AppendLine(dependency.Name + " " + dependency.Version);
     83      }
     84      builder.AppendLine().AppendFormat("Plugins directly dependent on {0}:\n", desc.Name);
    7985      var dependents = from x in pluginManager.Plugins
    8086                       where x.Dependencies.Contains(desc)
    81                        select x.Name;
     87                       select x;
    8288      if (dependents.Count() == 0) builder.AppendLine("None");
    8389      foreach (var dependent in dependents) {
    84         builder.AppendLine(dependent);
    85       }
    86       builder.AppendLine("This plugin is " + desc.PluginState.ToString().ToLowerInvariant() + ".");
     90        builder.AppendLine(dependent.Name + " " + dependent.Version);
     91      }
     92      builder.AppendLine();
    8793      if (desc.PluginState == PluginState.Disabled) {
    8894        builder.AppendLine(DetermineProblem(desc));
     
    95101      // either any file is missing
    96102      StringBuilder builder = new StringBuilder();
     103      builder.AppendLine("Problem report:");
    97104      var missingFiles = from x in desc.Files
    98105                         where !File.Exists(x.Name)
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.Designer.cs

    r2748 r2753  
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      this.statusStrip = new System.Windows.Forms.StatusStrip();
     27      this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
     28      this.detailsTextBox = new System.Windows.Forms.TextBox();
     29      this.pluginsListView = new System.Windows.Forms.ListView();
     30      this.tableLayoutPanel.SuspendLayout();
    2631      this.SuspendLayout();
     32      //
     33      // statusStrip
     34      //
     35      this.statusStrip.Location = new System.Drawing.Point(0, 433);
     36      this.statusStrip.Name = "statusStrip";
     37      this.statusStrip.Size = new System.Drawing.Size(394, 22);
     38      this.statusStrip.TabIndex = 0;
     39      this.statusStrip.Text = "statusStrip1";
     40      //
     41      // tableLayoutPanel
     42      //
     43      this.tableLayoutPanel.ColumnCount = 1;
     44      this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
     45      this.tableLayoutPanel.Controls.Add(this.detailsTextBox, 0, 1);
     46      this.tableLayoutPanel.Controls.Add(this.pluginsListView, 0, 0);
     47      this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
     48      this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0);
     49      this.tableLayoutPanel.Name = "tableLayoutPanel";
     50      this.tableLayoutPanel.RowCount = 2;
     51      this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 64F));
     52      this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 36F));
     53      this.tableLayoutPanel.Size = new System.Drawing.Size(394, 433);
     54      this.tableLayoutPanel.TabIndex = 1;
     55      //
     56      // detailsTextBox
     57      //
     58      this.detailsTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
     59      this.detailsTextBox.Location = new System.Drawing.Point(3, 280);
     60      this.detailsTextBox.Multiline = true;
     61      this.detailsTextBox.Name = "detailsTextBox";
     62      this.detailsTextBox.ReadOnly = true;
     63      this.detailsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
     64      this.detailsTextBox.Size = new System.Drawing.Size(388, 150);
     65      this.detailsTextBox.TabIndex = 0;
     66      //
     67      // pluginsListView
     68      //
     69      this.pluginsListView.Dock = System.Windows.Forms.DockStyle.Fill;
     70      this.pluginsListView.Location = new System.Drawing.Point(3, 3);
     71      this.pluginsListView.MultiSelect = false;
     72      this.pluginsListView.Name = "pluginsListView";
     73      this.pluginsListView.Size = new System.Drawing.Size(388, 271);
     74      this.pluginsListView.TabIndex = 1;
     75      this.pluginsListView.UseCompatibleStateImageBehavior = false;
     76      this.pluginsListView.View = System.Windows.Forms.View.List;
     77      this.pluginsListView.SelectedIndexChanged += new System.EventHandler(this.pluginsListView_SelectedIndexChanged);
    2778      //
    2879      // InstallationManagerForm
     
    3081      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    3182      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    32       this.ClientSize = new System.Drawing.Size(284, 264);
     83      this.ClientSize = new System.Drawing.Size(394, 455);
     84      this.Controls.Add(this.tableLayoutPanel);
     85      this.Controls.Add(this.statusStrip);
    3386      this.Name = "InstallationManagerForm";
    3487      this.Text = "InstallationManager";
     88      this.tableLayoutPanel.ResumeLayout(false);
     89      this.tableLayoutPanel.PerformLayout();
    3590      this.ResumeLayout(false);
     91      this.PerformLayout();
    3692
    3793    }
    3894
    3995    #endregion
     96
     97    private System.Windows.Forms.StatusStrip statusStrip;
     98    private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
     99    private System.Windows.Forms.TextBox detailsTextBox;
     100    private System.Windows.Forms.ListView pluginsListView;
    40101  }
    41102}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.cs

    r2748 r2753  
    77using System.Text;
    88using System.Windows.Forms;
     9using System.IO;
     10using HeuristicLab.PluginInfrastructure.Manager;
    911
    1012namespace HeuristicLab.PluginInfrastructure.Advanced {
    1113  public partial class InstallationManagerForm : Form {
     14    private InstallationManager installationManager;
     15
    1216    public InstallationManagerForm() {
    1317      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);
    1446    }
    1547  }
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.resx

    r2748 r2753  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     121    <value>17, 17</value>
     122  </metadata>
    120123</root>
Note: See TracChangeset for help on using the changeset viewer.