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)

Location:
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient
Files:
4 added
6 deleted
8 edited

Legend:

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

    r2816 r2860  
    7474  </ItemGroup>
    7575  <ItemGroup>
    76     <Compile Include="ServerPluginView.cs">
     76    <Compile Include="PluginComparisonView.cs">
    7777      <SubType>UserControl</SubType>
    7878    </Compile>
    79     <Compile Include="ServerPluginView.Designer.cs">
    80       <DependentUpon>ServerPluginView.cs</DependentUpon>
     79    <Compile Include="PluginComparisonView.Designer.cs">
     80      <DependentUpon>PluginComparisonView.cs</DependentUpon>
    8181    </Compile>
    8282    <Compile Include="PluginView.cs">
     
    9191    <Compile Include="LicenseView.Designer.cs">
    9292      <DependentUpon>LicenseView.cs</DependentUpon>
    93     </Compile>
    94     <Compile Include="LocalPluginView.cs">
    95       <SubType>UserControl</SubType>
    96     </Compile>
    97     <Compile Include="LocalPluginView.Designer.cs">
    98       <DependentUpon>LocalPluginView.cs</DependentUpon>
    9993    </Compile>
    10094    <Compile Include="ProductEditor.cs">
     
    121115  </ItemGroup>
    122116  <ItemGroup>
     117    <ProjectReference Include="..\HeuristicLab.Common.Resources\3.2\HeuristicLab.Common.Resources-3.2.csproj">
     118      <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
     119      <Name>HeuristicLab.Common.Resources-3.2</Name>
     120    </ProjectReference>
    123121    <ProjectReference Include="..\HeuristicLab.MainForm.WindowsForms\3.2\HeuristicLab.MainForm.WindowsForms-3.2.csproj">
    124122      <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project>
     
    140138  </ItemGroup>
    141139  <ItemGroup>
    142     <EmbeddedResource Include="ServerPluginView.resx">
    143       <DependentUpon>ServerPluginView.cs</DependentUpon>
     140    <EmbeddedResource Include="MainForm.resx">
     141      <DependentUpon>MainForm.cs</DependentUpon>
     142    </EmbeddedResource>
     143    <EmbeddedResource Include="PluginComparisonView.resx">
     144      <DependentUpon>PluginComparisonView.cs</DependentUpon>
    144145    </EmbeddedResource>
    145146    <EmbeddedResource Include="PluginView.resx">
     
    148149    <EmbeddedResource Include="LicenseView.resx">
    149150      <DependentUpon>LicenseView.cs</DependentUpon>
    150     </EmbeddedResource>
    151     <EmbeddedResource Include="LocalPluginView.resx">
    152       <DependentUpon>LocalPluginView.cs</DependentUpon>
    153151    </EmbeddedResource>
    154152    <EmbeddedResource Include="ProductEditor.resx">
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/MainForm.cs

    r2802 r2860  
    77namespace HeuristicLab.DeploymentService.AdminClient {
    88  class MainForm : DockingMainForm {
    9     public MainForm(Type type) : base(type) { }
     9    private System.Windows.Forms.ProgressBar progressBar;
     10
     11    public MainForm(Type type)
     12      : base(type) {
     13      InitializeComponent();
     14    }
    1015
    1116    protected override void OnInitialized(EventArgs e) {
     
    1318      (new PluginListView()).Show();
    1419    }
     20
     21    private void InitializeComponent() {
     22      this.progressBar = new System.Windows.Forms.ProgressBar();
     23      this.SuspendLayout();
     24      //
     25      // progressBar
     26      //
     27      this.progressBar.Location = new System.Drawing.Point(0, 528);
     28      this.progressBar.Name = "progressBar";
     29      this.progressBar.Size = new System.Drawing.Size(129, 23);
     30      this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
     31      this.progressBar.TabIndex = 7;
     32      this.progressBar.Visible = false;
     33      //
     34      // MainForm
     35      //
     36      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     37      this.ClientSize = new System.Drawing.Size(770, 550);
     38      this.Controls.Add(this.progressBar);
     39      this.Name = "MainForm";
     40      this.Controls.SetChildIndex(this.progressBar, 0);
     41      this.ResumeLayout(false);
     42      this.PerformLayout();
     43
     44    }
     45
     46    public void ShowProgressBar() {
     47      progressBar.Visible = true;
     48    }
     49
     50    public void HideProgressBar() {
     51      progressBar.Visible = false;
     52    }
    1553  }
    1654}
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.Designer.cs

    r2816 r2860  
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      this.components = new System.ComponentModel.Container();
    2627      this.listView = new System.Windows.Forms.ListView();
    2728      this.nameHeader = new System.Windows.Forms.ColumnHeader();
    2829      this.localVersion = new System.Windows.Forms.ColumnHeader();
    29       this.uploadButton = new System.Windows.Forms.Button();
    30       this.splitContainer = new System.Windows.Forms.SplitContainer();
    31       this.label1 = new System.Windows.Forms.Label();
     30      this.serverVersion = new System.Windows.Forms.ColumnHeader();
     31      this.imageList = new System.Windows.Forms.ImageList(this.components);
     32      this.serverUrlLabel = new System.Windows.Forms.Label();
    3233      this.serverUrlTextBox = new System.Windows.Forms.TextBox();
    3334      this.connectButton = new System.Windows.Forms.Button();
    34       this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
    35       this.serverPluginDetailsGroupBox = new System.Windows.Forms.GroupBox();
    36       this.localPluginDetailsGroupBox = new System.Windows.Forms.GroupBox();
    37       this.localPluginDetailsPanel = new System.Windows.Forms.Panel();
    38       this.serverVersion = new System.Windows.Forms.ColumnHeader();
    39       this.splitContainer.Panel1.SuspendLayout();
    40       this.splitContainer.Panel2.SuspendLayout();
    41       this.splitContainer.SuspendLayout();
    42       this.tableLayoutPanel.SuspendLayout();
    43       this.localPluginDetailsGroupBox.SuspendLayout();
     35      this.refreshButton = new System.Windows.Forms.Button();
     36      this.uploadButton = new System.Windows.Forms.Button();
    4437      this.SuspendLayout();
    4538      //
    4639      // listView
    4740      //
     41      this.listView.Activation = System.Windows.Forms.ItemActivation.TwoClick;
    4842      this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    4943                  | System.Windows.Forms.AnchorStyles.Left)
    5044                  | System.Windows.Forms.AnchorStyles.Right)));
     45      this.listView.CheckBoxes = true;
    5146      this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    5247            this.nameHeader,
     
    5449            this.serverVersion});
    5550      this.listView.Enabled = false;
    56       this.listView.Location = new System.Drawing.Point(3, 32);
    57       this.listView.MultiSelect = false;
     51      this.listView.FullRowSelect = true;
     52      this.listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
     53      this.listView.Location = new System.Drawing.Point(0, 30);
    5854      this.listView.Name = "listView";
    5955      this.listView.ShowGroups = false;
    60       this.listView.Size = new System.Drawing.Size(392, 459);
     56      this.listView.Size = new System.Drawing.Size(536, 446);
     57      this.listView.StateImageList = this.imageList;
    6158      this.listView.TabIndex = 0;
    6259      this.listView.UseCompatibleStateImageBehavior = false;
    6360      this.listView.View = System.Windows.Forms.View.Details;
    64       this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged);
     61      this.listView.ItemActivate += new System.EventHandler(this.listView_ItemActivate);
     62      this.listView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_ItemChecked);
    6563      //
    6664      // nameHeader
     
    7472      this.localVersion.Width = 100;
    7573      //
    76       // uploadButton
     74      // serverVersion
    7775      //
    78       this.uploadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    79       this.uploadButton.Enabled = false;
    80       this.uploadButton.Location = new System.Drawing.Point(6, 459);
    81       this.uploadButton.Name = "uploadButton";
    82       this.uploadButton.Size = new System.Drawing.Size(110, 23);
    83       this.uploadButton.TabIndex = 2;
    84       this.uploadButton.Text = "Upload plugin";
    85       this.uploadButton.UseVisualStyleBackColor = true;
    86       this.uploadButton.Click += new System.EventHandler(this.uploadButton_Click);
     76      this.serverVersion.Text = "Server version";
     77      this.serverVersion.Width = 100;
    8778      //
    88       // splitContainer
     79      // imageList
    8980      //
    90       this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
    91       this.splitContainer.Location = new System.Drawing.Point(0, 0);
    92       this.splitContainer.Name = "splitContainer";
     81      this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     82      this.imageList.ImageSize = new System.Drawing.Size(16, 16);
     83      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
    9384      //
    94       // splitContainer.Panel1
     85      // serverUrlLabel
    9586      //
    96       this.splitContainer.Panel1.Controls.Add(this.label1);
    97       this.splitContainer.Panel1.Controls.Add(this.serverUrlTextBox);
    98       this.splitContainer.Panel1.Controls.Add(this.connectButton);
    99       this.splitContainer.Panel1.Controls.Add(this.listView);
    100       //
    101       // splitContainer.Panel2
    102       //
    103       this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel);
    104       this.splitContainer.Size = new System.Drawing.Size(852, 494);
    105       this.splitContainer.SplitterDistance = 398;
    106       this.splitContainer.TabIndex = 3;
    107       //
    108       // label1
    109       //
    110       this.label1.AutoSize = true;
    111       this.label1.Location = new System.Drawing.Point(3, 8);
    112       this.label1.Name = "label1";
    113       this.label1.Size = new System.Drawing.Size(98, 13);
    114       this.label1.TabIndex = 5;
    115       this.label1.Text = "Deployment server:";
     87      this.serverUrlLabel.AutoSize = true;
     88      this.serverUrlLabel.Location = new System.Drawing.Point(3, 6);
     89      this.serverUrlLabel.Name = "serverUrlLabel";
     90      this.serverUrlLabel.Size = new System.Drawing.Size(98, 13);
     91      this.serverUrlLabel.TabIndex = 5;
     92      this.serverUrlLabel.Text = "Deployment server:";
    11693      //
    11794      // serverUrlTextBox
    11895      //
    119       this.serverUrlTextBox.Location = new System.Drawing.Point(107, 5);
     96      this.serverUrlTextBox.Location = new System.Drawing.Point(107, 3);
    12097      this.serverUrlTextBox.Name = "serverUrlTextBox";
    121       this.serverUrlTextBox.Size = new System.Drawing.Size(107, 20);
     98      this.serverUrlTextBox.Size = new System.Drawing.Size(246, 20);
    12299      this.serverUrlTextBox.TabIndex = 4;
    123100      //
    124101      // connectButton
    125102      //
    126       this.connectButton.Location = new System.Drawing.Point(220, 3);
     103      this.connectButton.Location = new System.Drawing.Point(359, 1);
    127104      this.connectButton.Name = "connectButton";
    128105      this.connectButton.Size = new System.Drawing.Size(75, 23);
     
    132109      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
    133110      //
    134       // tableLayoutPanel
     111      // refreshButton
    135112      //
    136       this.tableLayoutPanel.ColumnCount = 2;
    137       this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
    138       this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
    139       this.tableLayoutPanel.Controls.Add(this.serverPluginDetailsGroupBox, 1, 0);
    140       this.tableLayoutPanel.Controls.Add(this.localPluginDetailsGroupBox, 0, 0);
    141       this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
    142       this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0);
    143       this.tableLayoutPanel.Name = "tableLayoutPanel";
    144       this.tableLayoutPanel.RowCount = 1;
    145       this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
    146       this.tableLayoutPanel.Size = new System.Drawing.Size(450, 494);
    147       this.tableLayoutPanel.TabIndex = 3;
     113      this.refreshButton.Location = new System.Drawing.Point(440, 1);
     114      this.refreshButton.Name = "refreshButton";
     115      this.refreshButton.Size = new System.Drawing.Size(75, 23);
     116      this.refreshButton.TabIndex = 6;
     117      this.refreshButton.Text = "Refresh";
     118      this.refreshButton.UseVisualStyleBackColor = true;
     119      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
    148120      //
    149       // serverPluginDetailsGroupBox
     121      // uploadButton
    150122      //
    151       this.serverPluginDetailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
    152       this.serverPluginDetailsGroupBox.Location = new System.Drawing.Point(228, 3);
    153       this.serverPluginDetailsGroupBox.Name = "serverPluginDetailsGroupBox";
    154       this.serverPluginDetailsGroupBox.Size = new System.Drawing.Size(219, 488);
    155       this.serverPluginDetailsGroupBox.TabIndex = 3;
    156       this.serverPluginDetailsGroupBox.TabStop = false;
    157       this.serverPluginDetailsGroupBox.Text = "Server plugin information";
    158       //
    159       // localPluginDetailsGroupBox
    160       //
    161       this.localPluginDetailsGroupBox.Controls.Add(this.localPluginDetailsPanel);
    162       this.localPluginDetailsGroupBox.Controls.Add(this.uploadButton);
    163       this.localPluginDetailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
    164       this.localPluginDetailsGroupBox.Location = new System.Drawing.Point(3, 3);
    165       this.localPluginDetailsGroupBox.Name = "localPluginDetailsGroupBox";
    166       this.localPluginDetailsGroupBox.Size = new System.Drawing.Size(219, 488);
    167       this.localPluginDetailsGroupBox.TabIndex = 4;
    168       this.localPluginDetailsGroupBox.TabStop = false;
    169       this.localPluginDetailsGroupBox.Text = "Local plugin information";
    170       //
    171       // localPluginDetailsPanel
    172       //
    173       this.localPluginDetailsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    174                   | System.Windows.Forms.AnchorStyles.Left)
    175                   | System.Windows.Forms.AnchorStyles.Right)));
    176       this.localPluginDetailsPanel.Location = new System.Drawing.Point(6, 19);
    177       this.localPluginDetailsPanel.Name = "localPluginDetailsPanel";
    178       this.localPluginDetailsPanel.Size = new System.Drawing.Size(207, 434);
    179       this.localPluginDetailsPanel.TabIndex = 3;
    180       //
    181       // serverVersion
    182       //
    183       this.serverVersion.Text = "Server version";
    184       this.serverVersion.Width = 100;
     123      this.uploadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     124      this.uploadButton.Location = new System.Drawing.Point(3, 482);
     125      this.uploadButton.Name = "uploadButton";
     126      this.uploadButton.Size = new System.Drawing.Size(75, 23);
     127      this.uploadButton.TabIndex = 7;
     128      this.uploadButton.Text = "Upload";
     129      this.uploadButton.UseVisualStyleBackColor = true;
     130      this.uploadButton.Click += new System.EventHandler(this.uploadButton_Click);
    185131      //
    186132      // PluginListView
     
    188134      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    189135      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    190       this.Controls.Add(this.splitContainer);
     136      this.Controls.Add(this.uploadButton);
     137      this.Controls.Add(this.refreshButton);
     138      this.Controls.Add(this.connectButton);
     139      this.Controls.Add(this.serverUrlTextBox);
     140      this.Controls.Add(this.serverUrlLabel);
     141      this.Controls.Add(this.listView);
    191142      this.Name = "PluginListView";
    192       this.Size = new System.Drawing.Size(852, 494);
    193       this.splitContainer.Panel1.ResumeLayout(false);
    194       this.splitContainer.Panel1.PerformLayout();
    195       this.splitContainer.Panel2.ResumeLayout(false);
    196       this.splitContainer.ResumeLayout(false);
    197       this.tableLayoutPanel.ResumeLayout(false);
    198       this.localPluginDetailsGroupBox.ResumeLayout(false);
     143      this.Size = new System.Drawing.Size(539, 508);
    199144      this.ResumeLayout(false);
     145      this.PerformLayout();
    200146
    201147    }
     
    206152    private System.Windows.Forms.ColumnHeader nameHeader;
    207153    private System.Windows.Forms.ColumnHeader localVersion;
     154    private System.Windows.Forms.Button connectButton;
     155    private System.Windows.Forms.Label serverUrlLabel;
     156    private System.Windows.Forms.TextBox serverUrlTextBox;
     157    private System.Windows.Forms.ColumnHeader serverVersion;
     158    private System.Windows.Forms.Button refreshButton;
    208159    private System.Windows.Forms.Button uploadButton;
    209     private System.Windows.Forms.SplitContainer splitContainer;
    210     private System.Windows.Forms.Button connectButton;
    211     private System.Windows.Forms.Label label1;
    212     private System.Windows.Forms.TextBox serverUrlTextBox;
    213     private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
    214     private System.Windows.Forms.GroupBox serverPluginDetailsGroupBox;
    215     private System.Windows.Forms.GroupBox localPluginDetailsGroupBox;
    216     private System.Windows.Forms.Panel localPluginDetailsPanel;
    217     private System.Windows.Forms.ColumnHeader serverVersion;
     160    private System.Windows.Forms.ImageList imageList;
    218161  }
    219162}
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.cs

    r2816 r2860  
    2323    public PluginListView() {
    2424      InitializeComponent();
     25      imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.Assembly);
     26      imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.ArrowUp);
    2527      Caption = "Plugins";
    2628
     
    3133      localAndServerPlugins = new Dictionary<IPluginDescription, PluginDeploymentService.PluginDescription>();
    3234
     35      #region initialize backgroundworkers
    3336      pluginUploadWorker = new BackgroundWorker();
    3437      pluginUploadWorker.DoWork += new DoWorkEventHandler(pluginUploadWorker_DoWork);
     
    3841      updateServerPluginsWorker.DoWork += new DoWorkEventHandler(updateServerPluginsWorker_DoWork);
    3942      updateServerPluginsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(updateServerPluginsWorker_RunWorkerCompleted);
    40     }
    41 
     43      #endregion
     44    }
     45
     46    #region refresh plugins from server backgroundworker
    4247    void updateServerPluginsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    4348      if (!e.Cancelled && e.Result != null) {
    44         UpdateLocalPlugins();
     49        // refresh local plugins
     50        localAndServerPlugins.Clear();
     51        foreach (var plugin in ApplicationManager.Manager.Plugins) {
     52          localAndServerPlugins.Add(plugin, null);
     53        }
     54        // refresh server plugins (find matching local plugins)
    4555        var plugins = (PluginDeploymentService.PluginDescription[])e.Result;
    4656        foreach (var plugin in plugins) {
     
    5363          }
    5464        }
    55         UpdatePluginList();
    56         OnConnected();
    57       } else {
    58         OnDisconnected();
    59       }
     65        // refresh the list view with plugins
     66        listView.Items.Clear();
     67        foreach (var pair in localAndServerPlugins) {
     68          var item = MakeListViewItem(pair.Key);
     69          listView.Items.Add(item);
     70        }
     71        UpdateControlsConnectedState();
     72      } else {
     73        UpdateControlsDisconnectedState();
     74      }
     75      // make sure cursor is set correctly
    6076      Cursor = Cursors.Default;
    61     }
    62 
    63     private void UpdatePluginList() {
    64       listView.Items.Clear();
    65       foreach (var pair in localAndServerPlugins) {
    66         var item = MakeListViewItem(pair.Key);
    67         listView.Items.Add(item);
    68       }
    6977    }
    7078
     
    7684        }
    7785      }
    78       catch (EndpointNotFoundException ex) {
     86      catch (EndpointNotFoundException) {
    7987        e.Result = null;
    8088        e.Cancel = true;
    8189      }
    82       catch (FaultException ex) {
     90      catch (FaultException) {
    8391        e.Result = null;
    8492        e.Cancel = true;
    8593      }
    8694    }
    87 
     95    #endregion
     96
     97    #region upload plugins to server backgroundworker
    8898    void pluginUploadWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    89       this.Enabled = true;
     99      Cursor = Cursors.Default;
     100      if (e.Cancelled) {
     101        UpdateControlsDisconnectedState();
     102      } else {
     103        UpdateControlsConnectedState();
     104        // start another async call to refresh plugin information from server
     105        RefreshPluginsAsync();
     106      }
    90107    }
    91108
    92109    void pluginUploadWorker_DoWork(object sender, DoWorkEventArgs e) {
    93       var selectedPlugins = (IEnumerable<IPluginDescription>)e.Argument;
    94       using (PluginDeploymentService.AdminClient adminClient = new PluginDeploymentService.AdminClient()) {
    95 
    96         foreach (var plugin in IteratePlugins(selectedPlugins)) {
    97           adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
    98         }
    99       }
    100     }
    101 
     110      try {
     111        var selectedPlugins = (IEnumerable<IPluginDescription>)e.Argument;
     112        using (PluginDeploymentService.AdminClient adminClient = new PluginDeploymentService.AdminClient()) {
     113
     114          foreach (var plugin in IteratePlugins(selectedPlugins)) {
     115            adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
     116          }
     117        }
     118        e.Cancel = false;
     119      }
     120      catch (EndpointNotFoundException) {
     121        e.Cancel = true;
     122      }
     123      catch (FaultException) {
     124        e.Cancel = true;
     125      }
     126    }
     127    #endregion
     128
     129
     130    #region button events
     131    private void uploadButton_Click(object sender, EventArgs e) {
     132      var selectedPlugins = from item in listView.Items.Cast<ListViewItem>()
     133                            where item.Checked
     134                            where item.Tag is IPluginDescription
     135                            select item.Tag as IPluginDescription;
     136      if (selectedPlugins.Count() > 0) {
     137        Cursor = Cursors.AppStarting;
     138        DisableControl();
     139        pluginUploadWorker.RunWorkerAsync(selectedPlugins.ToList());
     140      }
     141    }
     142
     143    private void connectButton_Click(object sender, EventArgs e) {
     144      if (connectButton.Text == "Connect") {
     145        DisableControl();
     146        RefreshPluginsAsync();
     147      } else {
     148        UpdateControlsDisconnectedState();
     149      }
     150    }
     151
     152    private void refreshButton_Click(object sender, EventArgs e) {
     153      DisableControl();
     154      RefreshPluginsAsync();
     155    }
     156
     157    #endregion
     158
     159    #region item list events
     160    private void listView_ItemActivate(object sender, EventArgs e) {
     161      foreach (var item in listView.SelectedItems) {
     162        var plugin = (IPluginDescription)((ListViewItem)item).Tag;
     163        var compView = new PluginComparisonView(plugin, localAndServerPlugins[plugin]);
     164        compView.Show();
     165      }
     166    }
     167
     168    private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) {
     169      // also check all dependencies
     170      if (e.Item.Checked) {
     171        uploadButton.Enabled = true;
     172        var plugin = (IPluginDescription)e.Item.Tag;
     173        foreach (var dep in plugin.Dependencies) {
     174          var depItem = FindItemForPlugin(dep);
     175          if (!depItem.Checked) depItem.Checked = true;
     176        }
     177      } else {
     178        uploadButton.Enabled = (from i in listView.Items.Cast<ListViewItem>()
     179                                where i.Checked
     180                                select i).Any();
     181        // also uncheck all dependent plugins
     182        var plugin = (IPluginDescription)e.Item.Tag;
     183        foreach (ListViewItem item in listView.Items) {
     184          var dep = (IPluginDescription)item.Tag;
     185          if (dep.Dependencies.Contains(plugin) && item.Checked) {
     186            item.Checked = false;
     187          }
     188        }
     189      }
     190    }
     191    #endregion
     192
     193    #region helper methods
    102194    private byte[] CreateZipPackage(IPluginDescription plugin) {
    103195      using (MemoryStream stream = new MemoryStream()) {
     
    113205    }
    114206
     207    private ListViewItem MakeListViewItem(IPluginDescription plugin) {
     208      ListViewItem item;
     209      if (localAndServerPlugins[plugin] != null) {
     210        item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), localAndServerPlugins[plugin].Version.ToString() });
     211      } else {
     212        item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), string.Empty });
     213      }
     214      item.Tag = plugin;
     215      item.Checked = false;
     216      return item;
     217    }
     218
     219    private ListViewItem FindItemForPlugin(IPluginDescription dep) {
     220      return (from i in listView.Items.Cast<ListViewItem>()
     221              where i.Tag == dep
     222              select i).Single();
     223    }
     224
    115225    private PluginDeploymentService.PluginDescription MakePluginDescription(IPluginDescription plugin) {
    116226      var dependencies = from dep in plugin.Dependencies
     
    118228      if (string.IsNullOrEmpty(plugin.ContactName) || string.IsNullOrEmpty(plugin.ContactEmail)) {
    119229        return new PluginDeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies);
    120       } else return new PluginDeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName + ", " + plugin.ContactEmail, plugin.LicenseText);
     230      } else return new PluginDeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName, plugin.ContactEmail, plugin.LicenseText);
    121231    }
    122232
     
    130240    }
    131241
    132     public void UpdateLocalPlugins() {
    133       localAndServerPlugins.Clear();
    134 
    135       foreach (var plugin in ApplicationManager.Manager.Plugins) {
    136         localAndServerPlugins.Add(plugin, null);
    137       }
    138     }
    139 
    140 
    141     private ListViewItem MakeListViewItem(IPluginDescription plugin) {
    142       ListViewItem item;
    143       if (localAndServerPlugins[plugin] != null) {
    144         item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), localAndServerPlugins[plugin].Version.ToString() });
    145       } else {
    146         item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), string.Empty });
    147       }
    148       item.Tag = plugin;
    149       return item;
    150     }
    151 
    152     private void listView_SelectedIndexChanged(object sender, EventArgs e) {
    153       localPluginDetailsPanel.Controls.Clear();
    154       serverPluginDetailsGroupBox.Controls.Clear();
    155 
    156       if (listView.SelectedItems.Count > 0) {
    157         var plugin = (IPluginDescription)listView.SelectedItems[0].Tag;
    158         ShowPluginDetails(plugin);
    159       }
    160     }
    161 
    162     private void ShowPluginDetails(IPluginDescription plugin) {
    163       var localView = new LocalPluginView(plugin);
    164       var serverView = new ServerPluginView(localAndServerPlugins[plugin]);
    165       localView.Dock = DockStyle.Fill;
    166       serverView.Dock = DockStyle.Fill;
    167       localPluginDetailsPanel.Controls.Add(localView);
    168       serverPluginDetailsGroupBox.Controls.Add(serverView);
    169     }
    170 
    171     private void uploadButton_Click(object sender, EventArgs e) {
    172       if (listView.SelectedItems.Count > 0) {
    173         var selectedPlugins = from item in listView.SelectedItems.Cast<ListViewItem>()
    174                               where item.Tag is IPluginDescription
    175                               select item.Tag as IPluginDescription;
    176         this.Enabled = false;
    177         pluginUploadWorker.RunWorkerAsync(selectedPlugins.ToList());
    178       }
    179     }
    180 
    181     private void connectButton_Click(object sender, EventArgs e) {
    182       OnDisconnected();
     242    // start background process to refresh the plugin list (local and server)
     243    private void RefreshPluginsAsync() {
    183244      Cursor = Cursors.AppStarting;
     245      DisableControl();
    184246      updateServerPluginsWorker.RunWorkerAsync();
    185247    }
    186248
    187     private void OnConnected() {
    188       connectButton.Enabled = false;
    189       serverUrlTextBox.Enabled = false;
    190       label1.Enabled = false;
    191 
    192       listView.Enabled = true;
    193       uploadButton.Enabled = true;
    194     }
    195 
    196     private void OnDisconnected() {
    197       connectButton.Enabled = true;
     249    // is called by all methods that start a background process
     250    // controls must be enabled manuall again when the backgroundworker finishes
     251    private void DisableControl() {
     252      MainFormManager.GetMainForm<MainForm>().ShowProgressBar();
     253      foreach (Control ctrl in Controls)
     254        ctrl.Enabled = false;
     255    }
     256
     257    private void UpdateControlsDisconnectedState() {
     258      connectButton.Text = "Connect";
    198259      serverUrlTextBox.Enabled = true;
    199       label1.Enabled = true;
     260      serverUrlLabel.Enabled = true;
     261      refreshButton.Enabled = false;
    200262
    201263      localAndServerPlugins.Clear();
    202264      listView.Items.Clear();
    203       localPluginDetailsPanel.Controls.Clear();
    204       serverPluginDetailsGroupBox.Controls.Clear();
    205265      listView.Enabled = false;
    206266      uploadButton.Enabled = false;
    207     }
     267      MainFormManager.GetMainForm<MainForm>().HideProgressBar();
     268    }
     269
     270    private void UpdateControlsConnectedState() {
     271      connectButton.Text = "Disconnect";
     272      connectButton.Enabled = true;
     273      serverUrlTextBox.Enabled = false;
     274      serverUrlLabel.Enabled = false;
     275      refreshButton.Enabled = true;
     276      listView.Enabled = true;
     277      uploadButton.Enabled = false;
     278      MainFormManager.GetMainForm<MainForm>().HideProgressBar();
     279    }
     280
     281
     282    #endregion
    208283  }
    209284}
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.resx

    r2802 r2860  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <metadata name="imageList.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>
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginView.Designer.cs

    r2816 r2860  
    2424    /// </summary>
    2525    private void InitializeComponent() {
     26      this.components = new System.ComponentModel.Container();
    2627      this.nameLabel = new System.Windows.Forms.Label();
    2728      this.nameTextBox = new System.Windows.Forms.TextBox();
     
    3334      this.dependenciesGroupBox = new System.Windows.Forms.GroupBox();
    3435      this.dependenciesListView = new System.Windows.Forms.ListView();
    35       this.nameHeader = new System.Windows.Forms.ColumnHeader();
    36       this.versionHeader = new System.Windows.Forms.ColumnHeader();
     36      this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
     37      this.pluginVersionHeader = new System.Windows.Forms.ColumnHeader();
     38      this.imageList = new System.Windows.Forms.ImageList(this.components);
     39      this.filesListView = new System.Windows.Forms.ListView();
     40      this.fileNameHeader = new System.Windows.Forms.ColumnHeader();
     41      this.fileTypeHeader = new System.Windows.Forms.ColumnHeader();
     42      this.filesGroupBox = new System.Windows.Forms.GroupBox();
    3743      this.dependenciesGroupBox.SuspendLayout();
     44      this.filesGroupBox.SuspendLayout();
    3845      this.SuspendLayout();
    3946      //
     
    5461      this.nameTextBox.Name = "nameTextBox";
    5562      this.nameTextBox.ReadOnly = true;
    56       this.nameTextBox.Size = new System.Drawing.Size(191, 20);
     63      this.nameTextBox.Size = new System.Drawing.Size(267, 20);
    5764      this.nameTextBox.TabIndex = 1;
    5865      //
     
    6471      this.versionTextBox.Name = "versionTextBox";
    6572      this.versionTextBox.ReadOnly = true;
    66       this.versionTextBox.Size = new System.Drawing.Size(191, 20);
     73      this.versionTextBox.Size = new System.Drawing.Size(267, 20);
    6774      this.versionTextBox.TabIndex = 3;
    6875      //
     
    8390      this.contactTextBox.Name = "contactTextBox";
    8491      this.contactTextBox.ReadOnly = true;
    85       this.contactTextBox.Size = new System.Drawing.Size(191, 20);
     92      this.contactTextBox.Size = new System.Drawing.Size(267, 20);
    8693      this.contactTextBox.TabIndex = 5;
    8794      //
     
    98105      //
    99106      this.licenseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    100       this.licenseButton.Location = new System.Drawing.Point(3, 397);
     107      this.licenseButton.Location = new System.Drawing.Point(3, 486);
    101108      this.licenseButton.Name = "licenseButton";
    102109      this.licenseButton.Size = new System.Drawing.Size(103, 23);
     
    104111      this.licenseButton.Text = "Show license";
    105112      this.licenseButton.UseVisualStyleBackColor = true;
     113      this.licenseButton.Click += new System.EventHandler(this.licenseButton_Click);
    106114      //
    107115      // dependenciesGroupBox
     
    111119                  | System.Windows.Forms.AnchorStyles.Right)));
    112120      this.dependenciesGroupBox.Controls.Add(this.dependenciesListView);
    113       this.dependenciesGroupBox.Location = new System.Drawing.Point(3, 81);
     121      this.dependenciesGroupBox.Location = new System.Drawing.Point(3, 255);
    114122      this.dependenciesGroupBox.Name = "dependenciesGroupBox";
    115       this.dependenciesGroupBox.Size = new System.Drawing.Size(262, 310);
     123      this.dependenciesGroupBox.Size = new System.Drawing.Size(338, 225);
    116124      this.dependenciesGroupBox.TabIndex = 1;
    117125      this.dependenciesGroupBox.TabStop = false;
     
    121129      //
    122130      this.dependenciesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    123             this.nameHeader,
    124             this.versionHeader});
     131            this.pluginNameHeader,
     132            this.pluginVersionHeader});
    125133      this.dependenciesListView.Dock = System.Windows.Forms.DockStyle.Fill;
    126134      this.dependenciesListView.Location = new System.Drawing.Point(3, 16);
    127135      this.dependenciesListView.Name = "dependenciesListView";
    128       this.dependenciesListView.Size = new System.Drawing.Size(256, 291);
     136      this.dependenciesListView.Size = new System.Drawing.Size(332, 206);
     137      this.dependenciesListView.SmallImageList = this.imageList;
    129138      this.dependenciesListView.TabIndex = 0;
    130139      this.dependenciesListView.UseCompatibleStateImageBehavior = false;
    131140      this.dependenciesListView.View = System.Windows.Forms.View.Details;
    132141      //
    133       // nameHeader
    134       //
    135       this.nameHeader.Text = "Name";
    136       this.nameHeader.Width = 180;
    137       //
    138       // versionHeader
    139       //
    140       this.versionHeader.Text = "Version";
    141       this.versionHeader.Width = 100;
     142      // pluginNameHeader
     143      //
     144      this.pluginNameHeader.Text = "Name";
     145      this.pluginNameHeader.Width = 200;
     146      //
     147      // pluginVersionHeader
     148      //
     149      this.pluginVersionHeader.Text = "Version";
     150      this.pluginVersionHeader.Width = 120;
     151      //
     152      // imageList
     153      //
     154      this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     155      this.imageList.ImageSize = new System.Drawing.Size(16, 16);
     156      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
     157      //
     158      // filesListView
     159      //
     160      this.filesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     161            this.fileNameHeader,
     162            this.fileTypeHeader});
     163      this.filesListView.Dock = System.Windows.Forms.DockStyle.Fill;
     164      this.filesListView.Location = new System.Drawing.Point(3, 16);
     165      this.filesListView.Name = "filesListView";
     166      this.filesListView.Size = new System.Drawing.Size(329, 149);
     167      this.filesListView.SmallImageList = this.imageList;
     168      this.filesListView.TabIndex = 0;
     169      this.filesListView.UseCompatibleStateImageBehavior = false;
     170      this.filesListView.View = System.Windows.Forms.View.Details;
     171      //
     172      // fileNameHeader
     173      //
     174      this.fileNameHeader.Text = "Name";
     175      this.fileNameHeader.Width = 200;
     176      //
     177      // fileTypeHeader
     178      //
     179      this.fileTypeHeader.Text = "Type";
     180      this.fileTypeHeader.Width = 120;
     181      //
     182      // filesGroupBox
     183      //
     184      this.filesGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     185                  | System.Windows.Forms.AnchorStyles.Right)));
     186      this.filesGroupBox.Controls.Add(this.filesListView);
     187      this.filesGroupBox.Location = new System.Drawing.Point(3, 81);
     188      this.filesGroupBox.Name = "filesGroupBox";
     189      this.filesGroupBox.Size = new System.Drawing.Size(335, 168);
     190      this.filesGroupBox.TabIndex = 11;
     191      this.filesGroupBox.TabStop = false;
     192      this.filesGroupBox.Text = "Files";
    142193      //
    143194      // PluginView
     
    146197      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    147198      this.Controls.Add(this.dependenciesGroupBox);
     199      this.Controls.Add(this.filesGroupBox);
    148200      this.Controls.Add(this.licenseButton);
    149201      this.Controls.Add(this.contactTextBox);
     
    154206      this.Controls.Add(this.nameLabel);
    155207      this.Name = "PluginView";
    156       this.Size = new System.Drawing.Size(268, 423);
     208      this.Size = new System.Drawing.Size(344, 512);
    157209      this.dependenciesGroupBox.ResumeLayout(false);
     210      this.filesGroupBox.ResumeLayout(false);
    158211      this.ResumeLayout(false);
    159212      this.PerformLayout();
     
    171224    protected System.Windows.Forms.Button licenseButton;
    172225    protected System.Windows.Forms.GroupBox dependenciesGroupBox;
    173     private System.Windows.Forms.ColumnHeader nameHeader;
    174     private System.Windows.Forms.ColumnHeader versionHeader;
     226    private System.Windows.Forms.ColumnHeader pluginNameHeader;
     227    private System.Windows.Forms.ColumnHeader pluginVersionHeader;
    175228    protected System.Windows.Forms.ListView dependenciesListView;
     229    private System.Windows.Forms.ListView filesListView;
     230    private System.Windows.Forms.GroupBox filesGroupBox;
     231    private System.Windows.Forms.ImageList imageList;
     232    private System.Windows.Forms.ColumnHeader fileNameHeader;
     233    private System.Windows.Forms.ColumnHeader fileTypeHeader;
    176234
    177235  }
  • 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  }
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginView.resx

    r2816 r2860  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <metadata name="imageList.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.