Changeset 2518
- Timestamp:
- 11/23/09 10:25:17 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Grid/3.2
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/sources/HeuristicLab.Grid/3.2/ClientForm.cs ¶
r1529 r2518 37 37 38 38 namespace HeuristicLab.Grid { 39 40 39 41 public partial class ClientForm : Form { 40 private GridClient client; 42 43 private List<ClientController> clientControllers; 44 41 45 public ClientForm() { 42 46 InitializeComponent(); 43 44 client = new GridClient(); 47 clientControllers = new List<ClientController>(); 48 nClientsControl.Value = Environment.ProcessorCount; 49 clientControllerBindingSource.DataSource = clientControllers; 45 50 UpdateControl(); 46 51 } 47 52 48 53 private void startButton_Click(object sender, EventArgs e) { 49 client.Start(addressTextBox.Text); 54 foreach (var client in clientControllers) { 55 client.Client.Start(addressTextBox.Text); 56 } 50 57 UpdateControl(); 51 58 } 52 59 53 60 private void stopButton_Click(object sender, EventArgs e) { 54 client.Stop(); 61 foreach (var client in clientControllers) { 62 client.Client.Stop(); 63 } 55 64 UpdateControl(); 56 65 } 57 66 58 67 private void UpdateControl() { 59 if(client.Waiting) { 60 startButton.Enabled = false; 61 stopButton.Enabled = true; 62 statusTextBox.Text = "Waiting for engine"; 63 } else if(client.Executing) { 64 startButton.Enabled = false; 65 stopButton.Enabled = true; 66 statusTextBox.Text = "Executing engine"; 67 } else if(client.Stopped) { 68 startButton.Enabled = true; 69 stopButton.Enabled = false; 70 statusTextBox.Text = "Stopped"; 68 foreach (var client in clientControllers) { 69 if (client.Client.Waiting) { 70 startButton.Enabled = false; 71 stopButton.Enabled = true; 72 client.Status = "Waiting for engine"; 73 } else if (client.Client.Executing) { 74 startButton.Enabled = false; 75 stopButton.Enabled = true; 76 client.Status = "Executing engine"; 77 } else if (client.Client.Stopped) { 78 startButton.Enabled = true; 79 stopButton.Enabled = false; 80 client.Status = "Stopped"; 81 } 82 client.Message = client.Client.StatusMessage; 71 83 } 72 statusStrip.Text = client.StatusMessage;84 clientGrid.Invalidate(); 73 85 } 74 86 … … 76 88 UpdateControl(); 77 89 } 90 91 private void nClientsControl_ValueChanged(object sender, EventArgs e) { 92 if (nClientsControl.Value < 0) 93 nClientsControl.Value = 0; 94 while (clientControllers.Count < nClientsControl.Value) 95 clientControllers.Add(new ClientController() { Client = new GridClient() }); 96 while (clientControllers.Count > nClientsControl.Value) { 97 try { 98 clientControllers[clientControllers.Count - 1].Client.Stop(); 99 clientControllers.RemoveAt(clientControllers.Count - 1); 100 } catch { } 101 } 102 clientGrid.Invalidate(); 103 } 78 104 } 79 105 } -
TabularUnified trunk/sources/HeuristicLab.Grid/3.2/ClientForm.designer.cs ¶
r1529 r2518 50 50 this.startButton = new System.Windows.Forms.Button(); 51 51 this.addressTextBox = new System.Windows.Forms.TextBox(); 52 this.statusLabel = new System.Windows.Forms.Label();53 this.statusTextBox = new System.Windows.Forms.TextBox();54 this.statusStrip = new System.Windows.Forms.StatusStrip();55 52 this.timer = new System.Windows.Forms.Timer(this.components); 53 this.nClientsControl = new System.Windows.Forms.NumericUpDown(); 54 this.clientGrid = new System.Windows.Forms.DataGridView(); 55 this.clientControllerBindingSource = new System.Windows.Forms.BindingSource(this.components); 56 this.clientDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); 57 this.statusDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); 58 this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); 59 this.runningDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 60 ((System.ComponentModel.ISupportInitialize)(this.nClientsControl)).BeginInit(); 61 ((System.ComponentModel.ISupportInitialize)(this.clientGrid)).BeginInit(); 62 ((System.ComponentModel.ISupportInitialize)(this.clientControllerBindingSource)).BeginInit(); 56 63 this.SuspendLayout(); 57 64 // … … 69 76 this.stopButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 70 77 this.stopButton.Enabled = false; 71 this.stopButton.Location = new System.Drawing.Point(9 6, 61);78 this.stopButton.Location = new System.Drawing.Point(93, 142); 72 79 this.stopButton.Name = "stopButton"; 73 80 this.stopButton.Size = new System.Drawing.Size(75, 23); 74 81 this.stopButton.TabIndex = 6; 75 this.stopButton.Text = "St&op ";82 this.stopButton.Text = "St&op All"; 76 83 this.stopButton.UseVisualStyleBackColor = true; 77 84 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); … … 80 87 // 81 88 this.startButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 82 this.startButton.Location = new System.Drawing.Point(12, 61);89 this.startButton.Location = new System.Drawing.Point(12, 142); 83 90 this.startButton.Name = "startButton"; 84 91 this.startButton.Size = new System.Drawing.Size(75, 23); 85 92 this.startButton.TabIndex = 5; 86 this.startButton.Text = "St&art ";93 this.startButton.Text = "St&art All"; 87 94 this.startButton.UseVisualStyleBackColor = true; 88 95 this.startButton.Click += new System.EventHandler(this.startButton_Click); … … 90 97 // addressTextBox 91 98 // 99 this.addressTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 100 | System.Windows.Forms.AnchorStyles.Right))); 92 101 this.addressTextBox.Location = new System.Drawing.Point(96, 6); 93 102 this.addressTextBox.Name = "addressTextBox"; 94 this.addressTextBox.Size = new System.Drawing.Size(2 22, 20);103 this.addressTextBox.Size = new System.Drawing.Size(263, 20); 95 104 this.addressTextBox.TabIndex = 4; 96 //97 // statusLabel98 //99 this.statusLabel.AutoSize = true;100 this.statusLabel.Location = new System.Drawing.Point(12, 33);101 this.statusLabel.Name = "statusLabel";102 this.statusLabel.Size = new System.Drawing.Size(67, 13);103 this.statusLabel.TabIndex = 8;104 this.statusLabel.Text = "&Client status:";105 //106 // statusTextBox107 //108 this.statusTextBox.Location = new System.Drawing.Point(96, 30);109 this.statusTextBox.Name = "statusTextBox";110 this.statusTextBox.ReadOnly = true;111 this.statusTextBox.Size = new System.Drawing.Size(222, 20);112 this.statusTextBox.TabIndex = 9;113 //114 // statusStrip115 //116 this.statusStrip.Location = new System.Drawing.Point(0, 87);117 this.statusStrip.Name = "statusStrip";118 this.statusStrip.Size = new System.Drawing.Size(330, 22);119 this.statusStrip.TabIndex = 10;120 this.statusStrip.Text = "statusStrip1";121 105 // 122 106 // timer … … 126 110 this.timer.Tick += new System.EventHandler(this.timer_Tick); 127 111 // 112 // nClientsControl 113 // 114 this.nClientsControl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 115 this.nClientsControl.Location = new System.Drawing.Point(365, 6); 116 this.nClientsControl.Name = "nClientsControl"; 117 this.nClientsControl.Size = new System.Drawing.Size(48, 20); 118 this.nClientsControl.TabIndex = 11; 119 this.nClientsControl.ValueChanged += new System.EventHandler(this.nClientsControl_ValueChanged); 120 // 121 // clientGrid 122 // 123 this.clientGrid.AllowUserToAddRows = false; 124 this.clientGrid.AllowUserToDeleteRows = false; 125 this.clientGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 126 | System.Windows.Forms.AnchorStyles.Left) 127 | System.Windows.Forms.AnchorStyles.Right))); 128 this.clientGrid.AutoGenerateColumns = false; 129 this.clientGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; 130 this.clientGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 131 this.clientDataGridViewTextBoxColumn, 132 this.statusDataGridViewTextBoxColumn, 133 this.messageDataGridViewTextBoxColumn, 134 this.runningDataGridViewCheckBoxColumn}); 135 this.clientGrid.DataSource = this.clientControllerBindingSource; 136 this.clientGrid.Location = new System.Drawing.Point(12, 32); 137 this.clientGrid.Name = "clientGrid"; 138 this.clientGrid.RowHeadersVisible = false; 139 this.clientGrid.Size = new System.Drawing.Size(401, 104); 140 this.clientGrid.TabIndex = 12; 141 // 142 // clientControllerBindingSource 143 // 144 this.clientControllerBindingSource.DataSource = typeof(HeuristicLab.Grid.ClientController); 145 // 146 // clientDataGridViewTextBoxColumn 147 // 148 this.clientDataGridViewTextBoxColumn.DataPropertyName = "Client"; 149 this.clientDataGridViewTextBoxColumn.HeaderText = "Client"; 150 this.clientDataGridViewTextBoxColumn.Name = "clientDataGridViewTextBoxColumn"; 151 this.clientDataGridViewTextBoxColumn.ReadOnly = true; 152 this.clientDataGridViewTextBoxColumn.Visible = false; 153 // 154 // statusDataGridViewTextBoxColumn 155 // 156 this.statusDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; 157 this.statusDataGridViewTextBoxColumn.DataPropertyName = "Status"; 158 this.statusDataGridViewTextBoxColumn.HeaderText = "Status"; 159 this.statusDataGridViewTextBoxColumn.Name = "statusDataGridViewTextBoxColumn"; 160 this.statusDataGridViewTextBoxColumn.ReadOnly = true; 161 // 162 // messageDataGridViewTextBoxColumn 163 // 164 this.messageDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; 165 this.messageDataGridViewTextBoxColumn.DataPropertyName = "Message"; 166 this.messageDataGridViewTextBoxColumn.HeaderText = "Message"; 167 this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn"; 168 this.messageDataGridViewTextBoxColumn.ReadOnly = true; 169 // 170 // runningDataGridViewCheckBoxColumn 171 // 172 this.runningDataGridViewCheckBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; 173 this.runningDataGridViewCheckBoxColumn.DataPropertyName = "Running"; 174 this.runningDataGridViewCheckBoxColumn.HeaderText = "Running"; 175 this.runningDataGridViewCheckBoxColumn.Name = "runningDataGridViewCheckBoxColumn"; 176 this.runningDataGridViewCheckBoxColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True; 177 // 128 178 // ClientForm 129 179 // 130 180 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 131 181 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 132 this.ClientSize = new System.Drawing.Size(330, 109); 133 this.Controls.Add(this.statusStrip); 134 this.Controls.Add(this.statusTextBox); 135 this.Controls.Add(this.statusLabel); 182 this.ClientSize = new System.Drawing.Size(425, 177); 183 this.Controls.Add(this.clientGrid); 184 this.Controls.Add(this.nClientsControl); 136 185 this.Controls.Add(this.label1); 137 186 this.Controls.Add(this.stopButton); … … 140 189 this.Name = "ClientForm"; 141 190 this.Text = "Grid Client"; 191 ((System.ComponentModel.ISupportInitialize)(this.nClientsControl)).EndInit(); 192 ((System.ComponentModel.ISupportInitialize)(this.clientGrid)).EndInit(); 193 ((System.ComponentModel.ISupportInitialize)(this.clientControllerBindingSource)).EndInit(); 142 194 this.ResumeLayout(false); 143 195 this.PerformLayout(); … … 151 203 private System.Windows.Forms.Button startButton; 152 204 private System.Windows.Forms.TextBox addressTextBox; 153 private System.Windows.Forms.Label statusLabel;154 private System.Windows.Forms.TextBox statusTextBox;155 private System.Windows.Forms.StatusStrip statusStrip;156 205 private System.Windows.Forms.Timer timer; 206 private System.Windows.Forms.NumericUpDown nClientsControl; 207 private System.Windows.Forms.DataGridView clientGrid; 208 private System.Windows.Forms.BindingSource clientControllerBindingSource; 209 private System.Windows.Forms.DataGridViewTextBoxColumn clientDataGridViewTextBoxColumn; 210 private System.Windows.Forms.DataGridViewTextBoxColumn statusDataGridViewTextBoxColumn; 211 private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn; 212 private System.Windows.Forms.DataGridViewCheckBoxColumn runningDataGridViewCheckBoxColumn; 157 213 } 158 214 } -
TabularUnified trunk/sources/HeuristicLab.Grid/3.2/ClientForm.resx ¶
r1529 r2518 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="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">121 <value>17, 17</value>122 </metadata>123 120 <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 121 <value>121, 17</value> 125 122 </metadata> 123 <metadata name="clientControllerBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 124 <value>201, 17</value> 125 </metadata> 126 126 </root> -
TabularUnified trunk/sources/HeuristicLab.Grid/3.2/HeuristicLab.Grid-3.2.csproj ¶
r2058 r2518 73 73 <RequiredTargetFramework>3.5</RequiredTargetFramework> 74 74 </Reference> 75 <Reference Include="System.Data.SQLite, Version=1.0.60.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"> 76 <SpecificVersion>False</SpecificVersion> 77 <HintPath>..\HeuristicLab.SQLite\System.Data.SQLite.DLL</HintPath> 75 <Reference Include="System.Data.DataSetExtensions"> 76 <RequiredTargetFramework>3.5</RequiredTargetFramework> 78 77 </Reference> 79 78 <Reference Include="System.Drawing" /> … … 92 91 </ItemGroup> 93 92 <ItemGroup> 93 <Compile Include="ClientController.cs" /> 94 94 <Compile Include="ClientForm.cs"> 95 95 <SubType>Form</SubType> … … 148 148 <None Include="HeuristicLab.snk" /> 149 149 <None Include="Properties\AssemblyInfo.frame" /> 150 <None Include="Properties\DataSources\ClientController.datasource" /> 150 151 </ItemGroup> 151 152 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Note: See TracChangeset
for help on using the changeset viewer.