Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/24/10 14:34:07 (15 years ago)
Author:
gkronber
Message:
  • replaced column ContactInformation with ContactName and ContactEmail in DB-schema and updated WCF deployment service
  • regenerated proxy classes
  • made PluginDescription from data contract implement IPluginDescription from plugin infrastructure
  • updated GUI on request by swagner (icons)
  • fixed problems in the upload plugins control.

#860 (Deployment server for plugin installation from web locations)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginView.cs

    r2816 r2860  
    88using System.Windows.Forms;
    99using HeuristicLab.PluginInfrastructure;
     10using System.IO;
    1011
    1112namespace HeuristicLab.DeploymentService.AdminClient {
    1213  public partial class PluginView : UserControl {
     14    private const string IMAGE_KEY_ASSEMBLY = "Assembly";
     15    private const string IMAGE_KEY_FILE = "File";
     16    private const string IMAGE_KEY_DOCUMENT = "Document";
     17
     18    private IPluginDescription plugin;
     19
    1320    public PluginView() {
    1421      InitializeComponent();
     22      PopulateImageList();
     23    }
     24
     25    public PluginView(IPluginDescription plugin) {
     26      InitializeComponent();
     27      PopulateImageList();
     28
     29      this.plugin = plugin;
     30      UpdateControls();
     31    }
     32
     33    private void PopulateImageList() {
     34      imageList.Images.Add(IMAGE_KEY_ASSEMBLY, HeuristicLab.Common.Resources.VS2008ImageLibrary.Assembly);
     35      imageList.Images.Add(IMAGE_KEY_FILE, HeuristicLab.Common.Resources.VS2008ImageLibrary.File);
     36      imageList.Images.Add(IMAGE_KEY_DOCUMENT, HeuristicLab.Common.Resources.VS2008ImageLibrary.Document);
     37    }
     38
     39    public void UpdateControls() {
     40      string appDir = Path.GetDirectoryName(Application.ExecutablePath);
     41      nameTextBox.Text = plugin.Name;
     42      versionTextBox.Text = plugin.Version.ToString();
     43      contactTextBox.Text = CombineStrings(plugin.ContactName, plugin.ContactEmail);
     44      foreach (IPluginDescription dependency in plugin.Dependencies) {
     45        var depItem = new ListViewItem(new string[] { dependency.Name, dependency.Version.ToString() });
     46        depItem.ImageKey = IMAGE_KEY_ASSEMBLY;
     47        dependenciesListView.Items.Add(depItem);
     48      }
     49      foreach (var file in plugin.Files) {
     50        string displayedFileName = file.Name.Replace(appDir, string.Empty);
     51        displayedFileName = displayedFileName.TrimStart(Path.DirectorySeparatorChar);
     52        var fileItem = new ListViewItem(new string[] { displayedFileName, file.Type.ToString() });
     53        if (file.Type == PluginFileType.Assembly) {
     54          fileItem.ImageKey = IMAGE_KEY_ASSEMBLY;
     55        } else if (file.Type == PluginFileType.License) {
     56          fileItem.ImageKey = IMAGE_KEY_DOCUMENT;
     57        } else fileItem.ImageKey = IMAGE_KEY_FILE;
     58        filesListView.Items.Add(fileItem);
     59      }
     60      licenseButton.Enabled = !string.IsNullOrEmpty(plugin.LicenseText);
     61    }
     62
     63    private string CombineStrings(string a, string b) {
     64      if (string.IsNullOrEmpty(a))
     65        // a is empty
     66        if (!string.IsNullOrEmpty(b)) return CombineStrings(b, string.Empty);
     67        else return string.Empty;
     68      // a is not empty
     69      else if (string.IsNullOrEmpty(b)) return a;
     70      // and b are not empty
     71      else return a + ", " + b;
     72    }
     73
     74    private void licenseButton_Click(object sender, EventArgs e) {
     75      LicenseView view = new LicenseView(plugin.Name, plugin.Version.ToString(), plugin.LicenseText);
     76      view.Show();
    1577    }
    1678  }
Note: See TracChangeset for help on using the changeset viewer.