Changeset 4466 for branches/OKB/HeuristicLab.Clients.OKB-3.3/Views
- Timestamp:
- 09/22/10 05:54:13 (14 years ago)
- Location:
- branches/OKB/HeuristicLab.Clients.OKB-3.3/Views
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.Designer.cs
r4441 r4466 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AdministratorView)); 48 49 this.tabControl = new System.Windows.Forms.TabControl(); 49 50 this.platformsTabPage = new System.Windows.Forms.TabPage(); … … 53 54 this.algorithmsTabPage = new System.Windows.Forms.TabPage(); 54 55 this.algorithmCollectionView = new HeuristicLab.Clients.OKB.AlgorithmCollectionView(); 56 this.dataTypesTabPage = new System.Windows.Forms.TabPage(); 55 57 this.refreshButton = new System.Windows.Forms.Button(); 56 58 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 59 this.dataTypeCollectionView = new HeuristicLab.Clients.OKB.DataTypeCollectionView(); 57 60 this.tabControl.SuspendLayout(); 58 61 this.platformsTabPage.SuspendLayout(); 59 62 this.algorithmClassesTabPage.SuspendLayout(); 60 63 this.algorithmsTabPage.SuspendLayout(); 64 this.dataTypesTabPage.SuspendLayout(); 61 65 this.SuspendLayout(); 62 66 // … … 69 73 this.tabControl.Controls.Add(this.algorithmClassesTabPage); 70 74 this.tabControl.Controls.Add(this.algorithmsTabPage); 75 this.tabControl.Controls.Add(this.dataTypesTabPage); 71 76 this.tabControl.Location = new System.Drawing.Point(0, 29); 72 77 this.tabControl.Name = "tabControl"; … … 147 152 this.algorithmCollectionView.TabIndex = 0; 148 153 // 154 // dataTypesTabPage 155 // 156 this.dataTypesTabPage.Controls.Add(this.dataTypeCollectionView); 157 this.dataTypesTabPage.Location = new System.Drawing.Point(4, 22); 158 this.dataTypesTabPage.Name = "dataTypesTabPage"; 159 this.dataTypesTabPage.Padding = new System.Windows.Forms.Padding(3); 160 this.dataTypesTabPage.Size = new System.Drawing.Size(719, 380); 161 this.dataTypesTabPage.TabIndex = 3; 162 this.dataTypesTabPage.Text = "Data Types"; 163 this.dataTypesTabPage.UseVisualStyleBackColor = true; 164 // 149 165 // refreshButton 150 166 // 151 this.refreshButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Refresh;167 this.refreshButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshButton.Image"))); 152 168 this.refreshButton.Location = new System.Drawing.Point(0, 0); 153 169 this.refreshButton.Name = "refreshButton"; … … 157 173 this.refreshButton.UseVisualStyleBackColor = true; 158 174 this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click); 175 // 176 // dataTypeCollectionView 177 // 178 this.dataTypeCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 179 | System.Windows.Forms.AnchorStyles.Left) 180 | System.Windows.Forms.AnchorStyles.Right))); 181 this.dataTypeCollectionView.Caption = "DataTypeCollection View"; 182 this.dataTypeCollectionView.Content = null; 183 this.dataTypeCollectionView.Location = new System.Drawing.Point(6, 6); 184 this.dataTypeCollectionView.Name = "dataTypeCollectionView"; 185 this.dataTypeCollectionView.ReadOnly = false; 186 this.dataTypeCollectionView.Size = new System.Drawing.Size(707, 368); 187 this.dataTypeCollectionView.TabIndex = 0; 159 188 // 160 189 // AdministratorView … … 170 199 this.algorithmClassesTabPage.ResumeLayout(false); 171 200 this.algorithmsTabPage.ResumeLayout(false); 201 this.dataTypesTabPage.ResumeLayout(false); 172 202 this.ResumeLayout(false); 173 203 … … 185 215 private System.Windows.Forms.TabPage platformsTabPage; 186 216 private PlatformCollectionView platformCollectionView; 217 private System.Windows.Forms.TabPage dataTypesTabPage; 218 private DataTypeCollectionView dataTypeCollectionView; 187 219 188 220 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AdministratorView.cs
r4441 r4466 56 56 algorithmClassCollectionView.Content = null; 57 57 algorithmCollectionView.Content = null; 58 dataTypeCollectionView.Content = null; 58 59 } else { 59 60 platformCollectionView.Content = Content.Platforms; 60 61 algorithmClassCollectionView.Content = Content.AlgorithmClasses; 61 62 algorithmCollectionView.Content = Content.Algorithms; 63 dataTypeCollectionView.Content = Content.DataTypes; 62 64 } 63 65 } … … 69 71 algorithmClassCollectionView.Enabled = Content != null; 70 72 algorithmCollectionView.Enabled = Content != null; 73 dataTypeCollectionView.Enabled = Content != null; 71 74 } 72 75 … … 87 90 algorithmClassCollectionView.Content = Content.AlgorithmClasses; 88 91 algorithmCollectionView.Content = Content.Algorithms; 92 dataTypeCollectionView.Content = Content.DataTypes; 89 93 refreshButton.Enabled = true; 90 94 tabControl.Enabled = true; -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.Designer.cs
r4441 r4466 49 49 this.algorithmClassLabel = new System.Windows.Forms.Label(); 50 50 this.algorithmClassComboBox = new System.Windows.Forms.ComboBox(); 51 this.usersListBox = new System.Windows.Forms.ListBox(); 52 this.tabControl = new System.Windows.Forms.TabControl(); 53 this.usersTabPage = new System.Windows.Forms.TabPage(); 54 this.storeUsersButton = new System.Windows.Forms.Button(); 55 this.refreshUsersButton = new System.Windows.Forms.Button(); 56 this.dataTabPage = new System.Windows.Forms.TabPage(); 57 this.fileLabel = new System.Windows.Forms.Label(); 58 this.storeDataButton = new System.Windows.Forms.Button(); 59 this.fileTextBox = new System.Windows.Forms.TextBox(); 60 this.openFileButton = new System.Windows.Forms.Button(); 61 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 62 this.dataTypeLabel = new System.Windows.Forms.Label(); 63 this.dataTypeComboBox = new System.Windows.Forms.ComboBox(); 51 64 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit(); 65 this.tabControl.SuspendLayout(); 66 this.usersTabPage.SuspendLayout(); 67 this.dataTabPage.SuspendLayout(); 52 68 this.SuspendLayout(); 53 69 // … … 55 71 // 56 72 this.nameTextBox.Location = new System.Drawing.Point(90, 29); 57 this.nameTextBox.Size = new System.Drawing.Size( 197, 20);73 this.nameTextBox.Size = new System.Drawing.Size(495, 20); 58 74 // 59 75 // descriptionTextBox 60 76 // 61 77 this.descriptionTextBox.Location = new System.Drawing.Point(90, 55); 62 this.descriptionTextBox.Size = new System.Drawing.Size( 197, 20);78 this.descriptionTextBox.Size = new System.Drawing.Size(495, 20); 63 79 // 64 80 // storeButton … … 68 84 // modifiedPictureBox 69 85 // 70 this.modifiedPictureBox.Location = new System.Drawing.Point(293, 3); 71 this.modifiedPictureBox.Size = new System.Drawing.Size(39, 130); 86 this.modifiedPictureBox.Location = new System.Drawing.Point(591, 3); 72 87 // 73 88 // platformLabel … … 88 103 this.platformComboBox.Location = new System.Drawing.Point(90, 81); 89 104 this.platformComboBox.Name = "platformComboBox"; 90 this.platformComboBox.Size = new System.Drawing.Size( 197, 21);105 this.platformComboBox.Size = new System.Drawing.Size(495, 21); 91 106 this.platformComboBox.TabIndex = 6; 92 107 this.platformComboBox.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged); … … 109 124 this.algorithmClassComboBox.Location = new System.Drawing.Point(90, 108); 110 125 this.algorithmClassComboBox.Name = "algorithmClassComboBox"; 111 this.algorithmClassComboBox.Size = new System.Drawing.Size( 197, 21);126 this.algorithmClassComboBox.Size = new System.Drawing.Size(495, 21); 112 127 this.algorithmClassComboBox.TabIndex = 8; 113 128 this.algorithmClassComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmClassComboBox_SelectedValueChanged); 114 129 // 130 // usersListBox 131 // 132 this.usersListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 133 | System.Windows.Forms.AnchorStyles.Left) 134 | System.Windows.Forms.AnchorStyles.Right))); 135 this.usersListBox.Enabled = false; 136 this.usersListBox.FormattingEnabled = true; 137 this.usersListBox.Location = new System.Drawing.Point(6, 35); 138 this.usersListBox.Name = "usersListBox"; 139 this.usersListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple; 140 this.usersListBox.Size = new System.Drawing.Size(613, 225); 141 this.usersListBox.TabIndex = 2; 142 this.usersListBox.SelectedIndexChanged += new System.EventHandler(this.usersListBox_SelectedIndexChanged); 143 // 144 // tabControl 145 // 146 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 147 | System.Windows.Forms.AnchorStyles.Left) 148 | System.Windows.Forms.AnchorStyles.Right))); 149 this.tabControl.Controls.Add(this.usersTabPage); 150 this.tabControl.Controls.Add(this.dataTabPage); 151 this.tabControl.Location = new System.Drawing.Point(0, 162); 152 this.tabControl.Name = "tabControl"; 153 this.tabControl.SelectedIndex = 0; 154 this.tabControl.Size = new System.Drawing.Size(633, 292); 155 this.tabControl.TabIndex = 9; 156 // 157 // usersTabPage 158 // 159 this.usersTabPage.Controls.Add(this.storeUsersButton); 160 this.usersTabPage.Controls.Add(this.refreshUsersButton); 161 this.usersTabPage.Controls.Add(this.usersListBox); 162 this.usersTabPage.Location = new System.Drawing.Point(4, 22); 163 this.usersTabPage.Name = "usersTabPage"; 164 this.usersTabPage.Padding = new System.Windows.Forms.Padding(3); 165 this.usersTabPage.Size = new System.Drawing.Size(625, 266); 166 this.usersTabPage.TabIndex = 0; 167 this.usersTabPage.Text = "Authorized Users"; 168 this.usersTabPage.UseVisualStyleBackColor = true; 169 // 170 // storeUsersButton 171 // 172 this.storeUsersButton.Location = new System.Drawing.Point(86, 6); 173 this.storeUsersButton.Name = "storeUsersButton"; 174 this.storeUsersButton.Size = new System.Drawing.Size(75, 23); 175 this.storeUsersButton.TabIndex = 1; 176 this.storeUsersButton.Text = "&Store"; 177 this.toolTip.SetToolTip(this.storeUsersButton, "Store Authorized Users"); 178 this.storeUsersButton.UseVisualStyleBackColor = true; 179 this.storeUsersButton.Click += new System.EventHandler(this.storeUsersButton_Click); 180 // 181 // refreshUsersButton 182 // 183 this.refreshUsersButton.Location = new System.Drawing.Point(6, 6); 184 this.refreshUsersButton.Name = "refreshUsersButton"; 185 this.refreshUsersButton.Size = new System.Drawing.Size(75, 23); 186 this.refreshUsersButton.TabIndex = 0; 187 this.refreshUsersButton.Text = "&Refresh"; 188 this.toolTip.SetToolTip(this.refreshUsersButton, "Refresh Authorized Users"); 189 this.refreshUsersButton.UseVisualStyleBackColor = true; 190 this.refreshUsersButton.Click += new System.EventHandler(this.refreshUsersButton_Click); 191 // 192 // dataTabPage 193 // 194 this.dataTabPage.Controls.Add(this.dataTypeComboBox); 195 this.dataTabPage.Controls.Add(this.openFileButton); 196 this.dataTabPage.Controls.Add(this.fileTextBox); 197 this.dataTabPage.Controls.Add(this.storeDataButton); 198 this.dataTabPage.Controls.Add(this.dataTypeLabel); 199 this.dataTabPage.Controls.Add(this.fileLabel); 200 this.dataTabPage.Location = new System.Drawing.Point(4, 22); 201 this.dataTabPage.Name = "dataTabPage"; 202 this.dataTabPage.Padding = new System.Windows.Forms.Padding(3); 203 this.dataTabPage.Size = new System.Drawing.Size(625, 266); 204 this.dataTabPage.TabIndex = 1; 205 this.dataTabPage.Text = "Serialized Algorithm"; 206 this.dataTabPage.UseVisualStyleBackColor = true; 207 // 208 // fileLabel 209 // 210 this.fileLabel.AutoSize = true; 211 this.fileLabel.Location = new System.Drawing.Point(6, 38); 212 this.fileLabel.Name = "fileLabel"; 213 this.fileLabel.Size = new System.Drawing.Size(26, 13); 214 this.fileLabel.TabIndex = 1; 215 this.fileLabel.Text = "&File:"; 216 // 217 // storeDataButton 218 // 219 this.storeDataButton.Enabled = false; 220 this.storeDataButton.Location = new System.Drawing.Point(6, 6); 221 this.storeDataButton.Name = "storeDataButton"; 222 this.storeDataButton.Size = new System.Drawing.Size(75, 23); 223 this.storeDataButton.TabIndex = 0; 224 this.storeDataButton.Text = "&Store"; 225 this.toolTip.SetToolTip(this.storeDataButton, "Store Serialized Algorithm"); 226 this.storeDataButton.UseVisualStyleBackColor = true; 227 this.storeDataButton.Click += new System.EventHandler(this.storeDataButton_Click); 228 // 229 // fileTextBox 230 // 231 this.fileTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 232 | System.Windows.Forms.AnchorStyles.Right))); 233 this.fileTextBox.Location = new System.Drawing.Point(69, 35); 234 this.fileTextBox.Name = "fileTextBox"; 235 this.fileTextBox.ReadOnly = true; 236 this.fileTextBox.Size = new System.Drawing.Size(520, 20); 237 this.fileTextBox.TabIndex = 2; 238 // 239 // openFileButton 240 // 241 this.openFileButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 242 this.openFileButton.Location = new System.Drawing.Point(595, 32); 243 this.openFileButton.Name = "openFileButton"; 244 this.openFileButton.Size = new System.Drawing.Size(24, 24); 245 this.openFileButton.TabIndex = 3; 246 this.openFileButton.Text = "..."; 247 this.openFileButton.UseVisualStyleBackColor = true; 248 this.openFileButton.Click += new System.EventHandler(this.openFileButton_Click); 249 // 250 // openFileDialog 251 // 252 this.openFileDialog.FileName = "algorithm"; 253 this.openFileDialog.Filter = "All Files (*.*)|*.*"; 254 this.openFileDialog.Title = "Select Algorithm File"; 255 // 256 // dataTypeLabel 257 // 258 this.dataTypeLabel.AutoSize = true; 259 this.dataTypeLabel.Location = new System.Drawing.Point(6, 64); 260 this.dataTypeLabel.Name = "dataTypeLabel"; 261 this.dataTypeLabel.Size = new System.Drawing.Size(57, 13); 262 this.dataTypeLabel.TabIndex = 4; 263 this.dataTypeLabel.Text = "&DataType:"; 264 // 265 // dataTypeComboBox 266 // 267 this.dataTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 268 | System.Windows.Forms.AnchorStyles.Right))); 269 this.dataTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 270 this.dataTypeComboBox.FormattingEnabled = true; 271 this.dataTypeComboBox.Location = new System.Drawing.Point(69, 61); 272 this.dataTypeComboBox.Name = "dataTypeComboBox"; 273 this.dataTypeComboBox.Size = new System.Drawing.Size(550, 21); 274 this.dataTypeComboBox.TabIndex = 5; 275 this.dataTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.dataTypeComboBox_SelectedIndexChanged); 276 // 115 277 // AlgorithmView 116 278 // 117 279 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 280 this.Controls.Add(this.tabControl); 118 281 this.Controls.Add(this.platformComboBox); 119 282 this.Controls.Add(this.platformLabel); … … 121 284 this.Controls.Add(this.algorithmClassLabel); 122 285 this.Name = "AlgorithmView"; 123 this.Size = new System.Drawing.Size(335, 275); 124 this.Controls.SetChildIndex(this.modifiedPictureBox, 0); 286 this.Size = new System.Drawing.Size(633, 454); 125 287 this.Controls.SetChildIndex(this.algorithmClassLabel, 0); 126 288 this.Controls.SetChildIndex(this.algorithmClassComboBox, 0); 127 289 this.Controls.SetChildIndex(this.platformLabel, 0); 128 290 this.Controls.SetChildIndex(this.platformComboBox, 0); 291 this.Controls.SetChildIndex(this.tabControl, 0); 292 this.Controls.SetChildIndex(this.modifiedPictureBox, 0); 129 293 this.Controls.SetChildIndex(this.storeButton, 0); 130 294 this.Controls.SetChildIndex(this.nameTextBox, 0); … … 133 297 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 134 298 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit(); 299 this.tabControl.ResumeLayout(false); 300 this.usersTabPage.ResumeLayout(false); 301 this.dataTabPage.ResumeLayout(false); 302 this.dataTabPage.PerformLayout(); 135 303 this.ResumeLayout(false); 136 304 this.PerformLayout(); … … 144 312 private System.Windows.Forms.Label algorithmClassLabel; 145 313 private System.Windows.Forms.ComboBox algorithmClassComboBox; 314 private System.Windows.Forms.ListBox usersListBox; 315 private System.Windows.Forms.TabControl tabControl; 316 private System.Windows.Forms.TabPage usersTabPage; 317 private System.Windows.Forms.Button storeUsersButton; 318 private System.Windows.Forms.Button refreshUsersButton; 319 private System.Windows.Forms.TabPage dataTabPage; 320 private System.Windows.Forms.ComboBox dataTypeComboBox; 321 private System.Windows.Forms.Button openFileButton; 322 private System.Windows.Forms.TextBox fileTextBox; 323 private System.Windows.Forms.Button storeDataButton; 324 private System.Windows.Forms.Label dataTypeLabel; 325 private System.Windows.Forms.Label fileLabel; 326 private System.Windows.Forms.OpenFileDialog openFileDialog; 146 327 147 328 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs
r4441 r4466 20 20 #endregion 21 21 22 using System; 23 using System.Collections.Generic; 22 24 using System.Linq; 23 25 using System.Windows.Forms; 24 26 using HeuristicLab.MainForm; 25 27 using HeuristicLab.MainForm.WindowsForms; 28 using System.IO; 26 29 27 30 namespace HeuristicLab.Clients.OKB { … … 42 45 platformComboBox.DataSource = Administrator.Instance.Platforms.ToList(); 43 46 algorithmClassComboBox.DataSource = Administrator.Instance.AlgorithmClasses.ToList(); 47 dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.ToList(); 44 48 } 45 49 … … 62 66 algorithmClassComboBox.SelectedItem = Administrator.Instance.AlgorithmClasses.FirstOrDefault(a => a.Id == Content.AlgorithmClassId); 63 67 } 68 usersListBox.DataSource = null; 69 fileTextBox.Text = ""; 70 dataTypeComboBox.SelectedIndex = -1; 64 71 } 65 72 … … 68 75 platformComboBox.Enabled = Content != null; 69 76 algorithmClassComboBox.Enabled = Content != null; 77 refreshUsersButton.Enabled = Content != null; 78 storeUsersButton.Enabled = usersListBox.DataSource != null; 79 usersListBox.Enabled = usersListBox.DataSource != null; 80 storeDataButton.Enabled = !string.IsNullOrEmpty(fileTextBox.Text) && dataTypeComboBox.SelectedIndex != -1; 70 81 } 71 82 … … 93 104 } 94 105 } 106 107 private void refreshUsersButton_Click(object sender, System.EventArgs e) { 108 Guid[] ids = Administrator.Instance.GetAlgorithmUsers(Content.Id); 109 if (ids != null) { 110 List<User> users = Administrator.Instance.Users.ToList(); 111 usersListBox.DataSource = users; 112 usersListBox.DisplayMember = "Name"; 113 usersListBox.SelectedItems.Clear(); 114 foreach (Guid id in ids) 115 usersListBox.SelectedItems.Add(users.First(u => u.Id == id)); 116 usersListBox.Enabled = true; 117 storeUsersButton.Enabled = false; 118 } 119 } 120 private void storeUsersButton_Click(object sender, System.EventArgs e) { 121 if (Administrator.Instance.StoreAlgorithmUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToArray())) 122 storeUsersButton.Enabled = false; 123 } 124 private void usersListBox_SelectedIndexChanged(object sender, EventArgs e) { 125 storeUsersButton.Enabled = true; 126 } 127 128 private void storeDataButton_Click(object sender, EventArgs e) { 129 AlgorithmData data = new AlgorithmData(); 130 data.AlgorithmId = Content.Id; 131 data.DataTypeId = ((DataType)dataTypeComboBox.SelectedItem).Id; 132 133 using (FileStream stream = new FileStream(fileTextBox.Text, FileMode.Open, FileAccess.Read)) { 134 byte[] bytes = new byte[stream.Length]; 135 stream.Read(bytes, 0, bytes.Length); 136 stream.Close(); 137 data.Data = bytes; 138 } 139 140 if (Administrator.Instance.StoreAlgorithmData(data)) 141 storeDataButton.Enabled = false; 142 } 143 private void openFileButton_Click(object sender, EventArgs e) { 144 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 145 fileTextBox.Text = openFileDialog.FileName; 146 storeDataButton.Enabled = true; 147 } 148 } 149 private void dataTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) { 150 storeDataButton.Enabled = !string.IsNullOrEmpty(fileTextBox.Text); 151 } 95 152 } 96 153 }
Note: See TracChangeset
for help on using the changeset viewer.