Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3015


Ignore:
Timestamp:
03/12/10 14:58:26 (14 years ago)
Author:
gkronber
Message:

Improved GUI for plugin and product management. #891 (Refactor GUI for plugin management)

Location:
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient
Files:
2 added
7 edited

Legend:

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

    r3006 r3015  
    1212    public ConnectionSetupView() {
    1313      InitializeComponent();
    14 
     14      Caption = "Edit Connection Settings";
    1515      updateAddressTextBox.Text = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocation;
    1616      adminAddressTextBox.Text = HeuristicLab.PluginInfrastructure.Properties.Settings.Default.UpdateLocationAdministrationAddress;
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/HeuristicLab.DeploymentService.AdminClient.csproj

    r3006 r3015  
    8080      <DependentUpon>ConnectionSetupView.cs</DependentUpon>
    8181    </Compile>
     82    <Compile Include="EditConnectionAction.cs" />
     83    <Compile Include="EditConnectionMenuItem.cs" />
    8284    <Compile Include="LicenseView.cs">
    8385      <SubType>UserControl</SubType>
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.Designer.cs

    r3006 r3015  
    3030      this.serverVersion = new System.Windows.Forms.ColumnHeader();
    3131      this.imageList = new System.Windows.Forms.ImageList(this.components);
    32       this.connectionSetupButton = new System.Windows.Forms.Button();
    3332      this.refreshButton = new System.Windows.Forms.Button();
    3433      this.uploadButton = new System.Windows.Forms.Button();
     
    8180      this.imageList.TransparentColor = System.Drawing.Color.Transparent;
    8281      //
    83       // connectionSetupButton
    84       //
    85       this.connectionSetupButton.Location = new System.Drawing.Point(84, 3);
    86       this.connectionSetupButton.Name = "connectionSetupButton";
    87       this.connectionSetupButton.Size = new System.Drawing.Size(118, 23);
    88       this.connectionSetupButton.TabIndex = 3;
    89       this.connectionSetupButton.Text = "Edit Connection...";
    90       this.connectionSetupButton.UseVisualStyleBackColor = true;
    91       this.connectionSetupButton.Click += new System.EventHandler(this.connectButton_Click);
    92       //
    9382      // refreshButton
    9483      //
     
    118107      this.Controls.Add(this.uploadButton);
    119108      this.Controls.Add(this.refreshButton);
    120       this.Controls.Add(this.connectionSetupButton);
    121109      this.Controls.Add(this.listView);
    122110      this.Name = "PluginListView";
     
    131119    private System.Windows.Forms.ColumnHeader nameHeader;
    132120    private System.Windows.Forms.ColumnHeader localVersion;
    133     private System.Windows.Forms.Button connectionSetupButton;
    134121    private System.Windows.Forms.ColumnHeader serverVersion;
    135122    private System.Windows.Forms.Button refreshButton;
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.cs

    r3006 r3015  
    244244
    245245    private void UpdateControlsDisconnectedState() {
    246       connectionSetupButton.Text = "Connect";
    247246      refreshButton.Enabled = false;
    248247
     
    255254
    256255    private void UpdateControlsConnectedState() {
    257       connectionSetupButton.Text = "Disconnect";
    258       connectionSetupButton.Enabled = true;
    259256      refreshButton.Enabled = true;
    260257      listView.Enabled = true;
     
    262259      MainFormManager.GetMainForm<MainForm>().HideProgressBar();
    263260    }
    264 
    265 
    266261    #endregion
    267262  }
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/ProductEditor.Designer.cs

    r2804 r3015  
    2525    private void InitializeComponent() {
    2626      this.components = new System.ComponentModel.Container();
    27       this.productsListBox = new System.Windows.Forms.ListBox();
    28       this.pluginsList = new System.Windows.Forms.CheckedListBox();
    2927      this.refreshButton = new System.Windows.Forms.Button();
    3028      this.saveButton = new System.Windows.Forms.Button();
     
    3735      this.nameLabel = new System.Windows.Forms.Label();
    3836      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
     37      this.productsListView = new System.Windows.Forms.ListView();
     38      this.productNameHeader = new System.Windows.Forms.ColumnHeader();
     39      this.productVersionHeader = new System.Windows.Forms.ColumnHeader();
     40      this.productImageList = new System.Windows.Forms.ImageList(this.components);
     41      this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
     42      this.pluginsListView = new System.Windows.Forms.ListView();
     43      this.pluginNameHeader = new System.Windows.Forms.ColumnHeader();
     44      this.pluginVersionHeader = new System.Windows.Forms.ColumnHeader();
    3945      this.splitContainer.Panel1.SuspendLayout();
    4046      this.splitContainer.Panel2.SuspendLayout();
     
    4248      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    4349      this.SuspendLayout();
    44       //
    45       // productsListBox
    46       //
    47       this.productsListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    48                   | System.Windows.Forms.AnchorStyles.Left)
    49                   | System.Windows.Forms.AnchorStyles.Right)));
    50       this.productsListBox.FormattingEnabled = true;
    51       this.productsListBox.Location = new System.Drawing.Point(3, 3);
    52       this.productsListBox.Name = "productsListBox";
    53       this.productsListBox.Size = new System.Drawing.Size(173, 355);
    54       this.productsListBox.TabIndex = 0;
    55       this.productsListBox.SelectedIndexChanged += new System.EventHandler(this.productsListBox_SelectedIndexChanged);
    56       //
    57       // pluginsList
    58       //
    59       this.pluginsList.FormattingEnabled = true;
    60       this.pluginsList.Location = new System.Drawing.Point(6, 85);
    61       this.pluginsList.Name = "pluginsList";
    62       this.pluginsList.Size = new System.Drawing.Size(347, 289);
    63       this.pluginsList.TabIndex = 1;
    6450      //
    6551      // refreshButton
     
    7965      this.saveButton.Size = new System.Drawing.Size(96, 23);
    8066      this.saveButton.TabIndex = 2;
    81       this.saveButton.Text = "Save changes";
     67      this.saveButton.Text = "Upload Products";
    8268      this.saveButton.UseVisualStyleBackColor = true;
    8369      this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
     
    10490      // splitContainer.Panel1
    10591      //
    106       this.splitContainer.Panel1.Controls.Add(this.productsListBox);
     92      this.splitContainer.Panel1.Controls.Add(this.productsListView);
    10793      this.splitContainer.Panel1.Controls.Add(this.newProductButton);
    10894      //
    10995      // splitContainer.Panel2
    11096      //
     97      this.splitContainer.Panel2.Controls.Add(this.pluginsListView);
    11198      this.splitContainer.Panel2.Controls.Add(this.pluginsLabel);
    11299      this.splitContainer.Panel2.Controls.Add(this.versionTextBox);
     
    114101      this.splitContainer.Panel2.Controls.Add(this.nameTextBox);
    115102      this.splitContainer.Panel2.Controls.Add(this.nameLabel);
    116       this.splitContainer.Panel2.Controls.Add(this.pluginsList);
    117       this.splitContainer.Size = new System.Drawing.Size(539, 391);
    118       this.splitContainer.SplitterDistance = 179;
     103      this.splitContainer.Size = new System.Drawing.Size(659, 391);
     104      this.splitContainer.SplitterDistance = 319;
    119105      this.splitContainer.TabIndex = 4;
    120106      //
     
    122108      //
    123109      this.pluginsLabel.AutoSize = true;
    124       this.pluginsLabel.Location = new System.Drawing.Point(4, 69);
     110      this.pluginsLabel.Location = new System.Drawing.Point(11, 69);
    125111      this.pluginsLabel.Name = "pluginsLabel";
    126112      this.pluginsLabel.Size = new System.Drawing.Size(44, 13);
     
    130116      // versionTextBox
    131117      //
    132       this.versionTextBox.Location = new System.Drawing.Point(47, 29);
     118      this.versionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     119                  | System.Windows.Forms.AnchorStyles.Right)));
     120      this.versionTextBox.Location = new System.Drawing.Point(68, 29);
    133121      this.versionTextBox.Name = "versionTextBox";
    134       this.versionTextBox.Size = new System.Drawing.Size(100, 20);
     122      this.versionTextBox.Size = new System.Drawing.Size(233, 20);
    135123      this.versionTextBox.TabIndex = 5;
    136124      this.versionTextBox.TextChanged += new System.EventHandler(this.versionTextBox_TextChanged);
     
    139127      //
    140128      this.versionLabel.AutoSize = true;
    141       this.versionLabel.Location = new System.Drawing.Point(3, 32);
     129      this.versionLabel.Location = new System.Drawing.Point(10, 32);
    142130      this.versionLabel.Name = "versionLabel";
    143131      this.versionLabel.Size = new System.Drawing.Size(45, 13);
     
    147135      // nameTextBox
    148136      //
    149       this.nameTextBox.Location = new System.Drawing.Point(47, 3);
     137      this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     138                  | System.Windows.Forms.AnchorStyles.Right)));
     139      this.nameTextBox.Location = new System.Drawing.Point(68, 3);
    150140      this.nameTextBox.Name = "nameTextBox";
    151       this.nameTextBox.Size = new System.Drawing.Size(100, 20);
     141      this.nameTextBox.Size = new System.Drawing.Size(233, 20);
    152142      this.nameTextBox.TabIndex = 3;
    153143      this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged);
     
    156146      //
    157147      this.nameLabel.AutoSize = true;
    158       this.nameLabel.Location = new System.Drawing.Point(3, 6);
     148      this.nameLabel.Location = new System.Drawing.Point(17, 6);
    159149      this.nameLabel.Name = "nameLabel";
    160150      this.nameLabel.Size = new System.Drawing.Size(38, 13);
     
    165155      //
    166156      this.errorProvider.ContainerControl = this;
     157      //
     158      // productsListView
     159      //
     160      this.productsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     161                  | System.Windows.Forms.AnchorStyles.Left)
     162                  | System.Windows.Forms.AnchorStyles.Right)));
     163      this.productsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     164            this.productNameHeader,
     165            this.productVersionHeader});
     166      this.productsListView.FullRowSelect = true;
     167      this.productsListView.Location = new System.Drawing.Point(3, 3);
     168      this.productsListView.MultiSelect = false;
     169      this.productsListView.Name = "productsListView";
     170      this.productsListView.Size = new System.Drawing.Size(313, 356);
     171      this.productsListView.SmallImageList = this.productImageList;
     172      this.productsListView.TabIndex = 4;
     173      this.productsListView.UseCompatibleStateImageBehavior = false;
     174      this.productsListView.View = System.Windows.Forms.View.Details;
     175      this.productsListView.SelectedIndexChanged += new System.EventHandler(this.productsListBox_SelectedIndexChanged);
     176      //
     177      // productNameHeader
     178      //
     179      this.productNameHeader.Text = "Name";
     180      this.productNameHeader.Width = 150;
     181      //
     182      // productVersionHeader
     183      //
     184      this.productVersionHeader.Text = "Version";
     185      this.productVersionHeader.Width = 100;
     186      //
     187      // productImageList
     188      //
     189      this.productImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     190      this.productImageList.ImageSize = new System.Drawing.Size(16, 16);
     191      this.productImageList.TransparentColor = System.Drawing.Color.Transparent;
     192      //
     193      // pluginImageList
     194      //
     195      this.pluginImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     196      this.pluginImageList.ImageSize = new System.Drawing.Size(16, 16);
     197      this.pluginImageList.TransparentColor = System.Drawing.Color.Transparent;
     198      //
     199      // pluginsListView
     200      //
     201      this.pluginsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     202                  | System.Windows.Forms.AnchorStyles.Left)
     203                  | System.Windows.Forms.AnchorStyles.Right)));
     204      this.pluginsListView.CheckBoxes = true;
     205      this.pluginsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
     206            this.pluginNameHeader,
     207            this.pluginVersionHeader});
     208      this.pluginsListView.Location = new System.Drawing.Point(3, 85);
     209      this.pluginsListView.Name = "pluginsListView";
     210      this.pluginsListView.Size = new System.Drawing.Size(333, 303);
     211      this.pluginsListView.SmallImageList = this.pluginImageList;
     212      this.pluginsListView.TabIndex = 7;
     213      this.pluginsListView.UseCompatibleStateImageBehavior = false;
     214      this.pluginsListView.View = System.Windows.Forms.View.Details;
     215      this.pluginsListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.pluginsListView_ItemChecked);
     216      //
     217      // pluginNameHeader
     218      //
     219      this.pluginNameHeader.Text = "Name";
     220      this.pluginNameHeader.Width = 220;
     221      //
     222      // pluginVersionHeader
     223      //
     224      this.pluginVersionHeader.Text = "Version";
     225      this.pluginVersionHeader.Width = 120;
    167226      //
    168227      // ProductEditor
     
    174233      this.Controls.Add(this.refreshButton);
    175234      this.Name = "ProductEditor";
    176       this.Size = new System.Drawing.Size(545, 426);
     235      this.Size = new System.Drawing.Size(665, 426);
    177236      this.splitContainer.Panel1.ResumeLayout(false);
    178237      this.splitContainer.Panel2.ResumeLayout(false);
     
    186245    #endregion
    187246
    188     private System.Windows.Forms.ListBox productsListBox;
    189     private System.Windows.Forms.CheckedListBox pluginsList;
    190247    private System.Windows.Forms.Button refreshButton;
    191248    private System.Windows.Forms.Button saveButton;
     
    198255    private System.Windows.Forms.Label nameLabel;
    199256    private System.Windows.Forms.ErrorProvider errorProvider;
     257    private System.Windows.Forms.ListView productsListView;
     258    private System.Windows.Forms.ColumnHeader productNameHeader;
     259    private System.Windows.Forms.ColumnHeader productVersionHeader;
     260    private System.Windows.Forms.ImageList productImageList;
     261    private System.Windows.Forms.ImageList pluginImageList;
     262    private System.Windows.Forms.ListView pluginsListView;
     263    private System.Windows.Forms.ColumnHeader pluginNameHeader;
     264    private System.Windows.Forms.ColumnHeader pluginVersionHeader;
    200265
    201266  }
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/ProductEditor.cs

    r2816 r3015  
    99using HeuristicLab.MainForm;
    1010using PluginDeploymentService = HeuristicLab.PluginInfrastructure.Advanced.DeploymentService;
     11using System.ServiceModel;
     12using HeuristicLab.PluginInfrastructure;
    1113
    1214namespace HeuristicLab.DeploymentService.AdminClient {
     
    2224      Caption = "Products";
    2325
     26      productImageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.Assembly);
     27      productImageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.ArrowUp);
     28      pluginImageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.Assembly);
     29
    2430      dirtyProducts = new HashSet<PluginDeploymentService.ProductDescription>();
    2531      refreshProductsWorker = new BackgroundWorker();
     
    3238    }
    3339
    34     void uploadChangedProductsWorker_DoWork(object sender, DoWorkEventArgs e) {
     40    #region event handlers for upload products background worker
     41    private void uploadChangedProductsWorker_DoWork(object sender, DoWorkEventArgs e) {
    3542      var products = (IEnumerable<PluginDeploymentService.ProductDescription>)e.Argument;
    36       using (var adminClient = new PluginDeploymentService.AdminClient()) {
     43      var adminClient = PluginDeploymentService.AdminClientFactory.CreateClient();
     44      try {
    3745        foreach (var product in products) {
    3846          adminClient.DeployProduct(product);
    3947        }
    40       }
    41       e.Cancel = false;
    42     }
    43 
    44     void uploadChangedProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
     48        e.Cancel = false;
     49      }
     50      catch (FaultException) {
     51      }
     52    }
     53
     54    private void uploadChangedProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    4555      this.Enabled = true;
    46     }
    47 
    48     void refreshProductsWorker_DoWork(object sender, DoWorkEventArgs e) {
    49       var updateClient = new PluginDeploymentService.UpdateClient();
    50       e.Result = new object[] { updateClient.GetProducts(), updateClient.GetPlugins() };
    51     }
    52 
    53     void refreshProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
     56      refreshProductsWorker.RunWorkerAsync();
     57    }
     58    #endregion
     59
     60    #region event handlers for refresh products background worker
     61    private void refreshProductsWorker_DoWork(object sender, DoWorkEventArgs e) {
     62      var updateClient = PluginDeploymentService.UpdateClientFactory.CreateClient();
     63      try {
     64        e.Result = new object[] { updateClient.GetProducts(), updateClient.GetPlugins() };
     65      }
     66      catch (FaultException) {
     67        e.Cancel = true;
     68      }
     69    }
     70
     71    private void refreshProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    5472      this.products = new List<PluginDeploymentService.ProductDescription>(
    5573        (PluginDeploymentService.ProductDescription[])((object[])e.Result)[0]);
     
    6381      SetControlsEnabled(true);
    6482    }
     83    #endregion
    6584
    6685    private void UpdateProductsList() {
     86      productsListView.Items.Clear();
    6787      foreach (var prodDesc in products) {
    68         productsListBox.Items.Add(CreateListViewItem(prodDesc));
     88        productsListView.Items.Add(CreateListViewItem(prodDesc));
    6989      }
    7090    }
    7191
    7292    private void productsListBox_SelectedIndexChanged(object sender, EventArgs e) {
    73       if (productsListBox.SelectedItems.Count == 0) return;
    74       PluginDeploymentService.ProductDescription activeProduct = (PluginDeploymentService.ProductDescription)((ListViewItem)productsListBox.SelectedItem).Tag;
     93      if (productsListView.SelectedItems.Count == 0) return;
     94      PluginDeploymentService.ProductDescription activeProduct = (PluginDeploymentService.ProductDescription)((ListViewItem)productsListView.SelectedItems[0]).Tag;
    7595      UpdateProductDetails(activeProduct);
    7696    }
     
    80100      versionTextBox.Text = activeProduct.Version.ToString();
    81101
    82       pluginsList.Items.Clear();
     102      pluginsListView.Items.Clear();
    83103      foreach (PluginDeploymentService.PluginDescription pluginDesc in plugins) {
    84104        var matching = from p in activeProduct.Plugins
     
    87107                       select p;
    88108
    89         if (matching.Any()) pluginsList.Items.Add(pluginDesc, true);
    90         else pluginsList.Items.Add(pluginDesc, false);
    91       }
     109        if (matching.Any()) pluginsListView.Items.Add(CreateCheckedListViewItem(pluginDesc));
     110        else pluginsListView.Items.Add(CreateUncheckedListViewItem(pluginDesc));
     111      }
     112    }
     113
     114    private ListViewItem CreateUncheckedListViewItem(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.PluginDescription pluginDesc) {
     115      ListViewItem item = new ListViewItem(new string[] { pluginDesc.Name, pluginDesc.Version.ToString() });
     116      item.Checked = false;
     117      item.Tag = pluginDesc;
     118      item.ImageIndex = 0;
     119      return item;
     120    }
     121
     122    private ListViewItem CreateCheckedListViewItem(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.PluginDescription pluginDesc) {
     123      ListViewItem item = new ListViewItem(new string[] { pluginDesc.Name, pluginDesc.Version.ToString() });
     124      item.Checked = true;
     125      item.Tag = pluginDesc;
     126      item.ImageIndex = 0;
     127      return item;
     128    }
     129
     130    private ListViewItem CreateListViewItem(PluginDeploymentService.ProductDescription productDescription) {
     131      ListViewItem item = new ListViewItem(new string[] { productDescription.Name, productDescription.Version.ToString() });
     132      item.Tag = productDescription;
     133      item.ImageIndex = 0;
     134      return item;
    92135    }
    93136
     
    107150      var newProduct = new PluginDeploymentService.ProductDescription("New product", new Version("0.0.0.0"));
    108151      ListViewItem item = CreateListViewItem(newProduct);
    109       productsListBox.Items.Add(item);
    110       dirtyProducts.Add(newProduct);
    111     }
    112 
    113     private ListViewItem CreateListViewItem(PluginDeploymentService.ProductDescription productDescription) {
    114       ListViewItem item = new ListViewItem();
    115       item.Text = productDescription.Name + " " + productDescription.Version;
    116       item.Name = productDescription.Name + " " + productDescription.Version;
    117       item.Tag = productDescription;
    118       return item;
     152      productsListView.Items.Add(item);
     153      MarkProductDirty(newProduct);
    119154    }
    120155
     
    125160
    126161    private void nameTextBox_TextChanged(object sender, EventArgs e) {
    127       ListViewItem activeItem = (ListViewItem)productsListBox.SelectedItem;
     162      ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    128163      PluginDeploymentService.ProductDescription activeProduct = (PluginDeploymentService.ProductDescription)activeItem.Tag;
    129164      if (string.IsNullOrEmpty(nameTextBox.Name)) {
    130165        errorProvider.SetError(nameTextBox, "Invalid value");
    131166      } else {
    132         activeProduct.Name = nameTextBox.Text;
    133         activeItem.Text = activeProduct.Name + " " + activeProduct.Version;
    134         activeItem.Name = activeProduct.Name + " " + activeProduct.Version;
    135         errorProvider.SetError(nameTextBox, string.Empty);
    136       }
    137     }
     167        if (activeProduct.Name != nameTextBox.Text) {
     168          activeProduct.Name = nameTextBox.Text;
     169          activeItem.SubItems[0].Text = activeProduct.Name;
     170          errorProvider.SetError(nameTextBox, string.Empty);
     171          MarkProductDirty(activeProduct);
     172        }
     173      }
     174    }
     175
    138176
    139177    private void versionTextBox_TextChanged(object sender, EventArgs e) {
    140       ListViewItem activeItem = (ListViewItem)productsListBox.SelectedItem;
     178      ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
    141179      PluginDeploymentService.ProductDescription activeProduct = (PluginDeploymentService.ProductDescription)activeItem.Tag;
    142180      try {
    143         activeProduct.Version = new Version(versionTextBox.Text);
    144         activeItem.Text = activeProduct.Name + " " + activeProduct.Version;
    145         activeItem.Name = activeProduct.Name + " " + activeProduct.Version;
    146         errorProvider.SetError(versionTextBox, string.Empty);
     181        var newVersion = new Version(versionTextBox.Text);
     182        if (activeProduct.Version != newVersion) {
     183          activeProduct.Version = newVersion;
     184          activeItem.SubItems[1].Text = versionTextBox.Text;
     185          errorProvider.SetError(versionTextBox, string.Empty);
     186          MarkProductDirty(activeProduct);
     187        }
    147188      }
    148189      catch (OverflowException ex) {
     
    157198      }
    158199    }
     200
     201    private void pluginsListView_ItemChecked(object sender, ItemCheckedEventArgs e) {
     202      var pluginItem = e.Item;
     203      var activePlugin = (IPluginDescription)pluginItem.Tag;
     204      ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0];
     205      PluginDeploymentService.ProductDescription activeProduct = (PluginDeploymentService.ProductDescription)activeItem.Tag;
     206      if (pluginItem.Checked && !activeProduct.Plugins.Contains(activePlugin)) {
     207        activeProduct.AddPlugin(activePlugin);
     208        MarkProductDirty(activeProduct);
     209      } else if (!pluginItem.Checked && activeProduct.Plugins.Contains(activePlugin)) {
     210        activeProduct.RemovePlugin(activePlugin);
     211        MarkProductDirty(activeProduct);
     212      }
     213    }
     214
     215    private void MarkProductDirty(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription activeProduct) {
     216      if (!dirtyProducts.Contains(activeProduct)) {
     217        dirtyProducts.Add(activeProduct);
     218        var item = FindItemForProduct(activeProduct);
     219        item.ImageIndex = 1;
     220      }
     221    }
     222
     223    private ListViewItem FindItemForProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription activeProduct) {
     224      return (from item in productsListView.Items.OfType<ListViewItem>()
     225              let product = item.Tag as PluginDeploymentService.ProductDescription
     226              where product != null
     227              where product == activeProduct
     228              select item).Single();
     229    }
    159230  }
    160231}
  • branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/ProductEditor.resx

    r2802 r3015  
    118118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
     120  <metadata name="productImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     121    <value>140, 17</value>
     122  </metadata>
     123  <metadata name="pluginImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     124    <value>287, 17</value>
     125  </metadata>
    120126  <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121127    <value>17, 17</value>
Note: See TracChangeset for help on using the changeset viewer.