Changeset 3612
- Timestamp:
- 05/04/10 20:16:21 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/DeploymentService/DeploymentService.cs
r3179 r3612 16 16 [System.Diagnostics.DebuggerStepThroughAttribute()] 17 17 [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)] 19 19 public partial class PluginDescription : object, System.Runtime.Serialization.IExtensibleDataObject 20 20 { … … 264 264 void DeployProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription product); 265 265 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 266 269 [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAdmin/DeployPlugin", ReplyAction="http://tempuri.org/IAdmin/DeployPluginResponse")] 267 270 void DeployPlugin(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.PluginDescription plugin, byte[] zipFile); … … 307 310 } 308 311 312 public void DeleteProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription product) 313 { 314 base.Channel.DeleteProduct(product); 315 } 316 309 317 public void DeployPlugin(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.PluginDescription plugin, byte[] zipFile) 310 318 { -
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/InstallationManagerForm.cs
r3600 r3612 78 78 remotePluginInstaller.InstallationManager = installationManager; 79 79 remotePluginInstaller.PluginManager = pluginManager; 80 81 pluginEditor.StatusView = this; 82 pluginEditor.PluginManager = pluginManager; 83 84 productEditor.StatusView = this; 80 85 } 81 86 -
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginEditor.Designer.cs
r3608 r3612 53 53 this.serverVersionHeader = new System.Windows.Forms.ColumnHeader(); 54 54 this.descriptionHeader = new System.Windows.Forms.ColumnHeader(); 55 this.pluginImageList = new System.Windows.Forms.ImageList(this.components); 55 56 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 56 this.pluginImageList = new System.Windows.Forms.ImageList(this.components);57 57 this.SuspendLayout(); 58 58 // … … 105 105 this.listView.UseCompatibleStateImageBehavior = false; 106 106 this.listView.View = System.Windows.Forms.View.Details; 107 this.listView.ItemActivate += new System.EventHandler(this.listView_ItemActivate);108 107 this.listView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_ItemChecked); 109 108 // -
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/PluginEditor.cs
r3608 r3612 34 34 35 35 namespace 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 37 40 private Dictionary<IPluginDescription, IPluginDescription> localAndServerPlugins; 38 41 private BackgroundWorker pluginUploadWorker; 39 private BackgroundWorker updateServerPluginsWorker;42 private BackgroundWorker refreshPluginsWorker; 40 43 41 44 private PluginManager pluginManager; … … 55 58 pluginUploadWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(pluginUploadWorker_RunWorkerCompleted); 56 59 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); 60 63 #endregion 61 64 } 62 65 63 66 #region refresh plugins from server backgroundworker 64 void updateServerPluginsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {67 void refreshPluginsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 65 68 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 + 67 71 "Please check your connection settings and user credentials."); 68 UpdateControlsDisconnectedState();69 72 } 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 107 82 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 } 109 99 } 110 100 #endregion … … 112 102 #region upload plugins to server backgroundworker 113 103 void pluginUploadWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 114 Cursor = Cursors.Default;115 104 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 + 117 107 "Please check your connection settings and user credentials."); 118 UpdateControlsDisconnectedState();119 108 } 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(); 124 114 } 125 115 126 116 void pluginUploadWorker_DoWork(object sender, DoWorkEventArgs e) { 117 // upload plugins 127 118 var selectedPlugins = (IEnumerable<IPluginDescription>)e.Argument; 128 119 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 } 136 157 #endregion 137 158 … … 144 165 select item.Tag as IPluginDescription; 145 166 if (selectedPlugins.Count() > 0) { 146 Cursor = Cursors.AppStarting; 147 DisableControl(); 167 StatusView.LockUI(); 168 StatusView.ShowProgressIndicator(); 169 StatusView.ShowMessage(UploadMessage); 148 170 pluginUploadWorker.RunWorkerAsync(selectedPlugins.ToList()); 149 171 } … … 151 173 152 174 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(); 155 179 } 156 180 … … 158 182 159 183 #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; 168 185 private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) { 186 if (ignoreItemCheckedEvents) return; 169 187 List<IPluginDescription> modifiedPlugins = new List<IPluginDescription>(); 170 188 if (e.Item.Checked) { … … 200 218 201 219 #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 202 249 private IEnumerable<IPluginDescription> GetAllDependents(IPluginDescription plugin) { 203 250 return from p in localAndServerPlugins.Keys … … 274 321 return new DeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName, plugin.ContactEmail, plugin.LicenseText); 275 322 } 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 process285 // controls must be enabled manuall again when the backgroundworker finishes286 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 315 323 #endregion 316 324 } -
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ProductEditor.Designer.cs
r3573 r3612 50 50 this.splitContainer = new System.Windows.Forms.SplitContainer(); 51 51 this.productsGroupBox = new System.Windows.Forms.GroupBox(); 52 this.deleteProductButton = new System.Windows.Forms.Button(); 52 53 this.newProductButton = new System.Windows.Forms.Button(); 53 54 this.productsListView = new System.Windows.Forms.ListView(); … … 57 58 this.detailsGroupBox = new System.Windows.Forms.GroupBox(); 58 59 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); 60 62 this.versionTextBox = new System.Windows.Forms.TextBox(); 61 63 this.nameLabel = new System.Windows.Forms.Label(); 62 64 this.nameTextBox = new System.Windows.Forms.TextBox(); 63 65 this.versionLabel = new System.Windows.Forms.Label(); 64 this.pluginImageList = new System.Windows.Forms.ImageList(this.components);65 66 this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components); 66 67 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(); 67 71 this.splitContainer.Panel1.SuspendLayout(); 68 72 this.splitContainer.Panel2.SuspendLayout(); … … 125 129 | System.Windows.Forms.AnchorStyles.Left) 126 130 | System.Windows.Forms.AnchorStyles.Right))); 131 this.productsGroupBox.Controls.Add(this.deleteProductButton); 127 132 this.productsGroupBox.Controls.Add(this.uploadButton); 128 133 this.productsGroupBox.Controls.Add(this.newProductButton); … … 135 140 this.productsGroupBox.TabStop = false; 136 141 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); 137 156 // 138 157 // newProductButton … … 160 179 this.productsListView.Enabled = false; 161 180 this.productsListView.FullRowSelect = true; 181 this.productsListView.HideSelection = false; 162 182 this.productsListView.Location = new System.Drawing.Point(6, 51); 163 183 this.productsListView.MultiSelect = false; … … 196 216 this.detailsGroupBox.Controls.Add(this.nameTextBox); 197 217 this.detailsGroupBox.Controls.Add(this.versionLabel); 218 this.detailsGroupBox.Enabled = false; 198 219 this.detailsGroupBox.Location = new System.Drawing.Point(0, 0); 199 220 this.detailsGroupBox.Name = "detailsGroupBox"; … … 221 242 | System.Windows.Forms.AnchorStyles.Left) 222 243 | 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}); 224 249 this.pluginListView.Location = new System.Drawing.Point(3, 16); 225 250 this.pluginListView.Name = "pluginListView"; 226 this.pluginListView.Plugins = null;227 251 this.pluginListView.Size = new System.Drawing.Size(322, 330); 252 this.pluginListView.SmallImageList = this.pluginImageList; 253 this.pluginListView.SuppressItemCheckedEvents = false; 228 254 this.pluginListView.TabIndex = 7; 255 this.pluginListView.UseCompatibleStateImageBehavior = false; 256 this.pluginListView.View = System.Windows.Forms.View.Details; 229 257 this.pluginListView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.pluginListView_ItemChecked); 230 258 // 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 // 231 265 // versionTextBox 232 266 // 233 267 this.versionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 234 268 | System.Windows.Forms.AnchorStyles.Right))); 235 this.versionTextBox.Enabled = false;236 269 this.versionTextBox.Location = new System.Drawing.Point(57, 45); 237 270 this.versionTextBox.Name = "versionTextBox"; 238 this.versionTextBox.Size = new System.Drawing.Size(2 77, 20);271 this.versionTextBox.Size = new System.Drawing.Size(243, 20); 239 272 this.versionTextBox.TabIndex = 5; 240 273 this.versionTextBox.TextChanged += new System.EventHandler(this.versionTextBox_TextChanged); … … 243 276 // 244 277 this.nameLabel.AutoSize = true; 245 this.nameLabel.Enabled = false;246 278 this.nameLabel.Location = new System.Drawing.Point(13, 22); 247 279 this.nameLabel.Name = "nameLabel"; … … 254 286 this.nameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 255 287 | System.Windows.Forms.AnchorStyles.Right))); 256 this.nameTextBox.Enabled = false;257 288 this.nameTextBox.Location = new System.Drawing.Point(57, 19); 258 289 this.nameTextBox.Name = "nameTextBox"; 259 this.nameTextBox.Size = new System.Drawing.Size(2 77, 20);290 this.nameTextBox.Size = new System.Drawing.Size(243, 20); 260 291 this.nameTextBox.TabIndex = 3; 261 292 this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged); … … 264 295 // 265 296 this.versionLabel.AutoSize = true; 266 this.versionLabel.Enabled = false;267 297 this.versionLabel.Location = new System.Drawing.Point(6, 48); 268 298 this.versionLabel.Name = "versionLabel"; … … 271 301 this.versionLabel.Text = "Version:"; 272 302 // 273 // pluginImageList274 //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 //279 303 // errorProvider 280 304 // 281 305 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"; 282 318 // 283 319 // ProductEditor … … 316 352 private System.Windows.Forms.ImageList productImageList; 317 353 private System.Windows.Forms.ImageList pluginImageList; 318 private PluginListView pluginListView;354 private MultiSelectListView pluginListView; 319 355 private System.Windows.Forms.GroupBox productsGroupBox; 320 356 private System.Windows.Forms.GroupBox detailsGroupBox; 321 357 private System.Windows.Forms.GroupBox pluginsGroupBox; 322 358 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; 323 363 324 364 } -
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/ProductEditor.cs
r3608 r3612 32 32 33 33 namespace 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 35 39 private BackgroundWorker refreshProductsWorker; 36 40 private BackgroundWorker uploadChangedProductsWorker; 41 private BackgroundWorker deleteProductWorker; 42 37 43 private List<DeploymentService.ProductDescription> products; 38 44 private List<DeploymentService.PluginDescription> plugins; … … 54 60 uploadChangedProductsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(uploadChangedProductsWorker_RunWorkerCompleted); 55 61 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 57 132 58 133 #region event handlers for upload products background worker … … 60 135 var products = (IEnumerable<DeploymentService.ProductDescription>)e.Argument; 61 136 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; 64 173 } 65 174 } … … 67 176 private void uploadChangedProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 68 177 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 + 70 180 "Please check your connection settings and user credentials."); 181 DisableControls(); 71 182 } 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(); 75 195 } 76 196 #endregion … … 79 199 private void refreshProductsWorker_DoWork(object sender, DoWorkEventArgs e) { 80 200 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 } 82 217 } 83 218 84 219 private void refreshProductsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 85 220 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 + 87 223 "Please check your connection settings and user credentials."); 224 DisableControls(); 88 225 } else { 89 226 this.products = new List<DeploymentService.ProductDescription>( … … 92 229 (DeploymentService.PluginDescription[])((object[])e.Result)[1]); 93 230 231 94 232 UpdateProductsList(); 95 233 dirtyProducts.Clear(); 96 97 Cursor = Cursors.Default; 98 SetControlsEnabled(true); 99 } 234 EnableControls(); 235 } 236 StatusView.HideProgressIndicator(); 237 StatusView.RemoveMessage(RefreshMessage); 238 StatusView.UnlockUI(); 100 239 } 101 240 #endregion … … 107 246 } 108 247 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); 110 251 } 111 252 … … 113 254 bool productSelected = productsListView.SelectedItems.Count > 0; 114 255 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 156 281 157 282 #region button event handlers … … 164 289 165 290 private void saveButton_Click(object sender, EventArgs e) { 166 this.Enabled = false; 291 StatusView.LockUI(); 292 StatusView.ShowProgressIndicator(); 293 StatusView.ShowMessage(UploadMessage); 167 294 uploadChangedProductsWorker.RunWorkerAsync(dirtyProducts); 168 295 } 169 296 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); 172 300 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()); 173 309 } 174 310 … … 177 313 #region textbox changed event handlers 178 314 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 } 189 327 } 190 328 } … … 193 331 194 332 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 } 215 355 } 216 356 } … … 219 359 220 360 #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 228 361 private void pluginListView_ItemChecked(object sender, ItemCheckedEventArgs e) { 229 362 ListViewItem activeItem = (ListViewItem)productsListView.SelectedItems[0]; 230 363 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(); 232 366 MarkProductDirty(activeProduct); 233 367 } 234 368 #endregion 235 369 370 #region helper 236 371 private void MarkProductDirty(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription activeProduct) { 237 372 if (!dirtyProducts.Contains(activeProduct)) { … … 241 376 } 242 377 } 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 243 394 private ListViewItem FindItemForProduct(HeuristicLab.PluginInfrastructure.Advanced.DeploymentService.ProductDescription activeProduct) { 244 395 return (from item in productsListView.Items.OfType<ListViewItem>() … … 248 399 select item).Single(); 249 400 } 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 250 426 } 251 427 } -
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.Designer.cs
r3608 r3612 50 50 this.descriptionHeader = new System.Windows.Forms.ColumnHeader(); 51 51 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();54 52 this.productsListView = new System.Windows.Forms.ListView(); 55 53 this.productNameHeader = new System.Windows.Forms.ColumnHeader(); … … 58 56 this.productImageList = new System.Windows.Forms.ImageList(this.components); 59 57 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); 60 61 this.showDetailsButton = new System.Windows.Forms.RadioButton(); 61 62 this.showLargeIconsButton = new System.Windows.Forms.RadioButton(); 62 63 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(); 66 66 this.productsGroupBox.SuspendLayout(); 67 67 this.pluginsGroupBox.SuspendLayout(); … … 84 84 this.pluginsListView.Name = "pluginsListView"; 85 85 this.pluginsListView.ShowGroups = false; 86 this.pluginsListView.Size = new System.Drawing.Size(2 59, 496);86 this.pluginsListView.Size = new System.Drawing.Size(266, 502); 87 87 this.pluginsListView.SmallImageList = this.pluginsImageList; 88 88 this.pluginsListView.SuppressItemCheckedEvents = false; … … 112 112 this.pluginsImageList.ImageSize = new System.Drawing.Size(16, 16); 113 113 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); 114 248 // 115 249 // refreshButton … … 131 265 this.installPluginsButton.Enabled = false; 132 266 this.installPluginsButton.Image = global::HeuristicLab.PluginInfrastructure.Properties.Resources.VS2008ImageLibrary_Objects_Install; 133 this.installPluginsButton.Location = new System.Drawing.Point(6, 52 1);267 this.installPluginsButton.Location = new System.Drawing.Point(6, 527); 134 268 this.installPluginsButton.Name = "installPluginsButton"; 135 269 this.installPluginsButton.Size = new System.Drawing.Size(140, 25); … … 140 274 this.installPluginsButton.UseVisualStyleBackColor = true; 141 275 this.installPluginsButton.Click += new System.EventHandler(this.installPluginsButton_Click); 142 //143 // productsListView144 //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 // productNameHeader165 //166 this.productNameHeader.Text = "Name";167 //168 // productVersionHeader169 //170 this.productVersionHeader.Text = "Version";171 //172 // productLargeImageList173 //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 // productImageList179 //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 // productsGroupBox185 //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 // showDetailsButton202 //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 // showLargeIconsButton217 //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 // installProductsButton230 //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 // pluginsGroupBox245 //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 // splitContainer259 //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.Panel1267 //268 this.splitContainer.Panel1.Controls.Add(this.productsGroupBox);269 //270 // splitContainer.Panel2271 //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;276 276 // 277 277 // RemotePluginInstallerView -
trunk/sources/HeuristicLab.PluginInfrastructure/Advanced/RemotePluginInstaller.resx
r3608 r3612 121 121 <value>365, 17</value> 122 122 </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>126 123 <metadata name="productLargeImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 127 124 <value>29, 18</value> -
trunk/sources/HeuristicLab.PluginInfrastructure/HeuristicLab.PluginInfrastructure.csproj
r3608 r3612 171 171 <Compile Include="Advanced\PluginEditor.Designer.cs"> 172 172 <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>179 173 </Compile> 180 174 <Compile Include="Advanced\PluginView.cs"> … … 320 314 <EmbeddedResource Include="Advanced\PluginEditor.resx"> 321 315 <DependentUpon>PluginEditor.cs</DependentUpon> 322 </EmbeddedResource>323 <EmbeddedResource Include="Advanced\PluginListView.resx">324 <DependentUpon>PluginListView.cs</DependentUpon>325 316 </EmbeddedResource> 326 317 <EmbeddedResource Include="Advanced\PluginView.resx"> -
trunk/sources/HeuristicLab.PluginInfrastructure/Properties/Settings.Designer.cs
r3547 r3612 92 92 [global::System.Configuration.UserScopedSettingAttribute()] 93 93 [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 94 [global::System.Configuration.DefaultSettingValueAttribute(" False")]94 [global::System.Configuration.DefaultSettingValueAttribute("True")] 95 95 public bool ShowPluginUploadControls { 96 96 get { -
trunk/sources/HeuristicLab.PluginInfrastructure/Properties/Settings.settings
r3547 r3612 22 22 </Setting> 23 23 <Setting Name="ShowPluginUploadControls" Type="System.Boolean" Scope="User"> 24 <Value Profile="(Default)"> False</Value>24 <Value Profile="(Default)">True</Value> 25 25 </Setting> 26 26 </Settings> -
trunk/sources/HeuristicLab.PluginInfrastructure/app.config
r3547 r3612 99 99 </setting> 100 100 <setting name="ShowPluginUploadControls" serializeAs="String"> 101 <value> False</value>101 <value>True</value> 102 102 </setting> 103 103 </HeuristicLab.PluginInfrastructure.Properties.Settings> -
trunk/sources/HeuristicLab.Services.Deployment/3.3/Admin.cs
r3084 r3612 38 38 } 39 39 [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")] 40 45 public void DeployPlugin(PluginDescription plugin, byte[] zipFile) { 41 46 var store = new PluginStore(); -
trunk/sources/HeuristicLab.Services.Deployment/3.3/IAdmin.cs
r3084 r3612 35 35 36 36 [OperationContract] 37 void DeleteProduct(ProductDescription product); 38 39 [OperationContract] 37 40 void DeployPlugin(PluginDescription plugin, byte[] zipFile); 38 41 } -
trunk/sources/HeuristicLab.Services.Deployment/3.3/PluginStore.cs
r3217 r3612 111 111 } 112 112 } 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 117 138 private void InsertOrUpdateProduct(PluginStoreClassesDataContext ctx, ProductDescription product) { 118 139 var productEntity = (from p in ctx.Products … … 126 147 } 127 148 128 Delete OldPlugins(ctx, productEntity);149 DeleteProductPlugins(ctx, productEntity); 129 150 130 151 foreach (var plugin in product.Plugins) { … … 137 158 } 138 159 139 private void Delete OldPlugins(PluginStoreClassesDataContext ctx, Product productEntity) {160 private void DeleteProductPlugins(PluginStoreClassesDataContext ctx, Product productEntity) { 140 161 var oldPlugins = (from p in ctx.ProductPlugins 141 162 where p.ProductId == productEntity.Id … … 253 274 } 254 275 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 255 283 private IEnumerable<Plugin> GetDependencies(PluginStoreClassesDataContext ctx, Plugin plugin) { 256 284 return from pair in ctx.Dependencies
Note: See TracChangeset
for help on using the changeset viewer.