Changeset 3179 for trunk/sources/HeuristicLab.PluginAdministrator
- Timestamp:
- 03/22/10 16:53:27 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginAdministrator/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginAdministrator/3.3/MainForm.cs
r3081 r3179 29 29 internal class MainForm : DockingMainForm { 30 30 private System.Windows.Forms.ToolStripProgressBar progressBar; 31 31 private System.Windows.Forms.ToolStripLabel statusLabel; 32 32 public MainForm(Type type) 33 33 : base(type) { … … 41 41 42 42 private void InitializeComponent() { 43 this.progressBar = new System.Windows.Forms.ToolStripProgressBar(); 44 this.statusLabel = new System.Windows.Forms.ToolStripLabel(); 43 45 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; 44 54 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; 50 57 // 51 58 // MainForm … … 56 63 this.ResumeLayout(false); 57 64 this.PerformLayout(); 65 58 66 } 59 67 … … 65 73 progressBar.Visible = false; 66 74 } 75 76 public void SetStatusBarText(string msg) { 77 statusLabel.Text = msg; 78 } 67 79 } 68 80 } -
trunk/sources/HeuristicLab.PluginAdministrator/3.3/PluginEditor.cs
r3081 r3179 133 133 134 134 foreach (var plugin in IteratePlugins(selectedPlugins)) { 135 SetMainFormStatusBar("Uploading", plugin); 135 136 adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin)); 136 137 } … … 144 145 } 145 146 } 147 146 148 #endregion 147 149 … … 187 189 var plugin = (IPluginDescription)item.Tag; 188 190 // also check all dependencies 189 modifiedPlugins.Add(plugin); 191 if (!modifiedPlugins.Contains(plugin)) 192 modifiedPlugins.Add(plugin); 190 193 foreach (var dep in GetAllDependencies(plugin)) { 191 modifiedPlugins.Add(dep); 194 if (!modifiedPlugins.Contains(dep)) 195 modifiedPlugins.Add(dep); 192 196 } 193 197 } … … 197 201 var plugin = (IPluginDescription)item.Tag; 198 202 // also uncheck all dependent plugins 199 modifiedPlugins.Add(plugin); 203 if (!modifiedPlugins.Contains(plugin)) 204 modifiedPlugins.Add(plugin); 200 205 foreach (var dep in GetAllDependents(plugin)) { 201 modifiedPlugins.Add(dep); 206 if (!modifiedPlugins.Contains(dep)) 207 modifiedPlugins.Add(dep); 202 208 } 203 209 } … … 231 237 232 238 private IEnumerable<IPluginDescription> IteratePlugins(IEnumerable<IPluginDescription> plugins) { 239 HashSet<IPluginDescription> yieldedItems = new HashSet<IPluginDescription>(); 233 240 foreach (var plugin in plugins) { 234 241 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 } 238 251 } 239 252 } … … 309 322 MainFormManager.GetMainForm<MainForm>().HideProgressBar(); 310 323 } 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 311 331 #endregion 312 332 } -
trunk/sources/HeuristicLab.PluginAdministrator/3.3/PluginListView.cs
r3081 r3179 47 47 } 48 48 49 private List<IPluginDescription> checkedPlugins = new List<IPluginDescription>();49 private Dictionary<IPluginDescription, bool> checkedPlugins = new Dictionary<IPluginDescription, bool>(); 50 50 public IEnumerable<IPluginDescription> CheckedPlugins { 51 51 get { 52 return checkedPlugins; 52 return from pair in checkedPlugins 53 where pair.Value 54 select pair.Key; 53 55 } 54 56 } … … 77 79 private ListViewItem CreateListViewItem(IPluginDescription plugin) { 78 80 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; 80 82 item.Tag = plugin; 81 83 return item; … … 89 91 // also check all dependencies 90 92 MarkPluginChecked(plugin); 91 modifiedPlugins.Add(plugin); 93 if (!modifiedPlugins.Contains(plugin)) 94 modifiedPlugins.Add(plugin); 92 95 foreach (var dep in GetAllDependencies(plugin)) { 93 96 MarkPluginChecked(dep); 94 modifiedPlugins.Add(dep); 97 if (!modifiedPlugins.Contains(dep)) 98 modifiedPlugins.Add(dep); 95 99 } 96 100 } … … 102 106 // also uncheck all dependent plugins 103 107 MarkPluginUnchecked(plugin); 104 modifiedPlugins.Add(plugin); 108 if (!modifiedPlugins.Contains(plugin)) 109 modifiedPlugins.Add(plugin); 105 110 foreach (var dep in GetAllDependents(plugin)) { 106 111 MarkPluginUnchecked(dep); 107 modifiedPlugins.Add(dep); 112 if (!modifiedPlugins.Contains(dep)) 113 modifiedPlugins.Add(dep); 108 114 } 109 115 … … 115 121 116 122 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; 122 124 } 123 125 124 126 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; 129 128 } 130 129 … … 148 147 149 148 private IEnumerable<IPluginDescription> GetAllDependencies(IPluginDescription plugin) { 149 HashSet<IPluginDescription> yieldedPlugins = new HashSet<IPluginDescription>(); 150 150 foreach (var dep in plugin.Dependencies) { 151 151 foreach (var recDep in GetAllDependencies(dep)) { 152 yield return recDep; 152 if (!yieldedPlugins.Contains(recDep)) { 153 yieldedPlugins.Add(recDep); 154 yield return recDep; 155 } 153 156 } 154 yield return dep; 157 if (!yieldedPlugins.Contains(dep)) { 158 yieldedPlugins.Add(dep); 159 yield return dep; 160 } 155 161 } 156 162 } -
trunk/sources/HeuristicLab.PluginAdministrator/3.3/ProductEditor.Designer.cs
r3081 r3179 54 54 this.productVersionHeader = new System.Windows.Forms.ColumnHeader(); 55 55 this.productImageList = new System.Windows.Forms.ImageList(this.components); 56 this.plugin ImageList = new System.Windows.Forms.ImageList(this.components);56 this.pluginListView = new HeuristicLab.PluginAdministrator.PluginListView(); 57 57 this.pluginsLabel = new System.Windows.Forms.Label(); 58 58 this.versionTextBox = new System.Windows.Forms.TextBox(); … … 60 60 this.nameTextBox = new System.Windows.Forms.TextBox(); 61 61 this.nameLabel = new System.Windows.Forms.Label(); 62 this.pluginImageList = new System.Windows.Forms.ImageList(this.components); 62 63 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 63 this.pluginListView = new PluginListView();64 64 this.splitContainer.Panel1.SuspendLayout(); 65 65 this.splitContainer.Panel2.SuspendLayout(); … … 81 81 // 82 82 this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 83 this.saveButton.Enabled = false; 83 84 this.saveButton.Location = new System.Drawing.Point(3, 365); 84 85 this.saveButton.Name = "saveButton"; … … 91 92 // newProductButton 92 93 // 94 this.newProductButton.Enabled = false; 93 95 this.newProductButton.Location = new System.Drawing.Point(84, 3); 94 96 this.newProductButton.Name = "newProductButton"; … … 132 134 this.productNameHeader, 133 135 this.productVersionHeader}); 136 this.productsListView.Enabled = false; 134 137 this.productsListView.FullRowSelect = true; 135 138 this.productsListView.Location = new System.Drawing.Point(3, 3); … … 159 162 this.productImageList.TransparentColor = System.Drawing.Color.Transparent; 160 163 // 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); 166 176 // 167 177 // pluginsLabel … … 178 188 this.versionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 179 189 | System.Windows.Forms.AnchorStyles.Right))); 190 this.versionTextBox.Enabled = false; 180 191 this.versionTextBox.Location = new System.Drawing.Point(68, 29); 181 192 this.versionTextBox.Name = "versionTextBox"; … … 187 198 // 188 199 this.versionLabel.AutoSize = true; 200 this.versionLabel.Enabled = false; 189 201 this.versionLabel.Location = new System.Drawing.Point(10, 32); 190 202 this.versionLabel.Name = "versionLabel"; … … 197 209 this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 198 210 | System.Windows.Forms.AnchorStyles.Right))); 211 this.nameTextBox.Enabled = false; 199 212 this.nameTextBox.Location = new System.Drawing.Point(68, 3); 200 213 this.nameTextBox.Name = "nameTextBox"; … … 206 219 // 207 220 this.nameLabel.AutoSize = true; 221 this.nameLabel.Enabled = false; 208 222 this.nameLabel.Location = new System.Drawing.Point(17, 6); 209 223 this.nameLabel.Name = "nameLabel"; … … 212 226 this.nameLabel.Text = "Name:"; 213 227 // 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 // 214 234 // errorProvider 215 235 // 216 236 this.errorProvider.ContainerControl = this; 217 //218 // pluginListView219 //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);229 237 // 230 238 // ProductEditor -
trunk/sources/HeuristicLab.PluginAdministrator/3.3/ProductEditor.cs
r3081 r3179 91 91 92 92 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 } 103 105 } 104 106 #endregion … … 136 138 newProductButton.Enabled = enabled; 137 139 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; 138 146 } 139 147
Note: See TracChangeset
for help on using the changeset viewer.