Changeset 2860 for branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient
- Timestamp:
- 02/24/10 14:34:07 (15 years ago)
- Location:
- branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient
- Files:
-
- 4 added
- 6 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/HeuristicLab.DeploymentService.AdminClient.csproj
r2816 r2860 74 74 </ItemGroup> 75 75 <ItemGroup> 76 <Compile Include=" ServerPluginView.cs">76 <Compile Include="PluginComparisonView.cs"> 77 77 <SubType>UserControl</SubType> 78 78 </Compile> 79 <Compile Include=" ServerPluginView.Designer.cs">80 <DependentUpon> ServerPluginView.cs</DependentUpon>79 <Compile Include="PluginComparisonView.Designer.cs"> 80 <DependentUpon>PluginComparisonView.cs</DependentUpon> 81 81 </Compile> 82 82 <Compile Include="PluginView.cs"> … … 91 91 <Compile Include="LicenseView.Designer.cs"> 92 92 <DependentUpon>LicenseView.cs</DependentUpon> 93 </Compile>94 <Compile Include="LocalPluginView.cs">95 <SubType>UserControl</SubType>96 </Compile>97 <Compile Include="LocalPluginView.Designer.cs">98 <DependentUpon>LocalPluginView.cs</DependentUpon>99 93 </Compile> 100 94 <Compile Include="ProductEditor.cs"> … … 121 115 </ItemGroup> 122 116 <ItemGroup> 117 <ProjectReference Include="..\HeuristicLab.Common.Resources\3.2\HeuristicLab.Common.Resources-3.2.csproj"> 118 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 119 <Name>HeuristicLab.Common.Resources-3.2</Name> 120 </ProjectReference> 123 121 <ProjectReference Include="..\HeuristicLab.MainForm.WindowsForms\3.2\HeuristicLab.MainForm.WindowsForms-3.2.csproj"> 124 122 <Project>{AB687BBE-1BFE-476B-906D-44237135431D}</Project> … … 140 138 </ItemGroup> 141 139 <ItemGroup> 142 <EmbeddedResource Include="ServerPluginView.resx"> 143 <DependentUpon>ServerPluginView.cs</DependentUpon> 140 <EmbeddedResource Include="MainForm.resx"> 141 <DependentUpon>MainForm.cs</DependentUpon> 142 </EmbeddedResource> 143 <EmbeddedResource Include="PluginComparisonView.resx"> 144 <DependentUpon>PluginComparisonView.cs</DependentUpon> 144 145 </EmbeddedResource> 145 146 <EmbeddedResource Include="PluginView.resx"> … … 148 149 <EmbeddedResource Include="LicenseView.resx"> 149 150 <DependentUpon>LicenseView.cs</DependentUpon> 150 </EmbeddedResource>151 <EmbeddedResource Include="LocalPluginView.resx">152 <DependentUpon>LocalPluginView.cs</DependentUpon>153 151 </EmbeddedResource> 154 152 <EmbeddedResource Include="ProductEditor.resx"> -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/MainForm.cs
r2802 r2860 7 7 namespace HeuristicLab.DeploymentService.AdminClient { 8 8 class MainForm : DockingMainForm { 9 public MainForm(Type type) : base(type) { } 9 private System.Windows.Forms.ProgressBar progressBar; 10 11 public MainForm(Type type) 12 : base(type) { 13 InitializeComponent(); 14 } 10 15 11 16 protected override void OnInitialized(EventArgs e) { … … 13 18 (new PluginListView()).Show(); 14 19 } 20 21 private void InitializeComponent() { 22 this.progressBar = new System.Windows.Forms.ProgressBar(); 23 this.SuspendLayout(); 24 // 25 // progressBar 26 // 27 this.progressBar.Location = new System.Drawing.Point(0, 528); 28 this.progressBar.Name = "progressBar"; 29 this.progressBar.Size = new System.Drawing.Size(129, 23); 30 this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Marquee; 31 this.progressBar.TabIndex = 7; 32 this.progressBar.Visible = false; 33 // 34 // MainForm 35 // 36 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 37 this.ClientSize = new System.Drawing.Size(770, 550); 38 this.Controls.Add(this.progressBar); 39 this.Name = "MainForm"; 40 this.Controls.SetChildIndex(this.progressBar, 0); 41 this.ResumeLayout(false); 42 this.PerformLayout(); 43 44 } 45 46 public void ShowProgressBar() { 47 progressBar.Visible = true; 48 } 49 50 public void HideProgressBar() { 51 progressBar.Visible = false; 52 } 15 53 } 16 54 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.Designer.cs
r2816 r2860 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 26 27 this.listView = new System.Windows.Forms.ListView(); 27 28 this.nameHeader = new System.Windows.Forms.ColumnHeader(); 28 29 this.localVersion = new System.Windows.Forms.ColumnHeader(); 29 this. uploadButton = new System.Windows.Forms.Button();30 this. splitContainer = new System.Windows.Forms.SplitContainer();31 this. label1= new System.Windows.Forms.Label();30 this.serverVersion = new System.Windows.Forms.ColumnHeader(); 31 this.imageList = new System.Windows.Forms.ImageList(this.components); 32 this.serverUrlLabel = new System.Windows.Forms.Label(); 32 33 this.serverUrlTextBox = new System.Windows.Forms.TextBox(); 33 34 this.connectButton = new System.Windows.Forms.Button(); 34 this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel(); 35 this.serverPluginDetailsGroupBox = new System.Windows.Forms.GroupBox(); 36 this.localPluginDetailsGroupBox = new System.Windows.Forms.GroupBox(); 37 this.localPluginDetailsPanel = new System.Windows.Forms.Panel(); 38 this.serverVersion = new System.Windows.Forms.ColumnHeader(); 39 this.splitContainer.Panel1.SuspendLayout(); 40 this.splitContainer.Panel2.SuspendLayout(); 41 this.splitContainer.SuspendLayout(); 42 this.tableLayoutPanel.SuspendLayout(); 43 this.localPluginDetailsGroupBox.SuspendLayout(); 35 this.refreshButton = new System.Windows.Forms.Button(); 36 this.uploadButton = new System.Windows.Forms.Button(); 44 37 this.SuspendLayout(); 45 38 // 46 39 // listView 47 40 // 41 this.listView.Activation = System.Windows.Forms.ItemActivation.TwoClick; 48 42 this.listView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 49 43 | System.Windows.Forms.AnchorStyles.Left) 50 44 | System.Windows.Forms.AnchorStyles.Right))); 45 this.listView.CheckBoxes = true; 51 46 this.listView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 52 47 this.nameHeader, … … 54 49 this.serverVersion}); 55 50 this.listView.Enabled = false; 56 this.listView.Location = new System.Drawing.Point(3, 32); 57 this.listView.MultiSelect = false; 51 this.listView.FullRowSelect = true; 52 this.listView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; 53 this.listView.Location = new System.Drawing.Point(0, 30); 58 54 this.listView.Name = "listView"; 59 55 this.listView.ShowGroups = false; 60 this.listView.Size = new System.Drawing.Size(392, 459); 56 this.listView.Size = new System.Drawing.Size(536, 446); 57 this.listView.StateImageList = this.imageList; 61 58 this.listView.TabIndex = 0; 62 59 this.listView.UseCompatibleStateImageBehavior = false; 63 60 this.listView.View = System.Windows.Forms.View.Details; 64 this.listView.SelectedIndexChanged += new System.EventHandler(this.listView_SelectedIndexChanged); 61 this.listView.ItemActivate += new System.EventHandler(this.listView_ItemActivate); 62 this.listView.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView_ItemChecked); 65 63 // 66 64 // nameHeader … … 74 72 this.localVersion.Width = 100; 75 73 // 76 // uploadButton74 // serverVersion 77 75 // 78 this.uploadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 79 this.uploadButton.Enabled = false; 80 this.uploadButton.Location = new System.Drawing.Point(6, 459); 81 this.uploadButton.Name = "uploadButton"; 82 this.uploadButton.Size = new System.Drawing.Size(110, 23); 83 this.uploadButton.TabIndex = 2; 84 this.uploadButton.Text = "Upload plugin"; 85 this.uploadButton.UseVisualStyleBackColor = true; 86 this.uploadButton.Click += new System.EventHandler(this.uploadButton_Click); 76 this.serverVersion.Text = "Server version"; 77 this.serverVersion.Width = 100; 87 78 // 88 // splitContainer79 // imageList 89 80 // 90 this. splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;91 this. splitContainer.Location = new System.Drawing.Point(0, 0);92 this. splitContainer.Name = "splitContainer";81 this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 82 this.imageList.ImageSize = new System.Drawing.Size(16, 16); 83 this.imageList.TransparentColor = System.Drawing.Color.Transparent; 93 84 // 94 // s plitContainer.Panel185 // serverUrlLabel 95 86 // 96 this.splitContainer.Panel1.Controls.Add(this.label1); 97 this.splitContainer.Panel1.Controls.Add(this.serverUrlTextBox); 98 this.splitContainer.Panel1.Controls.Add(this.connectButton); 99 this.splitContainer.Panel1.Controls.Add(this.listView); 100 // 101 // splitContainer.Panel2 102 // 103 this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel); 104 this.splitContainer.Size = new System.Drawing.Size(852, 494); 105 this.splitContainer.SplitterDistance = 398; 106 this.splitContainer.TabIndex = 3; 107 // 108 // label1 109 // 110 this.label1.AutoSize = true; 111 this.label1.Location = new System.Drawing.Point(3, 8); 112 this.label1.Name = "label1"; 113 this.label1.Size = new System.Drawing.Size(98, 13); 114 this.label1.TabIndex = 5; 115 this.label1.Text = "Deployment server:"; 87 this.serverUrlLabel.AutoSize = true; 88 this.serverUrlLabel.Location = new System.Drawing.Point(3, 6); 89 this.serverUrlLabel.Name = "serverUrlLabel"; 90 this.serverUrlLabel.Size = new System.Drawing.Size(98, 13); 91 this.serverUrlLabel.TabIndex = 5; 92 this.serverUrlLabel.Text = "Deployment server:"; 116 93 // 117 94 // serverUrlTextBox 118 95 // 119 this.serverUrlTextBox.Location = new System.Drawing.Point(107, 5);96 this.serverUrlTextBox.Location = new System.Drawing.Point(107, 3); 120 97 this.serverUrlTextBox.Name = "serverUrlTextBox"; 121 this.serverUrlTextBox.Size = new System.Drawing.Size( 107, 20);98 this.serverUrlTextBox.Size = new System.Drawing.Size(246, 20); 122 99 this.serverUrlTextBox.TabIndex = 4; 123 100 // 124 101 // connectButton 125 102 // 126 this.connectButton.Location = new System.Drawing.Point( 220, 3);103 this.connectButton.Location = new System.Drawing.Point(359, 1); 127 104 this.connectButton.Name = "connectButton"; 128 105 this.connectButton.Size = new System.Drawing.Size(75, 23); … … 132 109 this.connectButton.Click += new System.EventHandler(this.connectButton_Click); 133 110 // 134 // tableLayoutPanel111 // refreshButton 135 112 // 136 this.tableLayoutPanel.ColumnCount = 2; 137 this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 138 this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); 139 this.tableLayoutPanel.Controls.Add(this.serverPluginDetailsGroupBox, 1, 0); 140 this.tableLayoutPanel.Controls.Add(this.localPluginDetailsGroupBox, 0, 0); 141 this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill; 142 this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0); 143 this.tableLayoutPanel.Name = "tableLayoutPanel"; 144 this.tableLayoutPanel.RowCount = 1; 145 this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); 146 this.tableLayoutPanel.Size = new System.Drawing.Size(450, 494); 147 this.tableLayoutPanel.TabIndex = 3; 113 this.refreshButton.Location = new System.Drawing.Point(440, 1); 114 this.refreshButton.Name = "refreshButton"; 115 this.refreshButton.Size = new System.Drawing.Size(75, 23); 116 this.refreshButton.TabIndex = 6; 117 this.refreshButton.Text = "Refresh"; 118 this.refreshButton.UseVisualStyleBackColor = true; 119 this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); 148 120 // 149 // serverPluginDetailsGroupBox121 // uploadButton 150 122 // 151 this.serverPluginDetailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 152 this.serverPluginDetailsGroupBox.Location = new System.Drawing.Point(228, 3); 153 this.serverPluginDetailsGroupBox.Name = "serverPluginDetailsGroupBox"; 154 this.serverPluginDetailsGroupBox.Size = new System.Drawing.Size(219, 488); 155 this.serverPluginDetailsGroupBox.TabIndex = 3; 156 this.serverPluginDetailsGroupBox.TabStop = false; 157 this.serverPluginDetailsGroupBox.Text = "Server plugin information"; 158 // 159 // localPluginDetailsGroupBox 160 // 161 this.localPluginDetailsGroupBox.Controls.Add(this.localPluginDetailsPanel); 162 this.localPluginDetailsGroupBox.Controls.Add(this.uploadButton); 163 this.localPluginDetailsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; 164 this.localPluginDetailsGroupBox.Location = new System.Drawing.Point(3, 3); 165 this.localPluginDetailsGroupBox.Name = "localPluginDetailsGroupBox"; 166 this.localPluginDetailsGroupBox.Size = new System.Drawing.Size(219, 488); 167 this.localPluginDetailsGroupBox.TabIndex = 4; 168 this.localPluginDetailsGroupBox.TabStop = false; 169 this.localPluginDetailsGroupBox.Text = "Local plugin information"; 170 // 171 // localPluginDetailsPanel 172 // 173 this.localPluginDetailsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 174 | System.Windows.Forms.AnchorStyles.Left) 175 | System.Windows.Forms.AnchorStyles.Right))); 176 this.localPluginDetailsPanel.Location = new System.Drawing.Point(6, 19); 177 this.localPluginDetailsPanel.Name = "localPluginDetailsPanel"; 178 this.localPluginDetailsPanel.Size = new System.Drawing.Size(207, 434); 179 this.localPluginDetailsPanel.TabIndex = 3; 180 // 181 // serverVersion 182 // 183 this.serverVersion.Text = "Server version"; 184 this.serverVersion.Width = 100; 123 this.uploadButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 124 this.uploadButton.Location = new System.Drawing.Point(3, 482); 125 this.uploadButton.Name = "uploadButton"; 126 this.uploadButton.Size = new System.Drawing.Size(75, 23); 127 this.uploadButton.TabIndex = 7; 128 this.uploadButton.Text = "Upload"; 129 this.uploadButton.UseVisualStyleBackColor = true; 130 this.uploadButton.Click += new System.EventHandler(this.uploadButton_Click); 185 131 // 186 132 // PluginListView … … 188 134 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 189 135 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 190 this.Controls.Add(this.splitContainer); 136 this.Controls.Add(this.uploadButton); 137 this.Controls.Add(this.refreshButton); 138 this.Controls.Add(this.connectButton); 139 this.Controls.Add(this.serverUrlTextBox); 140 this.Controls.Add(this.serverUrlLabel); 141 this.Controls.Add(this.listView); 191 142 this.Name = "PluginListView"; 192 this.Size = new System.Drawing.Size(852, 494); 193 this.splitContainer.Panel1.ResumeLayout(false); 194 this.splitContainer.Panel1.PerformLayout(); 195 this.splitContainer.Panel2.ResumeLayout(false); 196 this.splitContainer.ResumeLayout(false); 197 this.tableLayoutPanel.ResumeLayout(false); 198 this.localPluginDetailsGroupBox.ResumeLayout(false); 143 this.Size = new System.Drawing.Size(539, 508); 199 144 this.ResumeLayout(false); 145 this.PerformLayout(); 200 146 201 147 } … … 206 152 private System.Windows.Forms.ColumnHeader nameHeader; 207 153 private System.Windows.Forms.ColumnHeader localVersion; 154 private System.Windows.Forms.Button connectButton; 155 private System.Windows.Forms.Label serverUrlLabel; 156 private System.Windows.Forms.TextBox serverUrlTextBox; 157 private System.Windows.Forms.ColumnHeader serverVersion; 158 private System.Windows.Forms.Button refreshButton; 208 159 private System.Windows.Forms.Button uploadButton; 209 private System.Windows.Forms.SplitContainer splitContainer; 210 private System.Windows.Forms.Button connectButton; 211 private System.Windows.Forms.Label label1; 212 private System.Windows.Forms.TextBox serverUrlTextBox; 213 private System.Windows.Forms.TableLayoutPanel tableLayoutPanel; 214 private System.Windows.Forms.GroupBox serverPluginDetailsGroupBox; 215 private System.Windows.Forms.GroupBox localPluginDetailsGroupBox; 216 private System.Windows.Forms.Panel localPluginDetailsPanel; 217 private System.Windows.Forms.ColumnHeader serverVersion; 160 private System.Windows.Forms.ImageList imageList; 218 161 } 219 162 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.cs
r2816 r2860 23 23 public PluginListView() { 24 24 InitializeComponent(); 25 imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.Assembly); 26 imageList.Images.Add(HeuristicLab.Common.Resources.VS2008ImageLibrary.ArrowUp); 25 27 Caption = "Plugins"; 26 28 … … 31 33 localAndServerPlugins = new Dictionary<IPluginDescription, PluginDeploymentService.PluginDescription>(); 32 34 35 #region initialize backgroundworkers 33 36 pluginUploadWorker = new BackgroundWorker(); 34 37 pluginUploadWorker.DoWork += new DoWorkEventHandler(pluginUploadWorker_DoWork); … … 38 41 updateServerPluginsWorker.DoWork += new DoWorkEventHandler(updateServerPluginsWorker_DoWork); 39 42 updateServerPluginsWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(updateServerPluginsWorker_RunWorkerCompleted); 40 } 41 43 #endregion 44 } 45 46 #region refresh plugins from server backgroundworker 42 47 void updateServerPluginsWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 43 48 if (!e.Cancelled && e.Result != null) { 44 UpdateLocalPlugins(); 49 // refresh local plugins 50 localAndServerPlugins.Clear(); 51 foreach (var plugin in ApplicationManager.Manager.Plugins) { 52 localAndServerPlugins.Add(plugin, null); 53 } 54 // refresh server plugins (find matching local plugins) 45 55 var plugins = (PluginDeploymentService.PluginDescription[])e.Result; 46 56 foreach (var plugin in plugins) { … … 53 63 } 54 64 } 55 UpdatePluginList(); 56 OnConnected(); 57 } else { 58 OnDisconnected(); 59 } 65 // refresh the list view with plugins 66 listView.Items.Clear(); 67 foreach (var pair in localAndServerPlugins) { 68 var item = MakeListViewItem(pair.Key); 69 listView.Items.Add(item); 70 } 71 UpdateControlsConnectedState(); 72 } else { 73 UpdateControlsDisconnectedState(); 74 } 75 // make sure cursor is set correctly 60 76 Cursor = Cursors.Default; 61 }62 63 private void UpdatePluginList() {64 listView.Items.Clear();65 foreach (var pair in localAndServerPlugins) {66 var item = MakeListViewItem(pair.Key);67 listView.Items.Add(item);68 }69 77 } 70 78 … … 76 84 } 77 85 } 78 catch (EndpointNotFoundException ex) {86 catch (EndpointNotFoundException) { 79 87 e.Result = null; 80 88 e.Cancel = true; 81 89 } 82 catch (FaultException ex) {90 catch (FaultException) { 83 91 e.Result = null; 84 92 e.Cancel = true; 85 93 } 86 94 } 87 95 #endregion 96 97 #region upload plugins to server backgroundworker 88 98 void pluginUploadWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 89 this.Enabled = true; 99 Cursor = Cursors.Default; 100 if (e.Cancelled) { 101 UpdateControlsDisconnectedState(); 102 } else { 103 UpdateControlsConnectedState(); 104 // start another async call to refresh plugin information from server 105 RefreshPluginsAsync(); 106 } 90 107 } 91 108 92 109 void pluginUploadWorker_DoWork(object sender, DoWorkEventArgs e) { 93 var selectedPlugins = (IEnumerable<IPluginDescription>)e.Argument; 94 using (PluginDeploymentService.AdminClient adminClient = new PluginDeploymentService.AdminClient()) { 95 96 foreach (var plugin in IteratePlugins(selectedPlugins)) { 97 adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin)); 98 } 99 } 100 } 101 110 try { 111 var selectedPlugins = (IEnumerable<IPluginDescription>)e.Argument; 112 using (PluginDeploymentService.AdminClient adminClient = new PluginDeploymentService.AdminClient()) { 113 114 foreach (var plugin in IteratePlugins(selectedPlugins)) { 115 adminClient.DeployPlugin(MakePluginDescription(plugin), CreateZipPackage(plugin)); 116 } 117 } 118 e.Cancel = false; 119 } 120 catch (EndpointNotFoundException) { 121 e.Cancel = true; 122 } 123 catch (FaultException) { 124 e.Cancel = true; 125 } 126 } 127 #endregion 128 129 130 #region button events 131 private void uploadButton_Click(object sender, EventArgs e) { 132 var selectedPlugins = from item in listView.Items.Cast<ListViewItem>() 133 where item.Checked 134 where item.Tag is IPluginDescription 135 select item.Tag as IPluginDescription; 136 if (selectedPlugins.Count() > 0) { 137 Cursor = Cursors.AppStarting; 138 DisableControl(); 139 pluginUploadWorker.RunWorkerAsync(selectedPlugins.ToList()); 140 } 141 } 142 143 private void connectButton_Click(object sender, EventArgs e) { 144 if (connectButton.Text == "Connect") { 145 DisableControl(); 146 RefreshPluginsAsync(); 147 } else { 148 UpdateControlsDisconnectedState(); 149 } 150 } 151 152 private void refreshButton_Click(object sender, EventArgs e) { 153 DisableControl(); 154 RefreshPluginsAsync(); 155 } 156 157 #endregion 158 159 #region item list events 160 private void listView_ItemActivate(object sender, EventArgs e) { 161 foreach (var item in listView.SelectedItems) { 162 var plugin = (IPluginDescription)((ListViewItem)item).Tag; 163 var compView = new PluginComparisonView(plugin, localAndServerPlugins[plugin]); 164 compView.Show(); 165 } 166 } 167 168 private void listView_ItemChecked(object sender, ItemCheckedEventArgs e) { 169 // also check all dependencies 170 if (e.Item.Checked) { 171 uploadButton.Enabled = true; 172 var plugin = (IPluginDescription)e.Item.Tag; 173 foreach (var dep in plugin.Dependencies) { 174 var depItem = FindItemForPlugin(dep); 175 if (!depItem.Checked) depItem.Checked = true; 176 } 177 } else { 178 uploadButton.Enabled = (from i in listView.Items.Cast<ListViewItem>() 179 where i.Checked 180 select i).Any(); 181 // also uncheck all dependent plugins 182 var plugin = (IPluginDescription)e.Item.Tag; 183 foreach (ListViewItem item in listView.Items) { 184 var dep = (IPluginDescription)item.Tag; 185 if (dep.Dependencies.Contains(plugin) && item.Checked) { 186 item.Checked = false; 187 } 188 } 189 } 190 } 191 #endregion 192 193 #region helper methods 102 194 private byte[] CreateZipPackage(IPluginDescription plugin) { 103 195 using (MemoryStream stream = new MemoryStream()) { … … 113 205 } 114 206 207 private ListViewItem MakeListViewItem(IPluginDescription plugin) { 208 ListViewItem item; 209 if (localAndServerPlugins[plugin] != null) { 210 item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), localAndServerPlugins[plugin].Version.ToString() }); 211 } else { 212 item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), string.Empty }); 213 } 214 item.Tag = plugin; 215 item.Checked = false; 216 return item; 217 } 218 219 private ListViewItem FindItemForPlugin(IPluginDescription dep) { 220 return (from i in listView.Items.Cast<ListViewItem>() 221 where i.Tag == dep 222 select i).Single(); 223 } 224 115 225 private PluginDeploymentService.PluginDescription MakePluginDescription(IPluginDescription plugin) { 116 226 var dependencies = from dep in plugin.Dependencies … … 118 228 if (string.IsNullOrEmpty(plugin.ContactName) || string.IsNullOrEmpty(plugin.ContactEmail)) { 119 229 return new PluginDeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies); 120 } else return new PluginDeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName + ", " +plugin.ContactEmail, plugin.LicenseText);230 } else return new PluginDeploymentService.PluginDescription(plugin.Name, plugin.Version, dependencies, plugin.ContactName, plugin.ContactEmail, plugin.LicenseText); 121 231 } 122 232 … … 130 240 } 131 241 132 public void UpdateLocalPlugins() { 133 localAndServerPlugins.Clear(); 134 135 foreach (var plugin in ApplicationManager.Manager.Plugins) { 136 localAndServerPlugins.Add(plugin, null); 137 } 138 } 139 140 141 private ListViewItem MakeListViewItem(IPluginDescription plugin) { 142 ListViewItem item; 143 if (localAndServerPlugins[plugin] != null) { 144 item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), localAndServerPlugins[plugin].Version.ToString() }); 145 } else { 146 item = new ListViewItem(new string[] { plugin.Name, plugin.Version.ToString(), string.Empty }); 147 } 148 item.Tag = plugin; 149 return item; 150 } 151 152 private void listView_SelectedIndexChanged(object sender, EventArgs e) { 153 localPluginDetailsPanel.Controls.Clear(); 154 serverPluginDetailsGroupBox.Controls.Clear(); 155 156 if (listView.SelectedItems.Count > 0) { 157 var plugin = (IPluginDescription)listView.SelectedItems[0].Tag; 158 ShowPluginDetails(plugin); 159 } 160 } 161 162 private void ShowPluginDetails(IPluginDescription plugin) { 163 var localView = new LocalPluginView(plugin); 164 var serverView = new ServerPluginView(localAndServerPlugins[plugin]); 165 localView.Dock = DockStyle.Fill; 166 serverView.Dock = DockStyle.Fill; 167 localPluginDetailsPanel.Controls.Add(localView); 168 serverPluginDetailsGroupBox.Controls.Add(serverView); 169 } 170 171 private void uploadButton_Click(object sender, EventArgs e) { 172 if (listView.SelectedItems.Count > 0) { 173 var selectedPlugins = from item in listView.SelectedItems.Cast<ListViewItem>() 174 where item.Tag is IPluginDescription 175 select item.Tag as IPluginDescription; 176 this.Enabled = false; 177 pluginUploadWorker.RunWorkerAsync(selectedPlugins.ToList()); 178 } 179 } 180 181 private void connectButton_Click(object sender, EventArgs e) { 182 OnDisconnected(); 242 // start background process to refresh the plugin list (local and server) 243 private void RefreshPluginsAsync() { 183 244 Cursor = Cursors.AppStarting; 245 DisableControl(); 184 246 updateServerPluginsWorker.RunWorkerAsync(); 185 247 } 186 248 187 private void OnConnected() { 188 connectButton.Enabled = false; 189 serverUrlTextBox.Enabled = false; 190 label1.Enabled = false; 191 192 listView.Enabled = true; 193 uploadButton.Enabled = true; 194 } 195 196 private void OnDisconnected() { 197 connectButton.Enabled = true; 249 // is called by all methods that start a background process 250 // controls must be enabled manuall again when the backgroundworker finishes 251 private void DisableControl() { 252 MainFormManager.GetMainForm<MainForm>().ShowProgressBar(); 253 foreach (Control ctrl in Controls) 254 ctrl.Enabled = false; 255 } 256 257 private void UpdateControlsDisconnectedState() { 258 connectButton.Text = "Connect"; 198 259 serverUrlTextBox.Enabled = true; 199 label1.Enabled = true; 260 serverUrlLabel.Enabled = true; 261 refreshButton.Enabled = false; 200 262 201 263 localAndServerPlugins.Clear(); 202 264 listView.Items.Clear(); 203 localPluginDetailsPanel.Controls.Clear();204 serverPluginDetailsGroupBox.Controls.Clear();205 265 listView.Enabled = false; 206 266 uploadButton.Enabled = false; 207 } 267 MainFormManager.GetMainForm<MainForm>().HideProgressBar(); 268 } 269 270 private void UpdateControlsConnectedState() { 271 connectButton.Text = "Disconnect"; 272 connectButton.Enabled = true; 273 serverUrlTextBox.Enabled = false; 274 serverUrlLabel.Enabled = false; 275 refreshButton.Enabled = true; 276 listView.Enabled = true; 277 uploadButton.Enabled = false; 278 MainFormManager.GetMainForm<MainForm>().HideProgressBar(); 279 } 280 281 282 #endregion 208 283 } 209 284 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginListView.resx
r2802 r2860 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 120 123 </root> -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginView.Designer.cs
r2816 r2860 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 26 27 this.nameLabel = new System.Windows.Forms.Label(); 27 28 this.nameTextBox = new System.Windows.Forms.TextBox(); … … 33 34 this.dependenciesGroupBox = new System.Windows.Forms.GroupBox(); 34 35 this.dependenciesListView = new System.Windows.Forms.ListView(); 35 this.nameHeader = new System.Windows.Forms.ColumnHeader(); 36 this.versionHeader = new System.Windows.Forms.ColumnHeader(); 36 this.pluginNameHeader = new System.Windows.Forms.ColumnHeader(); 37 this.pluginVersionHeader = new System.Windows.Forms.ColumnHeader(); 38 this.imageList = new System.Windows.Forms.ImageList(this.components); 39 this.filesListView = new System.Windows.Forms.ListView(); 40 this.fileNameHeader = new System.Windows.Forms.ColumnHeader(); 41 this.fileTypeHeader = new System.Windows.Forms.ColumnHeader(); 42 this.filesGroupBox = new System.Windows.Forms.GroupBox(); 37 43 this.dependenciesGroupBox.SuspendLayout(); 44 this.filesGroupBox.SuspendLayout(); 38 45 this.SuspendLayout(); 39 46 // … … 54 61 this.nameTextBox.Name = "nameTextBox"; 55 62 this.nameTextBox.ReadOnly = true; 56 this.nameTextBox.Size = new System.Drawing.Size( 191, 20);63 this.nameTextBox.Size = new System.Drawing.Size(267, 20); 57 64 this.nameTextBox.TabIndex = 1; 58 65 // … … 64 71 this.versionTextBox.Name = "versionTextBox"; 65 72 this.versionTextBox.ReadOnly = true; 66 this.versionTextBox.Size = new System.Drawing.Size( 191, 20);73 this.versionTextBox.Size = new System.Drawing.Size(267, 20); 67 74 this.versionTextBox.TabIndex = 3; 68 75 // … … 83 90 this.contactTextBox.Name = "contactTextBox"; 84 91 this.contactTextBox.ReadOnly = true; 85 this.contactTextBox.Size = new System.Drawing.Size( 191, 20);92 this.contactTextBox.Size = new System.Drawing.Size(267, 20); 86 93 this.contactTextBox.TabIndex = 5; 87 94 // … … 98 105 // 99 106 this.licenseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 100 this.licenseButton.Location = new System.Drawing.Point(3, 397);107 this.licenseButton.Location = new System.Drawing.Point(3, 486); 101 108 this.licenseButton.Name = "licenseButton"; 102 109 this.licenseButton.Size = new System.Drawing.Size(103, 23); … … 104 111 this.licenseButton.Text = "Show license"; 105 112 this.licenseButton.UseVisualStyleBackColor = true; 113 this.licenseButton.Click += new System.EventHandler(this.licenseButton_Click); 106 114 // 107 115 // dependenciesGroupBox … … 111 119 | System.Windows.Forms.AnchorStyles.Right))); 112 120 this.dependenciesGroupBox.Controls.Add(this.dependenciesListView); 113 this.dependenciesGroupBox.Location = new System.Drawing.Point(3, 81);121 this.dependenciesGroupBox.Location = new System.Drawing.Point(3, 255); 114 122 this.dependenciesGroupBox.Name = "dependenciesGroupBox"; 115 this.dependenciesGroupBox.Size = new System.Drawing.Size( 262, 310);123 this.dependenciesGroupBox.Size = new System.Drawing.Size(338, 225); 116 124 this.dependenciesGroupBox.TabIndex = 1; 117 125 this.dependenciesGroupBox.TabStop = false; … … 121 129 // 122 130 this.dependenciesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 123 this. nameHeader,124 this. versionHeader});131 this.pluginNameHeader, 132 this.pluginVersionHeader}); 125 133 this.dependenciesListView.Dock = System.Windows.Forms.DockStyle.Fill; 126 134 this.dependenciesListView.Location = new System.Drawing.Point(3, 16); 127 135 this.dependenciesListView.Name = "dependenciesListView"; 128 this.dependenciesListView.Size = new System.Drawing.Size(256, 291); 136 this.dependenciesListView.Size = new System.Drawing.Size(332, 206); 137 this.dependenciesListView.SmallImageList = this.imageList; 129 138 this.dependenciesListView.TabIndex = 0; 130 139 this.dependenciesListView.UseCompatibleStateImageBehavior = false; 131 140 this.dependenciesListView.View = System.Windows.Forms.View.Details; 132 141 // 133 // nameHeader 134 // 135 this.nameHeader.Text = "Name"; 136 this.nameHeader.Width = 180; 137 // 138 // versionHeader 139 // 140 this.versionHeader.Text = "Version"; 141 this.versionHeader.Width = 100; 142 // pluginNameHeader 143 // 144 this.pluginNameHeader.Text = "Name"; 145 this.pluginNameHeader.Width = 200; 146 // 147 // pluginVersionHeader 148 // 149 this.pluginVersionHeader.Text = "Version"; 150 this.pluginVersionHeader.Width = 120; 151 // 152 // imageList 153 // 154 this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; 155 this.imageList.ImageSize = new System.Drawing.Size(16, 16); 156 this.imageList.TransparentColor = System.Drawing.Color.Transparent; 157 // 158 // filesListView 159 // 160 this.filesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { 161 this.fileNameHeader, 162 this.fileTypeHeader}); 163 this.filesListView.Dock = System.Windows.Forms.DockStyle.Fill; 164 this.filesListView.Location = new System.Drawing.Point(3, 16); 165 this.filesListView.Name = "filesListView"; 166 this.filesListView.Size = new System.Drawing.Size(329, 149); 167 this.filesListView.SmallImageList = this.imageList; 168 this.filesListView.TabIndex = 0; 169 this.filesListView.UseCompatibleStateImageBehavior = false; 170 this.filesListView.View = System.Windows.Forms.View.Details; 171 // 172 // fileNameHeader 173 // 174 this.fileNameHeader.Text = "Name"; 175 this.fileNameHeader.Width = 200; 176 // 177 // fileTypeHeader 178 // 179 this.fileTypeHeader.Text = "Type"; 180 this.fileTypeHeader.Width = 120; 181 // 182 // filesGroupBox 183 // 184 this.filesGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 185 | System.Windows.Forms.AnchorStyles.Right))); 186 this.filesGroupBox.Controls.Add(this.filesListView); 187 this.filesGroupBox.Location = new System.Drawing.Point(3, 81); 188 this.filesGroupBox.Name = "filesGroupBox"; 189 this.filesGroupBox.Size = new System.Drawing.Size(335, 168); 190 this.filesGroupBox.TabIndex = 11; 191 this.filesGroupBox.TabStop = false; 192 this.filesGroupBox.Text = "Files"; 142 193 // 143 194 // PluginView … … 146 197 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 147 198 this.Controls.Add(this.dependenciesGroupBox); 199 this.Controls.Add(this.filesGroupBox); 148 200 this.Controls.Add(this.licenseButton); 149 201 this.Controls.Add(this.contactTextBox); … … 154 206 this.Controls.Add(this.nameLabel); 155 207 this.Name = "PluginView"; 156 this.Size = new System.Drawing.Size( 268, 423);208 this.Size = new System.Drawing.Size(344, 512); 157 209 this.dependenciesGroupBox.ResumeLayout(false); 210 this.filesGroupBox.ResumeLayout(false); 158 211 this.ResumeLayout(false); 159 212 this.PerformLayout(); … … 171 224 protected System.Windows.Forms.Button licenseButton; 172 225 protected System.Windows.Forms.GroupBox dependenciesGroupBox; 173 private System.Windows.Forms.ColumnHeader nameHeader;174 private System.Windows.Forms.ColumnHeader versionHeader;226 private System.Windows.Forms.ColumnHeader pluginNameHeader; 227 private System.Windows.Forms.ColumnHeader pluginVersionHeader; 175 228 protected System.Windows.Forms.ListView dependenciesListView; 229 private System.Windows.Forms.ListView filesListView; 230 private System.Windows.Forms.GroupBox filesGroupBox; 231 private System.Windows.Forms.ImageList imageList; 232 private System.Windows.Forms.ColumnHeader fileNameHeader; 233 private System.Windows.Forms.ColumnHeader fileTypeHeader; 176 234 177 235 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginView.cs
r2816 r2860 8 8 using System.Windows.Forms; 9 9 using HeuristicLab.PluginInfrastructure; 10 using System.IO; 10 11 11 12 namespace HeuristicLab.DeploymentService.AdminClient { 12 13 public partial class PluginView : UserControl { 14 private const string IMAGE_KEY_ASSEMBLY = "Assembly"; 15 private const string IMAGE_KEY_FILE = "File"; 16 private const string IMAGE_KEY_DOCUMENT = "Document"; 17 18 private IPluginDescription plugin; 19 13 20 public PluginView() { 14 21 InitializeComponent(); 22 PopulateImageList(); 23 } 24 25 public PluginView(IPluginDescription plugin) { 26 InitializeComponent(); 27 PopulateImageList(); 28 29 this.plugin = plugin; 30 UpdateControls(); 31 } 32 33 private void PopulateImageList() { 34 imageList.Images.Add(IMAGE_KEY_ASSEMBLY, HeuristicLab.Common.Resources.VS2008ImageLibrary.Assembly); 35 imageList.Images.Add(IMAGE_KEY_FILE, HeuristicLab.Common.Resources.VS2008ImageLibrary.File); 36 imageList.Images.Add(IMAGE_KEY_DOCUMENT, HeuristicLab.Common.Resources.VS2008ImageLibrary.Document); 37 } 38 39 public void UpdateControls() { 40 string appDir = Path.GetDirectoryName(Application.ExecutablePath); 41 nameTextBox.Text = plugin.Name; 42 versionTextBox.Text = plugin.Version.ToString(); 43 contactTextBox.Text = CombineStrings(plugin.ContactName, plugin.ContactEmail); 44 foreach (IPluginDescription dependency in plugin.Dependencies) { 45 var depItem = new ListViewItem(new string[] { dependency.Name, dependency.Version.ToString() }); 46 depItem.ImageKey = IMAGE_KEY_ASSEMBLY; 47 dependenciesListView.Items.Add(depItem); 48 } 49 foreach (var file in plugin.Files) { 50 string displayedFileName = file.Name.Replace(appDir, string.Empty); 51 displayedFileName = displayedFileName.TrimStart(Path.DirectorySeparatorChar); 52 var fileItem = new ListViewItem(new string[] { displayedFileName, file.Type.ToString() }); 53 if (file.Type == PluginFileType.Assembly) { 54 fileItem.ImageKey = IMAGE_KEY_ASSEMBLY; 55 } else if (file.Type == PluginFileType.License) { 56 fileItem.ImageKey = IMAGE_KEY_DOCUMENT; 57 } else fileItem.ImageKey = IMAGE_KEY_FILE; 58 filesListView.Items.Add(fileItem); 59 } 60 licenseButton.Enabled = !string.IsNullOrEmpty(plugin.LicenseText); 61 } 62 63 private string CombineStrings(string a, string b) { 64 if (string.IsNullOrEmpty(a)) 65 // a is empty 66 if (!string.IsNullOrEmpty(b)) return CombineStrings(b, string.Empty); 67 else return string.Empty; 68 // a is not empty 69 else if (string.IsNullOrEmpty(b)) return a; 70 // and b are not empty 71 else return a + ", " + b; 72 } 73 74 private void licenseButton_Click(object sender, EventArgs e) { 75 LicenseView view = new LicenseView(plugin.Name, plugin.Version.ToString(), plugin.LicenseText); 76 view.Show(); 15 77 } 16 78 } -
branches/DeploymentServer Prototype/HeuristicLab.Services/HeuristicLab.DeploymentService.AdminClient/PluginView.resx
r2816 r2860 118 118 <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> 119 119 </resheader> 120 <metadata name="imageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 121 <value>17, 17</value> 122 </metadata> 120 123 </root>
Note: See TracChangeset
for help on using the changeset viewer.