Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/15 17:08:43 (8 years ago)
Author:
gkronber
Message:

#2522: improvements to AboutDialog and PluginInformationDialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RefactorPluginInfrastructure-2522/HeuristicLab.PluginInfrastructure.UI/AboutDialog.cs

    r13363 r13369  
    3737    /// </summary>
    3838    /// <param name="plugins">Enumerable of plugins that should be listed.</param>
    39     public AboutDialog(IEnumerable<IPluginDescription> plugins) {
     39    public AboutDialog(IEnumerable<IPluginDescription> plugins, Assembly mainAssembly) {
    4040      InitializeComponent();
    41       var entryAssembly = Assembly.GetEntryAssembly();
    42       productTextBox.Text = GetProduct(entryAssembly);
    43       versionTextBox.Text = entryAssembly.GetFileVersion();
    44       copyrightTextBox.Text = GetCopyright(entryAssembly);
     41
     42      productTextBox.Text = mainAssembly.GetProduct();
     43      versionTextBox.Text = mainAssembly.GetFileVersion();
     44      copyrightTextBox.Text = mainAssembly.GetCopyright();
    4545      imageList.Images.Add(Resources.Plugin);
    4646      pictureBox.Image = Resources.HeuristicLabLogo;
     
    5454    /// </summary>
    5555    public AboutDialog()
    56       : this(ApplicationManager.Manager.Plugins) {
    57     }
    58 
    59     private ListViewItem CreateListViewItem(IPluginDescription plugin) {
    60       ListViewItem item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), plugin.Description });
    61       item.Tag = plugin;
    62       item.ImageIndex = 0;
    63       return item;
    64     }
    65 
    66     private string GetCopyright(Assembly asm) {
    67       AssemblyCopyrightAttribute attribute = GetAttribute<AssemblyCopyrightAttribute>(asm);
    68       return attribute.Copyright;
    69     }
    70 
    71     private string GetProduct(Assembly asm) {
    72       AssemblyProductAttribute attribute = GetAttribute<AssemblyProductAttribute>(asm);
    73       return attribute.Product;
    74     }
    75 
    76     private T GetAttribute<T>(Assembly asm) {
    77       return (T)asm.GetCustomAttributes(typeof(T), false).Single();
     56      : this(ApplicationManager.Manager.Plugins, typeof(IPluginDescription).Assembly) {
    7857    }
    7958
    8059    private void okButton_Click(object sender, EventArgs e) {
    8160      Close();
    82     }
    83 
    84     private void pluginListView_ItemActivate(object sender, EventArgs e) {
    8561    }
    8662
Note: See TracChangeset for help on using the changeset viewer.