Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/22/10 16:53:27 (14 years ago)
Author:
gkronber
Message:

Improved controls for deployment service interaction.
Increased max values for message sizes and related limits in the deployment service configuration.
Recreated proxy classes for the deployment service.

#891 (Refactor GUI for plugin management)

Location:
trunk/sources/HeuristicLab.PluginAdministrator/3.3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.PluginAdministrator/3.3/MainForm.cs

    r3081 r3179  
    2929  internal class MainForm : DockingMainForm {
    3030    private System.Windows.Forms.ToolStripProgressBar progressBar;
    31 
     31    private System.Windows.Forms.ToolStripLabel statusLabel;
    3232    public MainForm(Type type)
    3333      : base(type) {
     
    4141
    4242    private void InitializeComponent() {
     43      this.progressBar = new System.Windows.Forms.ToolStripProgressBar();
     44      this.statusLabel = new System.Windows.Forms.ToolStripLabel();
    4345      this.SuspendLayout();
     46      //
     47      // progressBar
     48      //
     49      this.progressBar.MarqueeAnimationSpeed = 30;
     50      this.progressBar.Name = "progressBar";
     51      this.progressBar.Size = new System.Drawing.Size(100, 16);
     52      this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
     53      this.progressBar.Visible = false;
    4454
    45       progressBar = new System.Windows.Forms.ToolStripProgressBar();
    46       progressBar.MarqueeAnimationSpeed = 30;
    47       progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee;
    48       progressBar.Visible = false;
    49       statusStrip.Items.Add(progressBar);
     55      this.statusLabel.Name = "statusLabel";
     56      this.statusLabel.Visible = true;
    5057      //
    5158      // MainForm
     
    5663      this.ResumeLayout(false);
    5764      this.PerformLayout();
     65
    5866    }
    5967
     
    6573      progressBar.Visible = false;
    6674    }
     75
     76    public void SetStatusBarText(string msg) {
     77      statusLabel.Text = msg;
     78    }
    6779  }
    6880}
  • trunk/sources/HeuristicLab.PluginAdministrator/3.3/PluginEditor.cs

    r3081 r3179  
    133133
    134134        foreach (var plugin in IteratePlugins(selectedPlugins)) {
     135          SetMainFormStatusBar("Uploading", plugin);
    135136          adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin));
    136137        }
     
    144145      }
    145146    }
     147
    146148    #endregion
    147149
     
    187189          var plugin = (IPluginDescription)item.Tag;
    188190          // also check all dependencies
    189           modifiedPlugins.Add(plugin);
     191          if (!modifiedPlugins.Contains(plugin))
     192            modifiedPlugins.Add(plugin);
    190193          foreach (var dep in GetAllDependencies(plugin)) {
    191             modifiedPlugins.Add(dep);
     194            if (!modifiedPlugins.Contains(dep))
     195              modifiedPlugins.Add(dep);
    192196          }
    193197        }
     
    197201          var plugin = (IPluginDescription)item.Tag;
    198202          // also uncheck all dependent plugins
    199           modifiedPlugins.Add(plugin);
     203          if (!modifiedPlugins.Contains(plugin))
     204            modifiedPlugins.Add(plugin);
    200205          foreach (var dep in GetAllDependents(plugin)) {
    201             modifiedPlugins.Add(dep);
     206            if (!modifiedPlugins.Contains(dep))
     207              modifiedPlugins.Add(dep);
    202208          }
    203209        }
     
    231237
    232238    private IEnumerable<IPluginDescription> IteratePlugins(IEnumerable<IPluginDescription> plugins) {
     239      HashSet<IPluginDescription> yieldedItems = new HashSet<IPluginDescription>();
    233240      foreach (var plugin in plugins) {
    234241        foreach (var dependency in IteratePlugins(plugin.Dependencies)) {
    235           yield return dependency;
    236         }
    237         yield return plugin;
     242          if (!yieldedItems.Contains(dependency)) {
     243            yieldedItems.Add(dependency);
     244            yield return dependency;
     245          }
     246        }
     247        if (!yieldedItems.Contains(plugin)) {
     248          yieldedItems.Add(plugin);
     249          yield return plugin;
     250        }
    238251      }
    239252    }
     
    309322      MainFormManager.GetMainForm<MainForm>().HideProgressBar();
    310323    }
     324    private void SetMainFormStatusBar(string p, IPluginDescription plugin) {
     325      if (InvokeRequired) Invoke((Action<string, IPluginDescription>)SetMainFormStatusBar, p, plugin);
     326      else {
     327        MainFormManager.GetMainForm<MainForm>().SetStatusBarText(p + " " + plugin.ToString());
     328      }
     329    }
     330
    311331    #endregion
    312332  }
  • trunk/sources/HeuristicLab.PluginAdministrator/3.3/PluginListView.cs

    r3081 r3179  
    4747    }
    4848
    49     private List<IPluginDescription> checkedPlugins = new List<IPluginDescription>();
     49    private Dictionary<IPluginDescription, bool> checkedPlugins = new Dictionary<IPluginDescription, bool>();
    5050    public IEnumerable<IPluginDescription> CheckedPlugins {
    5151      get {
    52         return checkedPlugins;
     52        return from pair in checkedPlugins
     53               where pair.Value
     54               select pair.Key;
    5355      }
    5456    }
     
    7779    private ListViewItem CreateListViewItem(IPluginDescription plugin) {
    7880      var item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString() });
    79       item.Checked = (from p in checkedPlugins where p.Name == plugin.Name where p.Version == plugin.Version select p).Any();
     81      item.Checked = checkedPlugins.ContainsKey(plugin) ? checkedPlugins[plugin] : false;
    8082      item.Tag = plugin;
    8183      return item;
     
    8991          // also check all dependencies
    9092          MarkPluginChecked(plugin);
    91           modifiedPlugins.Add(plugin);
     93          if (!modifiedPlugins.Contains(plugin))
     94            modifiedPlugins.Add(plugin);
    9295          foreach (var dep in GetAllDependencies(plugin)) {
    9396            MarkPluginChecked(dep);
    94             modifiedPlugins.Add(dep);
     97            if (!modifiedPlugins.Contains(dep))
     98              modifiedPlugins.Add(dep);
    9599          }
    96100        }
     
    102106          // also uncheck all dependent plugins
    103107          MarkPluginUnchecked(plugin);
    104           modifiedPlugins.Add(plugin);
     108          if (!modifiedPlugins.Contains(plugin))
     109            modifiedPlugins.Add(plugin);
    105110          foreach (var dep in GetAllDependents(plugin)) {
    106111            MarkPluginUnchecked(dep);
    107             modifiedPlugins.Add(dep);
     112            if (!modifiedPlugins.Contains(dep))
     113              modifiedPlugins.Add(dep);
    108114          }
    109115
     
    115121
    116122    private void MarkPluginChecked(IPluginDescription plugin) {
    117       var matching = from p in checkedPlugins
    118                      where p.Name == plugin.Name
    119                      where p.Version == plugin.Version
    120                      select p;
    121       if (!matching.Any()) checkedPlugins.Add(plugin);
     123      checkedPlugins[plugin] = true;
    122124    }
    123125
    124126    private void MarkPluginUnchecked(IPluginDescription plugin) {
    125       checkedPlugins = (from p in checkedPlugins
    126                         where p.Name != plugin.Name ||
    127                               p.Version != plugin.Version
    128                         select p).ToList();
     127      checkedPlugins[plugin] = false;
    129128    }
    130129
     
    148147
    149148    private IEnumerable<IPluginDescription> GetAllDependencies(IPluginDescription plugin) {
     149      HashSet<IPluginDescription> yieldedPlugins = new HashSet<IPluginDescription>();
    150150      foreach (var dep in plugin.Dependencies) {
    151151        foreach (var recDep in GetAllDependencies(dep)) {
    152           yield return recDep;
     152          if (!yieldedPlugins.Contains(recDep)) {
     153            yieldedPlugins.Add(recDep);
     154            yield return recDep;
     155          }
    153156        }
    154         yield return dep;
     157        if (!yieldedPlugins.Contains(dep)) {
     158          yieldedPlugins.Add(dep);
     159          yield return dep;
     160        }
    155161      }
    156162    }
  • trunk/sources/HeuristicLab.PluginAdministrator/3.3/ProductEditor.Designer.cs

    r3081 r3179  
    5454      this.productVersionHeader = new System.Windows.Forms.ColumnHeader();
    5555      this.productImageList = new System.Windows.Forms.ImageList(this.components);
    56       this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
     56      this.pluginListView = new HeuristicLab.PluginAdministrator.PluginListView();
    5757      this.pluginsLabel = new System.Windows.Forms.Label();
    5858      this.versionTextBox = new System.Windows.Forms.TextBox();
     
    6060      this.nameTextBox = new System.Windows.Forms.TextBox();
    6161      this.nameLabel = new System.Windows.Forms.Label();
     62      this.pluginImageList = new System.Windows.Forms.ImageList(this.components);
    6263      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    63       this.pluginListView = new PluginListView();
    6464      this.splitContainer.Panel1.SuspendLayout();
    6565      this.splitContainer.Panel2.SuspendLayout();
     
    8181      //
    8282      this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
     83      this.saveButton.Enabled = false;
    8384      this.saveButton.Location = new System.Drawing.Point(3, 365);
    8485      this.saveButton.Name = "saveButton";
     
    9192      // newProductButton
    9293      //
     94      this.newProductButton.Enabled = false;
    9395      this.newProductButton.Location = new System.Drawing.Point(84, 3);
    9496      this.newProductButton.Name = "newProductButton";
     
    132134            this.productNameHeader,
    133135            this.productVersionHeader});
     136      this.productsListView.Enabled = false;
    134137      this.productsListView.FullRowSelect = true;
    135138      this.productsListView.Location = new System.Drawing.Point(3, 3);
     
    159162      this.productImageList.TransparentColor = System.Drawing.Color.Transparent;
    160163      //
    161       // pluginImageList
    162       //
    163       this.pluginImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
    164       this.pluginImageList.ImageSize = new System.Drawing.Size(16, 16);
    165       this.pluginImageList.TransparentColor = System.Drawing.Color.Transparent;
     164      // pluginListView
     165      //
     166      this.pluginListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     167                  | System.Windows.Forms.AnchorStyles.Left)
     168                  | System.Windows.Forms.AnchorStyles.Right)));
     169      this.pluginListView.Enabled = false;
     170      this.pluginListView.Location = new System.Drawing.Point(3, 85);
     171      this.pluginListView.Name = "pluginListView";
     172      this.pluginListView.Plugins = null;
     173      this.pluginListView.Size = new System.Drawing.Size(330, 303);
     174      this.pluginListView.TabIndex = 7;
     175      this.pluginListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.pluginListView_ItemChecked);
    166176      //
    167177      // pluginsLabel
     
    178188      this.versionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    179189                  | System.Windows.Forms.AnchorStyles.Right)));
     190      this.versionTextBox.Enabled = false;
    180191      this.versionTextBox.Location = new System.Drawing.Point(68, 29);
    181192      this.versionTextBox.Name = "versionTextBox";
     
    187198      //
    188199      this.versionLabel.AutoSize = true;
     200      this.versionLabel.Enabled = false;
    189201      this.versionLabel.Location = new System.Drawing.Point(10, 32);
    190202      this.versionLabel.Name = "versionLabel";
     
    197209      this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    198210                  | System.Windows.Forms.AnchorStyles.Right)));
     211      this.nameTextBox.Enabled = false;
    199212      this.nameTextBox.Location = new System.Drawing.Point(68, 3);
    200213      this.nameTextBox.Name = "nameTextBox";
     
    206219      //
    207220      this.nameLabel.AutoSize = true;
     221      this.nameLabel.Enabled = false;
    208222      this.nameLabel.Location = new System.Drawing.Point(17, 6);
    209223      this.nameLabel.Name = "nameLabel";
     
    212226      this.nameLabel.Text = "Name:";
    213227      //
     228      // pluginImageList
     229      //
     230      this.pluginImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
     231      this.pluginImageList.ImageSize = new System.Drawing.Size(16, 16);
     232      this.pluginImageList.TransparentColor = System.Drawing.Color.Transparent;
     233      //
    214234      // errorProvider
    215235      //
    216236      this.errorProvider.ContainerControl = this;
    217       //
    218       // pluginListView
    219       //
    220       this.pluginListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    221                   | System.Windows.Forms.AnchorStyles.Left)
    222                   | System.Windows.Forms.AnchorStyles.Right)));
    223       this.pluginListView.Location = new System.Drawing.Point(3, 85);
    224       this.pluginListView.Name = "pluginListView";
    225       this.pluginListView.Plugins = null;
    226       this.pluginListView.Size = new System.Drawing.Size(330, 303);
    227       this.pluginListView.TabIndex = 7;
    228       this.pluginListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.pluginListView_ItemChecked);
    229237      //
    230238      // ProductEditor
  • trunk/sources/HeuristicLab.PluginAdministrator/3.3/ProductEditor.cs

    r3081 r3179  
    9191
    9292    private void refreshProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
    93       this.products = new List<PluginDeploymentService.ProductDescription>(
    94         (PluginDeploymentService.ProductDescription[])((object[])e.Result)[0]);
    95       this.plugins = new List<PluginDeploymentService.PluginDescription>(
    96         (PluginDeploymentService.PluginDescription[])((object[])e.Result)[1]);
    97 
    98       UpdateProductsList();
    99       dirtyProducts.Clear();
    100 
    101       Cursor = Cursors.Default;
    102       SetControlsEnabled(true);
     93      if (!e.Cancelled && e.Result != null) {
     94        this.products = new List<PluginDeploymentService.ProductDescription>(
     95          (PluginDeploymentService.ProductDescription[])((object[])e.Result)[0]);
     96        this.plugins = new List<PluginDeploymentService.PluginDescription>(
     97          (PluginDeploymentService.PluginDescription[])((object[])e.Result)[1]);
     98
     99        UpdateProductsList();
     100        dirtyProducts.Clear();
     101
     102        Cursor = Cursors.Default;
     103        SetControlsEnabled(true);
     104      }
    103105    }
    104106    #endregion
     
    136138      newProductButton.Enabled = enabled;
    137139      splitContainer.Enabled = enabled;
     140      productsListView.Enabled = enabled;
     141      nameLabel.Enabled = enabled;
     142      nameTextBox.Enabled = enabled;
     143      versionLabel.Enabled = enabled;
     144      versionTextBox.Enabled = enabled;
     145      pluginListView.Enabled = enabled;
    138146    }
    139147
Note: See TracChangeset for help on using the changeset viewer.