Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3612


Ignore:
Timestamp:
05/04/10 20:16:21 (15 years ago)
Author:
gkronber
Message:

Implemented change requests of reviewers. #989 (Implement review comments in plugin infrastructure)

Location:
trunk/sources
Files:
15 edited

Legend:

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

    r3179 r3612  
    1616    [System.Diagnostics.DebuggerStepThroughAttribute()]
    1717    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    18     [System.Runtime.Serialization.DataContractAttribute(Name="PluginDescription", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Deployment")]
     18    [System.Runtime.Serialization.DataContractAttribute(Name="PluginDescription", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Deployment", IsReference=true)]
    1919    public partial class PluginDescription : object, System.Runtime.Serialization.IExtensibleDataObject
    2020    {
     
    264264        void DeployProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription product);
    265265       
     266        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAdmin/DeleteProduct", ReplyAction="http://tempuri.org/IAdmin/DeleteProductResponse")]
     267        void DeleteProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription product);
     268       
    266269        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAdmin/DeployPlugin", ReplyAction="http://tempuri.org/IAdmin/DeployPluginResponse")]
    267270        void DeployPlugin(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.PluginDescription plugin, byte[] zipFile);
     
    307310        }
    308311       
     312        public void DeleteProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription product)
     313        {
     314            base.Channel.DeleteProduct(product);
     315        }
     316       
    309317        public void DeployPlugin(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.PluginDescription plugin, byte[] zipFile)
    310318        {
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.cs

    r3600 r3612  
    7878      remotePluginInstaller.InstallationManager = installationManager;
    7979      remotePluginInstaller.PluginManager = pluginManager;
     80
     81      pluginEditor.StatusView = this;
     82      pluginEditor.PluginManager = pluginManager;
     83
     84      productEditor.StatusView = this;     
    8085    }
    8186
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginEditor.Designer.cs

    r3608 r3612  
    5353      this.serverVersionHeader = new System.Windows.Forms.ColumnHeader();
    5454      this.descriptionHeader = new System.Windows.Forms.ColumnHeader();
     55      this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
    5556      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    56       this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
    5757      this.SuspendLayout();
    5858      //
     
    105105      this.listView.UseCompatibleStateImageBehavior = false;
    106106      this.listView.View = System.Windows.Forms.View.Details;
    107       this.listView.ItemActivate += new System.EventHandler(this.listView_ItemActivate);
    108107      this.listView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_ItemChecked);
    109108      //
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginEditor.cs

    r3608 r3612  
    3434
    3535namespace HeuristicLab.PluginInfrastructure.Advanced {
    36   internal partial class PluginEditor : UserControl {
     36  internal partial class PluginEditor : InstallationManagerControl {
     37    private const string UploadMessage = "Uploading plugins...";
     38    private const string RefreshMessage = "Downloading plugin information from deployment service...";
     39
    3740    private Dictionary<IPluginDescription, IPluginDescription> localAndServerPlugins;
    3841    private BackgroundWorker pluginUploadWorker;
    39     private BackgroundWorker updateServerPluginsWorker;
     42    private BackgroundWorker refreshPluginsWorker;
    4043
    4144    private PluginManager pluginManager;
     
    5558      pluginUploadWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(pluginUploadWorker_RunWorkerCompleted);
    5659
    57       updateServerPluginsWorker = new BackgroundWorker();
    58       updateServerPluginsWorker.DoWork += new DoWorkEventHandler(updateServerPluginsWorker_DoWork);
    59       updateServerPluginsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(updateServerPluginsWorker_RunWorkerCompleted);
     60      refreshPluginsWorker = new BackgroundWorker();
     61      refreshPluginsWorker.DoWork += new DoWorkEventHandler(refreshPluginsWorker_DoWork);
     62      refreshPluginsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(refreshPluginsWorker_RunWorkerCompleted);
    6063      #endregion
    6164    }
    6265
    6366    #region refresh plugins from server backgroundworker
    64     void updateServerPluginsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
     67    void refreshPluginsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    6568      if (e.Error != null) {
    66         MessageBox.Show("There was an error while connecting to the server." + Environment.NewLine +
     69        StatusView.ShowError("Connection Error",
     70          "There was an error while connecting to the server." + Environment.NewLine +
    6771                   "Please check your connection settings and user credentials.");
    68         UpdateControlsDisconnectedState();
    6972      } else {
    70         // refresh local plugins
    71         localAndServerPlugins.Clear();
    72         foreach (var plugin in pluginManager.Plugins) {
    73           localAndServerPlugins.Add(plugin, null);
    74         }
    75         // refresh server plugins (find matching local plugins)
    76         var plugins = (IPluginDescription[])e.Result;
    77         foreach (var plugin in plugins) {
    78           var matchingLocalPlugin = (from localPlugin in localAndServerPlugins.Keys
    79                                      where localPlugin.Name == plugin.Name
    80                                      where localPlugin.Version == localPlugin.Version
    81                                      select localPlugin).SingleOrDefault();
    82           if (matchingLocalPlugin != null) {
    83             localAndServerPlugins[matchingLocalPlugin] = plugin;
    84           }
    85         }
    86         // refresh the list view with plugins
    87         listView.Items.Clear();
    88         listView.CheckBoxes = false;
    89         //suppressCheckedEvents = true;
    90         foreach (var pair in localAndServerPlugins) {
    91           var item = MakeListViewItem(pair.Key);
    92           listView.Items.Add(item);
    93         }
    94         foreach (ColumnHeader column in listView.Columns)
    95           if (listView.Items.Count > 0)
    96             column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
    97           else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    98         //listView.suppressCheckedEvents = false;
    99         listView.CheckBoxes = true;
    100         UpdateControlsConnectedState();
    101       }
    102       // make sure cursor is set correctly
    103       Cursor = Cursors.Default;
    104     }
    105 
    106     void updateServerPluginsWorker_DoWork(object sender, DoWorkEventArgs e) {
     73        UpdatePluginListView((IEnumerable<IPluginDescription>)e.Result);
     74      }
     75      StatusView.HideProgressIndicator();
     76      StatusView.RemoveMessage(RefreshMessage);
     77      StatusView.UnlockUI();
     78    }
     79
     80    void refreshPluginsWorker_DoWork(object sender, DoWorkEventArgs e) {
     81      // refresh available plugins
    10782      var client = DeploymentService.UpdateClientFactory.CreateClient();
    108       e.Result = client.GetPlugins();
     83      try {
     84        e.Result = client.GetPlugins();
     85        client.Close();
     86      }
     87      catch (TimeoutException) {
     88        client.Abort();
     89        throw;
     90      }
     91      catch (FaultException) {
     92        client.Abort();
     93        throw;
     94      }
     95      catch (CommunicationException) {
     96        client.Abort();
     97        throw;
     98      }
    10999    }
    110100    #endregion
     
    112102    #region upload plugins to server backgroundworker
    113103    void pluginUploadWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    114       Cursor = Cursors.Default;
    115104      if (e.Error != null) {
    116         MessageBox.Show("There was an error while connecting to the server." + Environment.NewLine +
     105        StatusView.ShowError("Connection Error",
     106          "There was an error while connecting to the server." + Environment.NewLine +
    117107                   "Please check your connection settings and user credentials.");
    118         UpdateControlsDisconnectedState();
    119108      } else {
    120         UpdateControlsConnectedState();
    121         // start another async call to refresh plugin information from server
    122         RefreshPluginsAsync();
    123       }
     109        UpdatePluginListView((IEnumerable<IPluginDescription>)e.Result);
     110      }
     111      StatusView.RemoveMessage(UploadMessage);
     112      StatusView.HideProgressIndicator();
     113      StatusView.UnlockUI();
    124114    }
    125115
    126116    void pluginUploadWorker_DoWork(object sender, DoWorkEventArgs e) {
     117      // upload plugins
    127118      var selectedPlugins = (IEnumerable<IPluginDescription>)e.Argument;
    128119      DeploymentService.AdminClient adminClient = DeploymentService.AdminClientFactory.CreateClient();
    129 
    130       foreach (var plugin in IteratePlugins(selectedPlugins)) {
    131         SetMainFormStatusBar("Uploading", plugin);
    132         adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
    133       }
    134     }
    135 
     120      try {
     121        foreach (var plugin in IteratePlugins(selectedPlugins)) {
     122          adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
     123        }
     124        adminClient.Close();
     125      }
     126      catch (TimeoutException) {
     127        adminClient.Abort();
     128        throw;
     129      }
     130      catch (FaultException) {
     131        adminClient.Abort();
     132        throw;
     133      }
     134      catch (CommunicationException) {
     135        adminClient.Abort();
     136        throw;
     137      }
     138      // refresh available plugins
     139      var client = DeploymentService.UpdateClientFactory.CreateClient();
     140      try {
     141        e.Result = client.GetPlugins();
     142        client.Close();
     143      }
     144      catch (TimeoutException) {
     145        client.Abort();
     146        throw;
     147      }
     148      catch (FaultException) {
     149        client.Abort();
     150        throw;
     151      }
     152      catch (CommunicationException) {
     153        client.Abort();
     154        throw;
     155      }
     156    }
    136157    #endregion
    137158
     
    144165                            select item.Tag as IPluginDescription;
    145166      if (selectedPlugins.Count() > 0) {
    146         Cursor = Cursors.AppStarting;
    147         DisableControl();
     167        StatusView.LockUI();
     168        StatusView.ShowProgressIndicator();
     169        StatusView.ShowMessage(UploadMessage);
    148170        pluginUploadWorker.RunWorkerAsync(selectedPlugins.ToList());
    149171      }
     
    151173
    152174    private void refreshButton_Click(object sender, EventArgs e) {
    153       DisableControl();
    154       RefreshPluginsAsync();
     175      StatusView.LockUI();
     176      StatusView.ShowProgressIndicator();
     177      StatusView.ShowMessage(RefreshMessage);
     178      refreshPluginsWorker.RunWorkerAsync();
    155179    }
    156180
     
    158182
    159183    #region item list events
    160     private void listView_ItemActivate(object sender, EventArgs e) {
    161       foreach (var item in listView.SelectedItems) {
    162         var plugin = (PluginDescription)((ListViewItem)item).Tag;
    163         var compView = new PluginComparisonView(plugin, localAndServerPlugins[plugin]);
    164         compView.Show();
    165       }
    166     }
    167 
     184    private bool ignoreItemCheckedEvents = false;
    168185    private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) {
     186      if (ignoreItemCheckedEvents) return;
    169187      List<IPluginDescription> modifiedPlugins = new List<IPluginDescription>();
    170188      if (e.Item.Checked) {
     
    200218
    201219    #region helper methods
     220    private void UpdatePluginListView(IEnumerable<IPluginDescription> remotePlugins) {
     221      // refresh local plugins
     222      localAndServerPlugins.Clear();
     223      foreach (var plugin in pluginManager.Plugins) {
     224        localAndServerPlugins.Add(plugin, null);
     225      }
     226      foreach (var plugin in remotePlugins) {
     227        var matchingLocalPlugin = (from localPlugin in localAndServerPlugins.Keys
     228                                   where localPlugin.Name == plugin.Name
     229                                   where localPlugin.Version == localPlugin.Version
     230                                   select localPlugin).SingleOrDefault();
     231        if (matchingLocalPlugin != null) {
     232          localAndServerPlugins[matchingLocalPlugin] = plugin;
     233        }
     234      }
     235      // refresh the list view with plugins
     236      listView.Items.Clear();
     237      ignoreItemCheckedEvents = true;
     238      foreach (var pair in localAndServerPlugins) {
     239        var item = MakeListViewItem(pair.Key);
     240        listView.Items.Add(item);
     241      }
     242      foreach (ColumnHeader column in listView.Columns)
     243        if (listView.Items.Count > 0)
     244          column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     245        else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
     246      ignoreItemCheckedEvents = false;
     247    }
     248
    202249    private IEnumerable<IPluginDescription> GetAllDependents(IPluginDescription plugin) {
    203250      return from p in localAndServerPlugins.Keys
     
    274321      return new DeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName, plugin.ContactEmail, plugin.LicenseText);
    275322    }
    276 
    277     // start background process to refresh the plugin list (local and server)
    278     private void RefreshPluginsAsync() {
    279       Cursor = Cursors.AppStarting;
    280       DisableControl();
    281       updateServerPluginsWorker.RunWorkerAsync();
    282     }
    283 
    284     // is called by all methods that start a background process
    285     // controls must be enabled manuall again when the backgroundworker finishes
    286     private void DisableControl() {
    287       //MainFormManager.GetMainForm<MainForm>().ShowProgressBar();
    288       foreach (Control ctrl in Controls)
    289         ctrl.Enabled = false;
    290     }
    291 
    292     private void UpdateControlsDisconnectedState() {
    293       refreshButton.Enabled = false;
    294 
    295       localAndServerPlugins.Clear();
    296       listView.Items.Clear();
    297       listView.Enabled = false;
    298       uploadButton.Enabled = false;
    299       //MainFormManager.GetMainForm<MainForm>().HideProgressBar();
    300     }
    301 
    302     private void UpdateControlsConnectedState() {
    303       refreshButton.Enabled = true;
    304       listView.Enabled = true;
    305       uploadButton.Enabled = false;
    306       //MainFormManager.GetMainForm<MainForm>().HideProgressBar();
    307     }
    308     private void SetMainFormStatusBar(string p, IPluginDescription plugin) {
    309       if (InvokeRequired) Invoke((Action<string, IPluginDescription>)SetMainFormStatusBar, p, plugin);
    310       else {
    311         //MainFormManager.GetMainForm<MainForm>().SetStatusBarText(p + " " + plugin.ToString());
    312       }
    313     }
    314 
    315323    #endregion
    316324  }
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ProductEditor.Designer.cs

    r3573 r3612  
    5050      this.splitContainer = new System.Windows.Forms.SplitContainer();
    5151      this.productsGroupBox = new System.Windows.Forms.GroupBox();
     52      this.deleteProductButton = new System.Windows.Forms.Button();
    5253      this.newProductButton = new System.Windows.Forms.Button();
    5354      this.productsListView = new System.Windows.Forms.ListView();
     
    5758      this.detailsGroupBox = new System.Windows.Forms.GroupBox();
    5859      this.pluginsGroupBox = new System.Windows.Forms.GroupBox();
    59       this.pluginListView = new HeuristicLab.PluginInfrastructure.Advanced.PluginListView();
     60      this.pluginListView = new HeuristicLab.PluginInfrastructure.Advanced.MultiSelectListView();
     61      this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
    6062      this.versionTextBox = new System.Windows.Forms.TextBox();
    6163      this.nameLabel = new System.Windows.Forms.Label();
    6264      this.nameTextBox = new System.Windows.Forms.TextBox();
    6365      this.versionLabel = new System.Windows.Forms.Label();
    64       this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
    6566      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    6667      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     68      this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
     69      this.pluginVersionHeader = new System.Windows.Forms.ColumnHeader();
     70      this.pluginDescriptionHeader = new System.Windows.Forms.ColumnHeader();
    6771      this.splitContainer.Panel1.SuspendLayout();
    6872      this.splitContainer.Panel2.SuspendLayout();
     
    125129                  | System.Windows.Forms.AnchorStyles.Left)
    126130                  | System.Windows.Forms.AnchorStyles.Right)));
     131      this.productsGroupBox.Controls.Add(this.deleteProductButton);
    127132      this.productsGroupBox.Controls.Add(this.uploadButton);
    128133      this.productsGroupBox.Controls.Add(this.newProductButton);
     
    135140      this.productsGroupBox.TabStop = false;
    136141      this.productsGroupBox.Text = "Products";
     142      //
     143      // deleteProductButton
     144      //
     145      this.deleteProductButton.Enabled = false;
     146      this.deleteProductButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_CommonElements_Actions_Remove;
     147      this.deleteProductButton.Location = new System.Drawing.Point(116, 19);
     148      this.deleteProductButton.Name = "deleteProductButton";
     149      this.deleteProductButton.Size = new System.Drawing.Size(104, 26);
     150      this.deleteProductButton.TabIndex = 5;
     151      this.deleteProductButton.Text = "Delete Product";
     152      this.deleteProductButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     153      this.toolTip.SetToolTip(this.deleteProductButton, "Deletes the selected product");
     154      this.deleteProductButton.UseVisualStyleBackColor = true;
     155      this.deleteProductButton.Click += new System.EventHandler(this.deleteProductButton_Click);
    137156      //
    138157      // newProductButton
     
    160179      this.productsListView.Enabled = false;
    161180      this.productsListView.FullRowSelect = true;
     181      this.productsListView.HideSelection = false;
    162182      this.productsListView.Location = new System.Drawing.Point(6, 51);
    163183      this.productsListView.MultiSelect = false;
     
    196216      this.detailsGroupBox.Controls.Add(this.nameTextBox);
    197217      this.detailsGroupBox.Controls.Add(this.versionLabel);
     218      this.detailsGroupBox.Enabled = false;
    198219      this.detailsGroupBox.Location = new System.Drawing.Point(0, 0);
    199220      this.detailsGroupBox.Name = "detailsGroupBox";
     
    221242                  | System.Windows.Forms.AnchorStyles.Left)
    222243                  | System.Windows.Forms.AnchorStyles.Right)));
    223       this.pluginListView.Enabled = false;
     244      this.pluginListView.CheckBoxes = true;
     245      this.pluginListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     246            this.pluginNameHeader,
     247            this.pluginVersionHeader,
     248            this.pluginDescriptionHeader});
    224249      this.pluginListView.Location = new System.Drawing.Point(3, 16);
    225250      this.pluginListView.Name = "pluginListView";
    226       this.pluginListView.Plugins = null;
    227251      this.pluginListView.Size = new System.Drawing.Size(322, 330);
     252      this.pluginListView.SmallImageList = this.pluginImageList;
     253      this.pluginListView.SuppressItemCheckedEvents = false;
    228254      this.pluginListView.TabIndex = 7;
     255      this.pluginListView.UseCompatibleStateImageBehavior = false;
     256      this.pluginListView.View = System.Windows.Forms.View.Details;
    229257      this.pluginListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.pluginListView_ItemChecked);
    230258      //
     259      // pluginImageList
     260      //
     261      this.pluginImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     262      this.pluginImageList.ImageSize = new System.Drawing.Size(16, 16);
     263      this.pluginImageList.TransparentColor = System.Drawing.Color.Transparent;
     264      //
    231265      // versionTextBox
    232266      //
    233267      this.versionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    234268                  | System.Windows.Forms.AnchorStyles.Right)));
    235       this.versionTextBox.Enabled = false;
    236269      this.versionTextBox.Location = new System.Drawing.Point(57, 45);
    237270      this.versionTextBox.Name = "versionTextBox";
    238       this.versionTextBox.Size = new System.Drawing.Size(277, 20);
     271      this.versionTextBox.Size = new System.Drawing.Size(243, 20);
    239272      this.versionTextBox.TabIndex = 5;
    240273      this.versionTextBox.TextChanged += new System.EventHandler(this.versionTextBox_TextChanged);
     
    243276      //
    244277      this.nameLabel.AutoSize = true;
    245       this.nameLabel.Enabled = false;
    246278      this.nameLabel.Location = new System.Drawing.Point(13, 22);
    247279      this.nameLabel.Name = "nameLabel";
     
    254286      this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    255287                  | System.Windows.Forms.AnchorStyles.Right)));
    256       this.nameTextBox.Enabled = false;
    257288      this.nameTextBox.Location = new System.Drawing.Point(57, 19);
    258289      this.nameTextBox.Name = "nameTextBox";
    259       this.nameTextBox.Size = new System.Drawing.Size(277, 20);
     290      this.nameTextBox.Size = new System.Drawing.Size(243, 20);
    260291      this.nameTextBox.TabIndex = 3;
    261292      this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged);
     
    264295      //
    265296      this.versionLabel.AutoSize = true;
    266       this.versionLabel.Enabled = false;
    267297      this.versionLabel.Location = new System.Drawing.Point(6, 48);
    268298      this.versionLabel.Name = "versionLabel";
     
    271301      this.versionLabel.Text = "Version:";
    272302      //
    273       // pluginImageList
    274       //
    275       this.pluginImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
    276       this.pluginImageList.ImageSize = new System.Drawing.Size(16, 16);
    277       this.pluginImageList.TransparentColor = System.Drawing.Color.Transparent;
    278       //
    279303      // errorProvider
    280304      //
    281305      this.errorProvider.ContainerControl = this;
     306      //
     307      // pluginNameHeader
     308      //
     309      this.pluginNameHeader.Text = "Name";
     310      //
     311      // pluginVersionHeader
     312      //
     313      this.pluginVersionHeader.Text = "Version";
     314      //
     315      // pluginDescriptionHeader
     316      //
     317      this.pluginDescriptionHeader.Text = "Description";
    282318      //
    283319      // ProductEditor
     
    316352    private System.Windows.Forms.ImageList productImageList;
    317353    private System.Windows.Forms.ImageList pluginImageList;
    318     private PluginListView pluginListView;
     354    private MultiSelectListView pluginListView;
    319355    private System.Windows.Forms.GroupBox productsGroupBox;
    320356    private System.Windows.Forms.GroupBox detailsGroupBox;
    321357    private System.Windows.Forms.GroupBox pluginsGroupBox;
    322358    private System.Windows.Forms.ToolTip toolTip;
     359    private System.Windows.Forms.Button deleteProductButton;
     360    private System.Windows.Forms.ColumnHeader pluginNameHeader;
     361    private System.Windows.Forms.ColumnHeader pluginVersionHeader;
     362    private System.Windows.Forms.ColumnHeader pluginDescriptionHeader;
    323363
    324364  }
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ProductEditor.cs

    r3608 r3612  
    3232
    3333namespace HeuristicLab.PluginInfrastructure.Advanced {
    34   internal partial class ProductEditor : UserControl {
     34  internal partial class ProductEditor : InstallationManagerControl {
     35    private const string RefreshMessage = "Downloading product and plugin information...";
     36    private const string UploadMessage = "Uploading product and plugin information...";
     37    private const string DeleteProductMessage = "Deleting product...";
     38
    3539    private BackgroundWorker refreshProductsWorker;
    3640    private BackgroundWorker uploadChangedProductsWorker;
     41    private BackgroundWorker deleteProductWorker;
     42
    3743    private List<DeploymentService.ProductDescription> products;
    3844    private List<DeploymentService.PluginDescription> plugins;
     
    5460      uploadChangedProductsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(uploadChangedProductsWorker_RunWorkerCompleted);
    5561      uploadChangedProductsWorker.DoWork += new DoWorkEventHandler(uploadChangedProductsWorker_DoWork);
    56     }
     62
     63      deleteProductWorker = new BackgroundWorker();
     64      deleteProductWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(deleteProductWorker_RunWorkerCompleted);
     65      deleteProductWorker.DoWork += new DoWorkEventHandler(deleteProductWorker_DoWork);
     66    }
     67
     68    #region event handlers for delete product background worker
     69    void deleteProductWorker_DoWork(object sender, DoWorkEventArgs e) {
     70      var products = (IEnumerable<DeploymentService.ProductDescription>)e.Argument;
     71      var adminClient = DeploymentService.AdminClientFactory.CreateClient();
     72      // upload
     73      try {
     74        foreach (var product in products) {
     75          adminClient.DeleteProduct(product);
     76        }
     77        adminClient.Close();
     78      }
     79      catch (TimeoutException) {
     80        adminClient.Abort();
     81        throw;
     82      }
     83      catch (FaultException) {
     84        adminClient.Abort();
     85        throw;
     86      }
     87      catch (CommunicationException) {
     88        adminClient.Abort();
     89        throw;
     90      }
     91      // refresh     
     92      var updateClient = DeploymentService.UpdateClientFactory.CreateClient();
     93      try {
     94        e.Result = new object[] { updateClient.GetProducts(), updateClient.GetPlugins() };
     95        updateClient.Close();
     96      }
     97      catch (TimeoutException) {
     98        updateClient.Abort();
     99        throw;
     100      }
     101      catch (FaultException) {
     102        updateClient.Abort();
     103        throw;
     104      }
     105      catch (CommunicationException) {
     106        updateClient.Abort();
     107        throw;
     108      }
     109    }
     110
     111    void deleteProductWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
     112      if (e.Error != null) {
     113        StatusView.ShowError("Connection Error",
     114        "There was an error while connecting to the server." + Environment.NewLine +
     115           "Please check your connection settings and user credentials.");
     116        DisableControls();
     117      } else {
     118        this.products = new List<DeploymentService.ProductDescription>(
     119  (DeploymentService.ProductDescription[])((object[])e.Result)[0]);
     120        this.plugins = new List<DeploymentService.PluginDescription>(
     121          (DeploymentService.PluginDescription[])((object[])e.Result)[1]);
     122
     123        UpdateProductsList();
     124        dirtyProducts.Clear();
     125        EnableControls();
     126      }
     127      StatusView.HideProgressIndicator();
     128      StatusView.RemoveMessage(DeleteProductMessage);
     129      StatusView.UnlockUI();
     130    }
     131    #endregion
    57132
    58133    #region event handlers for upload products background worker
     
    60135      var products = (IEnumerable<DeploymentService.ProductDescription>)e.Argument;
    61136      var adminClient = DeploymentService.AdminClientFactory.CreateClient();
    62       foreach (var product in products) {
    63         adminClient.DeployProduct(product);
     137      // upload
     138      try {
     139        foreach (var product in products) {
     140          adminClient.DeployProduct(product);
     141        }
     142        adminClient.Close();
     143      }
     144      catch (TimeoutException) {
     145        adminClient.Abort();
     146        throw;
     147      }
     148      catch (FaultException) {
     149        adminClient.Abort();
     150        throw;
     151      }
     152      catch (CommunicationException) {
     153        adminClient.Abort();
     154        throw;
     155      }
     156      // refresh     
     157      var updateClient = DeploymentService.UpdateClientFactory.CreateClient();
     158      try {
     159        e.Result = new object[] { updateClient.GetProducts(), updateClient.GetPlugins() };
     160        updateClient.Close();
     161      }
     162      catch (TimeoutException) {
     163        updateClient.Abort();
     164        throw;
     165      }
     166      catch (FaultException) {
     167        updateClient.Abort();
     168        throw;
     169      }
     170      catch (CommunicationException) {
     171        updateClient.Abort();
     172        throw;
    64173      }
    65174    }
     
    67176    private void uploadChangedProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    68177      if (e.Error != null) {
    69         MessageBox.Show("There was an error while connecting to the server." + Environment.NewLine +
     178        StatusView.ShowError("Connection Error",
     179        "There was an error while connecting to the server." + Environment.NewLine +
    70180           "Please check your connection settings and user credentials.");
     181        DisableControls();
    71182      } else {
    72         this.Enabled = true;
    73         refreshProductsWorker.RunWorkerAsync();
    74       }
     183        this.products = new List<DeploymentService.ProductDescription>(
     184  (DeploymentService.ProductDescription[])((object[])e.Result)[0]);
     185        this.plugins = new List<DeploymentService.PluginDescription>(
     186          (DeploymentService.PluginDescription[])((object[])e.Result)[1]);
     187
     188        UpdateProductsList();
     189        dirtyProducts.Clear();
     190        EnableControls();
     191      }
     192      StatusView.HideProgressIndicator();
     193      StatusView.RemoveMessage(UploadMessage);
     194      StatusView.UnlockUI();
    75195    }
    76196    #endregion
     
    79199    private void refreshProductsWorker_DoWork(object sender, DoWorkEventArgs e) {
    80200      var updateClient = DeploymentService.UpdateClientFactory.CreateClient();
    81       e.Result = new object[] { updateClient.GetProducts(), updateClient.GetPlugins() };
     201      try {
     202        e.Result = new object[] { updateClient.GetProducts(), updateClient.GetPlugins() };
     203        updateClient.Close();
     204      }
     205      catch (TimeoutException) {
     206        updateClient.Abort();
     207        throw;
     208      }
     209      catch (FaultException) {
     210        updateClient.Abort();
     211        throw;
     212      }
     213      catch (CommunicationException) {
     214        updateClient.Abort();
     215        throw;
     216      }
    82217    }
    83218
    84219    private void refreshProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    85220      if (e.Error != null) {
    86         MessageBox.Show("There was an error while connecting to the server." + Environment.NewLine +
     221        StatusView.ShowError("Connection Error",
     222          "There was an error while connecting to the server." + Environment.NewLine +
    87223                   "Please check your connection settings and user credentials.");
     224        DisableControls();
    88225      } else {
    89226        this.products = new List<DeploymentService.ProductDescription>(
     
    92229          (DeploymentService.PluginDescription[])((object[])e.Result)[1]);
    93230
     231
    94232        UpdateProductsList();
    95233        dirtyProducts.Clear();
    96 
    97         Cursor = Cursors.Default;
    98         SetControlsEnabled(true);
    99       }
     234        EnableControls();
     235      }
     236      StatusView.HideProgressIndicator();
     237      StatusView.RemoveMessage(RefreshMessage);
     238      StatusView.UnlockUI();
    100239    }
    101240    #endregion
     
    107246      }
    108247      foreach (ColumnHeader column in productsListView.Columns)
    109         column.Width = -1;
     248        if (productsListView.Items.Count > 0)
     249          column.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     250        else column.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
    110251    }
    111252
     
    113254      bool productSelected = productsListView.SelectedItems.Count > 0;
    114255      detailsGroupBox.Enabled = productSelected;
    115       uploadButton.Enabled = productSelected;
    116       if (productsListView.SelectedItems.Count == 0) {
    117         ClearProductDetails();
    118         return;
    119       }
    120       DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)((ListViewItem)productsListView.SelectedItems[0]).Tag;
    121       UpdateProductDetails(activeProduct);
    122     }
    123 
    124     private void ClearProductDetails() {
    125       nameTextBox.Text = string.Empty;
    126       versionTextBox.Text = string.Empty;
    127       pluginListView.Plugins = new IPluginDescription[0];
    128     }
    129 
    130     private void UpdateProductDetails(DeploymentService.ProductDescription activeProduct) {
    131       nameTextBox.Text = activeProduct.Name;
    132       versionTextBox.Text = activeProduct.Version.ToString();
    133 
    134       UpdatePluginsListView();
    135     }
    136 
    137     private ListViewItem CreateListViewItem(DeploymentService.ProductDescription productDescription) {
    138       ListViewItem item = new ListViewItem(new string[] { productDescription.Name, productDescription.Version.ToString() });
    139       item.Tag = productDescription;
    140       item.ImageIndex = 0;
    141       return item;
    142     }
    143 
    144     private void SetControlsEnabled(bool enabled) {
    145       uploadButton.Enabled = enabled;
    146       refreshButton.Enabled = enabled;
    147       newProductButton.Enabled = enabled;
    148       splitContainer.Enabled = enabled;
    149       productsListView.Enabled = enabled;
    150       nameLabel.Enabled = enabled;
    151       nameTextBox.Enabled = enabled;
    152       versionLabel.Enabled = enabled;
    153       versionTextBox.Enabled = enabled;
    154       pluginListView.Enabled = enabled;
    155     }
     256      deleteProductButton.Enabled = productSelected;
     257      uploadButton.Enabled = dirtyProducts.Count > 0;
     258      if (productSelected) {
     259        DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)((ListViewItem)productsListView.SelectedItems[0]).Tag;
     260        nameTextBox.Text = activeProduct.Name;
     261        versionTextBox.Text = activeProduct.Version.ToString();
     262
     263        // populate plugins list view
     264        ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
     265        foreach (var plugin in plugins.OfType<IPluginDescription>()) {
     266          pluginListView.Items.Add(CreateListViewItem(plugin));
     267        }
     268
     269        pluginListView.CheckItems(from plugin in activeProduct.Plugins
     270                                  let item = FindItemForPlugin(plugin)
     271                                  where item != null
     272                                  select item);
     273
     274      } else {
     275        nameTextBox.Text = string.Empty;
     276        versionTextBox.Text = string.Empty;
     277        pluginListView.Items.Clear();
     278      }
     279    }
     280
    156281
    157282    #region button event handlers
     
    164289
    165290    private void saveButton_Click(object sender, EventArgs e) {
    166       this.Enabled = false;
     291      StatusView.LockUI();
     292      StatusView.ShowProgressIndicator();
     293      StatusView.ShowMessage(UploadMessage);
    167294      uploadChangedProductsWorker.RunWorkerAsync(dirtyProducts);
    168295    }
    169296    private void refreshButton_Click(object sender, EventArgs e) {
    170       SetControlsEnabled(false);
    171       Cursor = Cursors.AppStarting;
     297      StatusView.LockUI();
     298      StatusView.ShowProgressIndicator();
     299      StatusView.ShowMessage(RefreshMessage);
    172300      refreshProductsWorker.RunWorkerAsync();
     301    }
     302    private void deleteProductButton_Click(object sender, EventArgs e) {
     303      StatusView.LockUI();
     304      StatusView.ShowProgressIndicator();
     305      StatusView.ShowMessage(DeleteProductMessage);
     306      var selectedProducts = from item in productsListView.SelectedItems.OfType<ListViewItem>()
     307                             select (DeploymentService.ProductDescription)item.Tag;
     308      deleteProductWorker.RunWorkerAsync(selectedProducts.ToList());
    173309    }
    174310
     
    177313    #region textbox changed event handlers
    178314    private void nameTextBox_TextChanged(object sender, EventArgs e) {
    179       ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    180       DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)activeItem.Tag;
    181       if (string.IsNullOrEmpty(nameTextBox.Name)) {
    182         errorProvider.SetError(nameTextBox, "Invalid value");
    183       } else {
    184         if (activeProduct.Name != nameTextBox.Text) {
    185           activeProduct.Name = nameTextBox.Text;
    186           activeItem.SubItems[0].Text = activeProduct.Name;
    187           errorProvider.SetError(nameTextBox, string.Empty);
    188           MarkProductDirty(activeProduct);
     315      if (productsListView.SelectedItems.Count > 0) {
     316        ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
     317        DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)activeItem.Tag;
     318        if (string.IsNullOrEmpty(nameTextBox.Name)) {
     319          errorProvider.SetError(nameTextBox, "Invalid value");
     320        } else {
     321          if (activeProduct.Name != nameTextBox.Text) {
     322            activeProduct.Name = nameTextBox.Text;
     323            activeItem.SubItems[0].Text = activeProduct.Name;
     324            errorProvider.SetError(nameTextBox, string.Empty);
     325            MarkProductDirty(activeProduct);
     326          }
    189327        }
    190328      }
     
    193331
    194332    private void versionTextBox_TextChanged(object sender, EventArgs e) {
    195       ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    196       DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)activeItem.Tag;
    197       try {
    198         var newVersion = new Version(versionTextBox.Text);
    199         if (activeProduct.Version != newVersion) {
    200           activeProduct.Version = newVersion;
    201           activeItem.SubItems[1].Text = versionTextBox.Text;
    202           errorProvider.SetError(versionTextBox, string.Empty);
    203           MarkProductDirty(activeProduct);
    204         }
    205       }
    206       catch (OverflowException) {
    207         errorProvider.SetError(versionTextBox, "Invalid value");
    208       }
    209 
    210       catch (ArgumentException) {
    211         errorProvider.SetError(versionTextBox, "Invalid value");
    212       }
    213       catch (FormatException) {
    214         errorProvider.SetError(versionTextBox, "Invalid value");
     333      if (productsListView.SelectedItems.Count > 0) {
     334        ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
     335        DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)activeItem.Tag;
     336        try {
     337          var newVersion = new Version(versionTextBox.Text);
     338          if (activeProduct.Version != newVersion) {
     339            activeProduct.Version = newVersion;
     340            activeItem.SubItems[1].Text = versionTextBox.Text;
     341            errorProvider.SetError(versionTextBox, string.Empty);
     342            MarkProductDirty(activeProduct);
     343          }
     344        }
     345        catch (OverflowException) {
     346          errorProvider.SetError(versionTextBox, "Invalid value");
     347        }
     348
     349        catch (ArgumentException) {
     350          errorProvider.SetError(versionTextBox, "Invalid value");
     351        }
     352        catch (FormatException) {
     353          errorProvider.SetError(versionTextBox, "Invalid value");
     354        }
    215355      }
    216356    }
     
    219359
    220360    #region plugin list view
    221     private void UpdatePluginsListView() {
    222       ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    223       DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)activeItem.Tag;
    224       pluginListView.Plugins = plugins.OfType<IPluginDescription>();
    225       foreach (var plugin in activeProduct.Plugins) pluginListView.CheckPlugin(plugin);
    226     }
    227 
    228361    private void pluginListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
    229362      ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    230363      DeploymentService.ProductDescription activeProduct = (DeploymentService.ProductDescription)activeItem.Tag;
    231       activeProduct.Plugins = pluginListView.CheckedPlugins.Cast<DeploymentService.PluginDescription>().ToArray();
     364      activeProduct.Plugins = (from item in pluginListView.CheckedItems.OfType<ListViewItem>()
     365                               select (DeploymentService.PluginDescription)item.Tag).ToArray();
    232366      MarkProductDirty(activeProduct);
    233367    }
    234368    #endregion
    235369
     370    #region helper
    236371    private void MarkProductDirty(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription activeProduct) {
    237372      if (!dirtyProducts.Contains(activeProduct)) {
     
    241376      }
    242377    }
     378    private ListViewItem CreateListViewItem(DeploymentService.ProductDescription productDescription) {
     379      ListViewItem item = new ListViewItem(new string[] { productDescription.Name, productDescription.Version.ToString() });
     380      item.Tag = productDescription;
     381      item.ImageIndex = 0;
     382      return item;
     383    }
     384
     385    private ListViewItem CreateListViewItem(IPluginDescription plugin) {
     386      ListViewItem item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(),
     387          string.Empty, plugin.Description });
     388      item.Tag = plugin;
     389      item.ImageIndex = 0;
     390      item.Checked = false;
     391      return item;
     392    }
     393
    243394    private ListViewItem FindItemForProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription activeProduct) {
    244395      return (from item in productsListView.Items.OfType<ListViewItem>()
     
    248399              select item).Single();
    249400    }
     401
     402    private ListViewItem FindItemForPlugin(IPluginDescription plugin) {
     403      return (from i in pluginListView.Items.Cast<ListViewItem>()
     404              let p = i.Tag as IPluginDescription
     405              where p != null
     406              where p.Name == plugin.Name
     407              where p.Version == plugin.Version
     408              select i).SingleOrDefault();
     409    }
     410
     411    private void DisableControls() {
     412      newProductButton.Enabled = false;
     413      productsListView.Enabled = false;
     414      detailsGroupBox.Enabled = false;
     415      deleteProductButton.Enabled = false;
     416      nameTextBox.Text = string.Empty;
     417      versionTextBox.Text = string.Empty;
     418      pluginListView.Items.Clear();
     419    }
     420    private void EnableControls() {
     421      newProductButton.Enabled = true;
     422      productsListView.Enabled = true;
     423    }
     424    #endregion
     425
    250426  }
    251427}
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.Designer.cs

    r3608 r3612  
    5050      this.descriptionHeader = new System.Windows.Forms.ColumnHeader();
    5151      this.pluginsImageList = new System.Windows.Forms.ImageList(this.components);
    52       this.refreshButton = new System.Windows.Forms.Button();
    53       this.installPluginsButton = new System.Windows.Forms.Button();
    5452      this.productsListView = new System.Windows.Forms.ListView();
    5553      this.productNameHeader = new System.Windows.Forms.ColumnHeader();
     
    5856      this.productImageList = new System.Windows.Forms.ImageList(this.components);
    5957      this.productsGroupBox = new System.Windows.Forms.GroupBox();
     58      this.pluginsGroupBox = new System.Windows.Forms.GroupBox();
     59      this.splitContainer = new System.Windows.Forms.SplitContainer();
     60      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    6061      this.showDetailsButton = new System.Windows.Forms.RadioButton();
    6162      this.showLargeIconsButton = new System.Windows.Forms.RadioButton();
    6263      this.installProductsButton = new System.Windows.Forms.Button();
    63       this.pluginsGroupBox = new System.Windows.Forms.GroupBox();
    64       this.splitContainer = new System.Windows.Forms.SplitContainer();
    65       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     64      this.refreshButton = new System.Windows.Forms.Button();
     65      this.installPluginsButton = new System.Windows.Forms.Button();
    6666      this.productsGroupBox.SuspendLayout();
    6767      this.pluginsGroupBox.SuspendLayout();
     
    8484      this.pluginsListView.Name = "pluginsListView";
    8585      this.pluginsListView.ShowGroups = false;
    86       this.pluginsListView.Size = new System.Drawing.Size(259, 496);
     86      this.pluginsListView.Size = new System.Drawing.Size(266, 502);
    8787      this.pluginsListView.SmallImageList = this.pluginsImageList;
    8888      this.pluginsListView.SuppressItemCheckedEvents = false;
     
    112112      this.pluginsImageList.ImageSize = new System.Drawing.Size(16, 16);
    113113      this.pluginsImageList.TransparentColor = System.Drawing.Color.Transparent;
     114      //
     115      // productsListView
     116      //
     117      this.productsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     118                  | System.Windows.Forms.AnchorStyles.Left)
     119                  | System.Windows.Forms.AnchorStyles.Right)));
     120      this.productsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     121            this.productNameHeader,
     122            this.productVersionHeader});
     123      this.productsListView.HideSelection = false;
     124      this.productsListView.LargeImageList = this.productLargeImageList;
     125      this.productsListView.Location = new System.Drawing.Point(6, 50);
     126      this.productsListView.MultiSelect = false;
     127      this.productsListView.Name = "productsListView";
     128      this.productsListView.ShowGroups = false;
     129      this.productsListView.Size = new System.Drawing.Size(240, 471);
     130      this.productsListView.SmallImageList = this.productImageList;
     131      this.productsListView.TabIndex = 18;
     132      this.productsListView.UseCompatibleStateImageBehavior = false;
     133      this.productsListView.View = System.Windows.Forms.View.Details;
     134      this.productsListView.SelectedIndexChanged += new System.EventHandler(this.productsListView_SelectedIndexChanged);
     135      //
     136      // productNameHeader
     137      //
     138      this.productNameHeader.Text = "Name";
     139      //
     140      // productVersionHeader
     141      //
     142      this.productVersionHeader.Text = "Version";
     143      //
     144      // productLargeImageList
     145      //
     146      this.productLargeImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     147      this.productLargeImageList.ImageSize = new System.Drawing.Size(32, 32);
     148      this.productLargeImageList.TransparentColor = System.Drawing.Color.Transparent;
     149      //
     150      // productImageList
     151      //
     152      this.productImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     153      this.productImageList.ImageSize = new System.Drawing.Size(16, 16);
     154      this.productImageList.TransparentColor = System.Drawing.Color.Transparent;
     155      //
     156      // productsGroupBox
     157      //
     158      this.productsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     159                  | System.Windows.Forms.AnchorStyles.Left)
     160                  | System.Windows.Forms.AnchorStyles.Right)));
     161      this.productsGroupBox.Controls.Add(this.showDetailsButton);
     162      this.productsGroupBox.Controls.Add(this.showLargeIconsButton);
     163      this.productsGroupBox.Controls.Add(this.installProductsButton);
     164      this.productsGroupBox.Controls.Add(this.refreshButton);
     165      this.productsGroupBox.Controls.Add(this.productsListView);
     166      this.productsGroupBox.Location = new System.Drawing.Point(0, 0);
     167      this.productsGroupBox.Name = "productsGroupBox";
     168      this.productsGroupBox.Size = new System.Drawing.Size(252, 558);
     169      this.productsGroupBox.TabIndex = 19;
     170      this.productsGroupBox.TabStop = false;
     171      this.productsGroupBox.Text = "Products";
     172      //
     173      // pluginsGroupBox
     174      //
     175      this.pluginsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     176                  | System.Windows.Forms.AnchorStyles.Left)
     177                  | System.Windows.Forms.AnchorStyles.Right)));
     178      this.pluginsGroupBox.Controls.Add(this.pluginsListView);
     179      this.pluginsGroupBox.Controls.Add(this.installPluginsButton);
     180      this.pluginsGroupBox.Location = new System.Drawing.Point(-1, 0);
     181      this.pluginsGroupBox.Name = "pluginsGroupBox";
     182      this.pluginsGroupBox.Size = new System.Drawing.Size(278, 558);
     183      this.pluginsGroupBox.TabIndex = 20;
     184      this.pluginsGroupBox.TabStop = false;
     185      this.pluginsGroupBox.Text = "Plugins";
     186      //
     187      // splitContainer
     188      //
     189      this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     190                  | System.Windows.Forms.AnchorStyles.Left)
     191                  | System.Windows.Forms.AnchorStyles.Right)));
     192      this.splitContainer.Location = new System.Drawing.Point(0, 0);
     193      this.splitContainer.Name = "splitContainer";
     194      //
     195      // splitContainer.Panel1
     196      //
     197      this.splitContainer.Panel1.Controls.Add(this.productsGroupBox);
     198      //
     199      // splitContainer.Panel2
     200      //
     201      this.splitContainer.Panel2.Controls.Add(this.pluginsGroupBox);
     202      this.splitContainer.Size = new System.Drawing.Size(533, 558);
     203      this.splitContainer.SplitterDistance = 252;
     204      this.splitContainer.TabIndex = 21;
     205      //
     206      // showDetailsButton
     207      //
     208      this.showDetailsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     209      this.showDetailsButton.Appearance = System.Windows.Forms.Appearance.Button;
     210      this.showDetailsButton.Checked = true;
     211      this.showDetailsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.show_details;
     212      this.showDetailsButton.Location = new System.Drawing.Point(221, 19);
     213      this.showDetailsButton.Name = "showDetailsButton";
     214      this.showDetailsButton.Size = new System.Drawing.Size(25, 25);
     215      this.showDetailsButton.TabIndex = 22;
     216      this.showDetailsButton.TabStop = true;
     217      this.toolTip.SetToolTip(this.showDetailsButton, "Show Details");
     218      this.showDetailsButton.UseVisualStyleBackColor = true;
     219      this.showDetailsButton.CheckedChanged += new System.EventHandler(this.showDetailsButton_CheckedChanged);
     220      //
     221      // showLargeIconsButton
     222      //
     223      this.showLargeIconsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     224      this.showLargeIconsButton.Appearance = System.Windows.Forms.Appearance.Button;
     225      this.showLargeIconsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.show_icons;
     226      this.showLargeIconsButton.Location = new System.Drawing.Point(190, 19);
     227      this.showLargeIconsButton.Name = "showLargeIconsButton";
     228      this.showLargeIconsButton.Size = new System.Drawing.Size(25, 25);
     229      this.showLargeIconsButton.TabIndex = 21;
     230      this.toolTip.SetToolTip(this.showLargeIconsButton, "Show Large Icons");
     231      this.showLargeIconsButton.UseVisualStyleBackColor = true;
     232      this.showLargeIconsButton.CheckedChanged += new System.EventHandler(this.showLargeIconsButton_CheckedChanged);
     233      //
     234      // installProductsButton
     235      //
     236      this.installProductsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     237      this.installProductsButton.Enabled = false;
     238      this.installProductsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_Objects_Install;
     239      this.installProductsButton.Location = new System.Drawing.Point(6, 527);
     240      this.installProductsButton.Name = "installProductsButton";
     241      this.installProductsButton.Size = new System.Drawing.Size(146, 25);
     242      this.installProductsButton.TabIndex = 20;
     243      this.installProductsButton.Text = "Install Selected Product";
     244      this.installProductsButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     245      this.toolTip.SetToolTip(this.installProductsButton, "Install all plugins for the selected product");
     246      this.installProductsButton.UseVisualStyleBackColor = true;
     247      this.installProductsButton.Click += new System.EventHandler(this.installProductsButton_Click);
    114248      //
    115249      // refreshButton
     
    131265      this.installPluginsButton.Enabled = false;
    132266      this.installPluginsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_Objects_Install;
    133       this.installPluginsButton.Location = new System.Drawing.Point(6, 521);
     267      this.installPluginsButton.Location = new System.Drawing.Point(6, 527);
    134268      this.installPluginsButton.Name = "installPluginsButton";
    135269      this.installPluginsButton.Size = new System.Drawing.Size(140, 25);
     
    140274      this.installPluginsButton.UseVisualStyleBackColor = true;
    141275      this.installPluginsButton.Click += new System.EventHandler(this.installPluginsButton_Click);
    142       //
    143       // productsListView
    144       //
    145       this.productsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    146                   | System.Windows.Forms.AnchorStyles.Left)
    147                   | System.Windows.Forms.AnchorStyles.Right)));
    148       this.productsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
    149             this.productNameHeader,
    150             this.productVersionHeader});
    151       this.productsListView.HideSelection = false;
    152       this.productsListView.LargeImageList = this.productLargeImageList;
    153       this.productsListView.Location = new System.Drawing.Point(6, 50);
    154       this.productsListView.MultiSelect = false;
    155       this.productsListView.Name = "productsListView";
    156       this.productsListView.ShowGroups = false;
    157       this.productsListView.Size = new System.Drawing.Size(234, 465);
    158       this.productsListView.SmallImageList = this.productImageList;
    159       this.productsListView.TabIndex = 18;
    160       this.productsListView.UseCompatibleStateImageBehavior = false;
    161       this.productsListView.View = System.Windows.Forms.View.Details;
    162       this.productsListView.SelectedIndexChanged += new System.EventHandler(this.productsListView_SelectedIndexChanged);
    163       //
    164       // productNameHeader
    165       //
    166       this.productNameHeader.Text = "Name";
    167       //
    168       // productVersionHeader
    169       //
    170       this.productVersionHeader.Text = "Version";
    171       //
    172       // productLargeImageList
    173       //
    174       this.productLargeImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
    175       this.productLargeImageList.ImageSize = new System.Drawing.Size(32, 32);
    176       this.productLargeImageList.TransparentColor = System.Drawing.Color.Transparent;
    177       //
    178       // productImageList
    179       //
    180       this.productImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
    181       this.productImageList.ImageSize = new System.Drawing.Size(16, 16);
    182       this.productImageList.TransparentColor = System.Drawing.Color.Transparent;
    183       //
    184       // productsGroupBox
    185       //
    186       this.productsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    187                   | System.Windows.Forms.AnchorStyles.Left)
    188                   | System.Windows.Forms.AnchorStyles.Right)));
    189       this.productsGroupBox.Controls.Add(this.showDetailsButton);
    190       this.productsGroupBox.Controls.Add(this.showLargeIconsButton);
    191       this.productsGroupBox.Controls.Add(this.installProductsButton);
    192       this.productsGroupBox.Controls.Add(this.refreshButton);
    193       this.productsGroupBox.Controls.Add(this.productsListView);
    194       this.productsGroupBox.Location = new System.Drawing.Point(3, 3);
    195       this.productsGroupBox.Name = "productsGroupBox";
    196       this.productsGroupBox.Size = new System.Drawing.Size(246, 552);
    197       this.productsGroupBox.TabIndex = 19;
    198       this.productsGroupBox.TabStop = false;
    199       this.productsGroupBox.Text = "Products";
    200       //
    201       // showDetailsButton
    202       //
    203       this.showDetailsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    204       this.showDetailsButton.Appearance = System.Windows.Forms.Appearance.Button;
    205       this.showDetailsButton.Checked = true;
    206       this.showDetailsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.show_details;
    207       this.showDetailsButton.Location = new System.Drawing.Point(215, 19);
    208       this.showDetailsButton.Name = "showDetailsButton";
    209       this.showDetailsButton.Size = new System.Drawing.Size(25, 25);
    210       this.showDetailsButton.TabIndex = 22;
    211       this.showDetailsButton.TabStop = true;
    212       this.toolTip.SetToolTip(this.showDetailsButton, "Show Details");
    213       this.showDetailsButton.UseVisualStyleBackColor = true;
    214       this.showDetailsButton.CheckedChanged += new System.EventHandler(this.showDetailsButton_CheckedChanged);
    215       //
    216       // showLargeIconsButton
    217       //
    218       this.showLargeIconsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    219       this.showLargeIconsButton.Appearance = System.Windows.Forms.Appearance.Button;
    220       this.showLargeIconsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.show_icons;
    221       this.showLargeIconsButton.Location = new System.Drawing.Point(184, 19);
    222       this.showLargeIconsButton.Name = "showLargeIconsButton";
    223       this.showLargeIconsButton.Size = new System.Drawing.Size(25, 25);
    224       this.showLargeIconsButton.TabIndex = 21;
    225       this.toolTip.SetToolTip(this.showLargeIconsButton, "Show Large Icons");
    226       this.showLargeIconsButton.UseVisualStyleBackColor = true;
    227       this.showLargeIconsButton.CheckedChanged += new System.EventHandler(this.showLargeIconsButton_CheckedChanged);
    228       //
    229       // installProductsButton
    230       //
    231       this.installProductsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    232       this.installProductsButton.Enabled = false;
    233       this.installProductsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_Objects_Install;
    234       this.installProductsButton.Location = new System.Drawing.Point(6, 521);
    235       this.installProductsButton.Name = "installProductsButton";
    236       this.installProductsButton.Size = new System.Drawing.Size(146, 25);
    237       this.installProductsButton.TabIndex = 20;
    238       this.installProductsButton.Text = "Install Selected Product";
    239       this.installProductsButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
    240       this.toolTip.SetToolTip(this.installProductsButton, "Install all plugins for the selected product");
    241       this.installProductsButton.UseVisualStyleBackColor = true;
    242       this.installProductsButton.Click += new System.EventHandler(this.installProductsButton_Click);
    243       //
    244       // pluginsGroupBox
    245       //
    246       this.pluginsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    247                   | System.Windows.Forms.AnchorStyles.Left)
    248                   | System.Windows.Forms.AnchorStyles.Right)));
    249       this.pluginsGroupBox.Controls.Add(this.pluginsListView);
    250       this.pluginsGroupBox.Controls.Add(this.installPluginsButton);
    251       this.pluginsGroupBox.Location = new System.Drawing.Point(3, 3);
    252       this.pluginsGroupBox.Name = "pluginsGroupBox";
    253       this.pluginsGroupBox.Size = new System.Drawing.Size(271, 552);
    254       this.pluginsGroupBox.TabIndex = 20;
    255       this.pluginsGroupBox.TabStop = false;
    256       this.pluginsGroupBox.Text = "Plugins";
    257       //
    258       // splitContainer
    259       //
    260       this.splitContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    261                   | System.Windows.Forms.AnchorStyles.Left)
    262                   | System.Windows.Forms.AnchorStyles.Right)));
    263       this.splitContainer.Location = new System.Drawing.Point(0, 0);
    264       this.splitContainer.Name = "splitContainer";
    265       //
    266       // splitContainer.Panel1
    267       //
    268       this.splitContainer.Panel1.Controls.Add(this.productsGroupBox);
    269       //
    270       // splitContainer.Panel2
    271       //
    272       this.splitContainer.Panel2.Controls.Add(this.pluginsGroupBox);
    273       this.splitContainer.Size = new System.Drawing.Size(533, 558);
    274       this.splitContainer.SplitterDistance = 252;
    275       this.splitContainer.TabIndex = 21;
    276276      //
    277277      // RemotePluginInstallerView
  • trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.resx

    r3608 r3612  
    121121    <value>365, 17</value>
    122122  </metadata>
    123   <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124     <value>508, 17</value>
    125   </metadata>
    126123  <metadata name="productLargeImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    127124    <value>29, 18</value>
  • trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj

    r3608 r3612  
    171171    <Compile Include="Advanced\PluginEditor.Designer.cs">
    172172      <DependentUpon>PluginEditor.cs</DependentUpon>
    173     </Compile>
    174     <Compile Include="Advanced\PluginListView.cs">
    175       <SubType>UserControl</SubType>
    176     </Compile>
    177     <Compile Include="Advanced\PluginListView.Designer.cs">
    178       <DependentUpon>PluginListView.cs</DependentUpon>
    179173    </Compile>
    180174    <Compile Include="Advanced\PluginView.cs">
     
    320314    <EmbeddedResource Include="Advanced\PluginEditor.resx">
    321315      <DependentUpon>PluginEditor.cs</DependentUpon>
    322     </EmbeddedResource>
    323     <EmbeddedResource Include="Advanced\PluginListView.resx">
    324       <DependentUpon>PluginListView.cs</DependentUpon>
    325316    </EmbeddedResource>
    326317    <EmbeddedResource Include="Advanced\PluginView.resx">
  • trunk/sources/HeuristicLab.PluginInfrastructure/Properties/Settings.Designer.cs

    r3547 r3612  
    9292        [global::System.Configuration.UserScopedSettingAttribute()]
    9393        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    94         [global::System.Configuration.DefaultSettingValueAttribute("False")]
     94        [global::System.Configuration.DefaultSettingValueAttribute("True")]
    9595        public bool ShowPluginUploadControls {
    9696            get {
  • trunk/sources/HeuristicLab.PluginInfrastructure/Properties/Settings.settings

    r3547 r3612  
    2222    </Setting>
    2323    <Setting Name="ShowPluginUploadControls" Type="System.Boolean" Scope="User">
    24       <Value Profile="(Default)">False</Value>
     24      <Value Profile="(Default)">True</Value>
    2525    </Setting>
    2626  </Settings>
  • trunk/sources/HeuristicLab.PluginInfrastructure/app.config

    r3547 r3612  
    9999            </setting>
    100100            <setting name="ShowPluginUploadControls" serializeAs="String">
    101                 <value>False</value>
     101                <value>True</value>
    102102            </setting>
    103103        </HeuristicLab.PluginInfrastructure.Properties.Settings>
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/Admin.cs

    r3084 r3612  
    3838    }
    3939    [PrincipalPermission(SecurityAction.Demand, Role = "Managers")]
     40    public void DeleteProduct(ProductDescription product) {
     41      var store = new PluginStore();
     42      store.Delete(product);
     43    }
     44    [PrincipalPermission(SecurityAction.Demand, Role = "Managers")]
    4045    public void DeployPlugin(PluginDescription plugin, byte[] zipFile) {
    4146      var store = new PluginStore();
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/IAdmin.cs

    r3084 r3612  
    3535
    3636    [OperationContract]
     37    void DeleteProduct(ProductDescription product);
     38
     39    [OperationContract]
    3740    void DeployPlugin(PluginDescription plugin, byte[] zipFile);
    3841  }
  • trunk/sources/HeuristicLab.Services.Deployment/3.3/PluginStore.cs

    r3217 r3612  
    111111      }
    112112    }
    113 
    114     #endregion
    115 
    116     #region insert/update product
     113    public void Delete(ProductDescription productDescription) {
     114      using (var ctx = new PluginStoreClassesDataContext()) {
     115        try {
     116          using (var transaction = new TransactionScope()) {
     117            var productEntity = GetExistingProduct(ctx, productDescription.Name, productDescription.Version);
     118
     119            DeleteProductPlugins(ctx, productEntity);
     120            ctx.Products.DeleteOnSubmit(productEntity);
     121
     122            ctx.SubmitChanges();
     123            transaction.Complete();
     124          }
     125        }
     126        catch (SqlException ex) {
     127          throw new ArgumentException("Something went wrong while trying to delete product", ex);
     128        }
     129        catch (InvalidOperationException ex) {
     130          throw new ArgumentException("Something went wrong while trying to delete product", ex);
     131        }
     132      }
     133    }
     134
     135    #endregion
     136
     137    #region insert/update/delete product
    117138    private void InsertOrUpdateProduct(PluginStoreClassesDataContext ctx, ProductDescription product) {
    118139      var productEntity = (from p in ctx.Products
     
    126147      }
    127148
    128       DeleteOldPlugins(ctx, productEntity);
     149      DeleteProductPlugins(ctx, productEntity);
    129150
    130151      foreach (var plugin in product.Plugins) {
     
    137158    }
    138159
    139     private void DeleteOldPlugins(PluginStoreClassesDataContext ctx, Product productEntity) {
     160    private void DeleteProductPlugins(PluginStoreClassesDataContext ctx, Product productEntity) {
    140161      var oldPlugins = (from p in ctx.ProductPlugins
    141162                        where p.ProductId == productEntity.Id
     
    253274    }
    254275
     276    private Product GetExistingProduct(PluginStoreClassesDataContext ctx, string name, Version version) {
     277      return (from p in ctx.Products
     278              where p.Name == name
     279              where p.Version == version.ToString()
     280              select p).Single();
     281    }
     282
    255283    private IEnumerable<Plugin> GetDependencies(PluginStoreClassesDataContext ctx, Plugin plugin) {
    256284      return from pair in ctx.Dependencies
Note: See TracChangeset for help on using the changeset viewer.