Changeset 4492 for branches/OKB/HeuristicLab.Clients.OKB-3.3/Views
- Timestamp:
- 09/25/10 03:32:18 (14 years ago)
- Location:
- branches/OKB/HeuristicLab.Clients.OKB-3.3/Views
- Files:
-
- 4 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmDataView.Designer.cs
r4481 r4492 46 46 private void InitializeComponent() { 47 47 this.components = new System.ComponentModel.Container(); 48 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AlgorithmDataView));49 48 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 50 49 this.saveFileDialog = new System.Windows.Forms.SaveFileDialog(); … … 109 108 this.viewHost.Caption = "View"; 110 109 this.viewHost.Content = null; 111 this.viewHost.Enabled = false;110 this.viewHost.Enabled = true; 112 111 this.viewHost.Location = new System.Drawing.Point(6, 19); 113 112 this.viewHost.Name = "viewHost"; … … 131 130 // newDataButton 132 131 // 133 this.newDataButton.Image = ((System.Drawing.Image)(resources.GetObject("newDataButton.Image")));132 this.newDataButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.NewDocument; 134 133 this.newDataButton.Location = new System.Drawing.Point(90, 0); 135 134 this.newDataButton.Name = "newDataButton"; … … 142 141 // saveFileButton 143 142 // 144 this.saveFileButton.Image = ((System.Drawing.Image)(resources.GetObject("saveFileButton.Image")));143 this.saveFileButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Save; 145 144 this.saveFileButton.Location = new System.Drawing.Point(150, 0); 146 145 this.saveFileButton.Name = "saveFileButton"; … … 153 152 // openFileButton 154 153 // 155 this.openFileButton.Image = ((System.Drawing.Image)(resources.GetObject("openFileButton.Image")));154 this.openFileButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Open; 156 155 this.openFileButton.Location = new System.Drawing.Point(120, 0); 157 156 this.openFileButton.Name = "openFileButton"; … … 174 173 // refreshDataButton 175 174 // 176 this.refreshDataButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshDataButton.Image")));175 this.refreshDataButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Refresh; 177 176 this.refreshDataButton.Location = new System.Drawing.Point(0, 0); 178 177 this.refreshDataButton.Name = "refreshDataButton"; … … 185 184 // storeDataButton 186 185 // 187 this.storeDataButton.Image = ((System.Drawing.Image)(resources.GetObject("storeDataButton.Image")));186 this.storeDataButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.PublishToWeb; 188 187 this.storeDataButton.Location = new System.Drawing.Point(30, 0); 189 188 this.storeDataButton.Name = "storeDataButton"; -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmDataView.cs
r4481 r4492 21 21 22 22 using System; 23 using System.ComponentModel; 23 24 using System.IO; 24 25 using System.Linq; … … 36 37 [Content(typeof(AlgorithmData), true)] 37 38 public partial class AlgorithmDataView : AsynchronousContentView { 38 public long AlgorithmId { get; set; } 39 private long algorithmId; 40 public long AlgorithmId { 41 get { return algorithmId; } 42 set { 43 algorithmId = value; 44 if (Content != null) { 45 Content.AlgorithmId = value; 46 SetEnabledStateOfControls(); 47 } 48 } 49 } 39 50 40 51 public new AlgorithmData Content { … … 51 62 dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.ToList(); 52 63 dataTypeComboBox.SelectedIndex = -1; 64 } 65 66 protected override void DeregisterContentEvents() { 67 Content.PropertyChanged -= new PropertyChangedEventHandler(Content_PropertyChanged); 68 base.DeregisterContentEvents(); 69 } 70 protected override void RegisterContentEvents() { 71 base.RegisterContentEvents(); 72 Content.PropertyChanged += new PropertyChangedEventHandler(Content_PropertyChanged); 53 73 } 54 74 … … 79 99 protected override void SetEnabledStateOfControls() { 80 100 base.SetEnabledStateOfControls(); 81 storeDataButton.Enabled = saveFileButton.Enabled = Content != null; 82 dataTypeComboBox.Enabled = Content != null && viewHost.Content == null; 101 newDataButton.Enabled = !ReadOnly; 102 openFileButton.Enabled = !ReadOnly; 103 saveFileButton.Enabled = (Content != null) && (((Content.Data != null) && (Content.Data.Length != 0)) || (viewHost.Content != null)); 104 storeDataButton.Enabled = saveFileButton.Enabled && (Content.AlgorithmId != 0) && !ReadOnly; 105 dataTypeComboBox.Enabled = Content != null && viewHost.Content == null && !ReadOnly; 83 106 fileTextBox.Enabled = Content != null; 84 107 groupBox.Enabled = Content != null; 85 108 } 86 109 110 private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) { 111 switch (e.PropertyName) { 112 case "DataTypeId": 113 dataTypeComboBox.SelectedItem = Administrator.Instance.DataTypes.FirstOrDefault(d => d.Id == Content.DataTypeId); 114 break; 115 } 116 } 117 87 118 private void refreshDataButton_Click(object sender, EventArgs e) { 88 AlgorithmData data = Administrator.Instance.GetAlgorithmData(AlgorithmId); 89 Content = data; 119 BeginAsyncCall(); 120 var call = new Action(delegate() { 121 AlgorithmData data = Administrator.Instance.GetAlgorithmData(AlgorithmId); 122 Content = data; 123 }); 124 call.BeginInvoke(delegate(IAsyncResult result) { 125 call.EndInvoke(result); 126 EndAsyncCall(); 127 }, null); 90 128 } 91 129 private void storeDataButton_Click(object sender, EventArgs e) { … … 95 133 IAlgorithm algorithm = viewHost.Content as IAlgorithm; 96 134 algorithm.Prepare(true); 97 algorithm.Problem = null;98 135 XmlGenerator.Serialize(algorithm, stream); 99 136 stream.Close(); … … 114 151 if (dialog.ShowDialog(this) == DialogResult.OK) { 115 152 try { 116 if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId , Data = new byte[0]};153 if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId }; 117 154 viewHost.Content = (IContent)dialog.TypeSelector.CreateInstanceOfSelectedType(); 118 155 DataType dataType = Administrator.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName); 119 156 if (dataType == null) { 120 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = " Blob" };157 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" }; 121 158 dataType.PlatformId = Administrator.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id; 122 123 Administrator.Instance.Store(dataType); 159 dataType.Store(); 124 160 Administrator.Instance.DataTypes.Add(dataType); 125 161 dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.OrderBy(d => d.Name).ToList(); 126 162 } 127 163 dataTypeComboBox.SelectedItem = dataType; 128 dataTypeComboBox.Enabled = false;129 164 fileTextBox.Text = "-"; 130 165 noViewAvailableLabel.Visible = false; 166 SetEnabledStateOfControls(); 131 167 } 132 168 catch (Exception ex) { … … 139 175 if (openFileDialog.ShowDialog(this) == DialogResult.OK) { 140 176 try { 141 if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId , Data = new byte[0]};177 if (Content == null) Content = new AlgorithmData { AlgorithmId = AlgorithmId }; 142 178 IAlgorithm algorithm = null; 143 179 try { … … 151 187 DataType dataType = Administrator.Instance.DataTypes.FirstOrDefault(d => d.Name == viewHost.Content.GetType().AssemblyQualifiedName); 152 188 if (dataType == null) { 153 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = " Blob" };189 dataType = new DataType { Name = viewHost.Content.GetType().AssemblyQualifiedName, SqlName = "varbinary" }; 154 190 dataType.PlatformId = Administrator.Instance.Platforms.FirstOrDefault(p => p.Name == "HeuristicLab 3.3").Id; 155 156 Administrator.Instance.Store(dataType); 191 dataType.Store(); 157 192 Administrator.Instance.DataTypes.Add(dataType); 158 193 dataTypeComboBox.DataSource = Administrator.Instance.DataTypes.OrderBy(d => d.Name).ToList(); … … 169 204 } 170 205 } 171 dataTypeComboBox.Enabled = viewHost.Content == null;172 206 fileTextBox.Text = openFileDialog.FileName; 207 SetEnabledStateOfControls(); 173 208 } 174 209 catch (Exception ex) { … … 198 233 if (Content != null) Content.DataTypeId = ((DataType)dataTypeComboBox.SelectedItem).Id; 199 234 } 235 236 private void BeginAsyncCall() { 237 if (InvokeRequired) 238 Invoke(new Action(BeginAsyncCall)); 239 else { 240 Cursor = Cursors.AppStarting; 241 Enabled = false; 242 } 243 } 244 private void EndAsyncCall() { 245 if (InvokeRequired) 246 Invoke(new Action(EndAsyncCall)); 247 else { 248 Cursor = Cursors.Default; 249 Enabled = true; 250 } 251 } 200 252 } 201 253 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.Designer.cs
r4481 r4492 45 45 /// </summary> 46 46 private void InitializeComponent() { 47 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AlgorithmView));48 47 this.platformLabel = new System.Windows.Forms.Label(); 49 48 this.platformComboBox = new System.Windows.Forms.ComboBox(); … … 57 56 this.dataTabPage = new System.Windows.Forms.TabPage(); 58 57 this.algorithmDataView = new HeuristicLab.Clients.OKB.AlgorithmDataView(); 59 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();60 58 this.tabControl.SuspendLayout(); 61 59 this.usersTabPage.SuspendLayout(); … … 66 64 // 67 65 this.nameTextBox.Location = new System.Drawing.Point(90, 29); 68 this.nameTextBox.Size = new System.Drawing.Size( 495, 20);66 this.nameTextBox.Size = new System.Drawing.Size(543, 20); 69 67 // 70 68 // descriptionTextBox 71 69 // 72 70 this.descriptionTextBox.Location = new System.Drawing.Point(90, 55); 73 this.descriptionTextBox.Size = new System.Drawing.Size( 495, 20);71 this.descriptionTextBox.Size = new System.Drawing.Size(543, 20); 74 72 // 75 73 // storeButton 76 74 // 77 75 this.toolTip.SetToolTip(this.storeButton, "Store Data"); 78 //79 // modifiedPictureBox80 //81 this.modifiedPictureBox.Location = new System.Drawing.Point(591, 3);82 76 // 83 77 // platformLabel … … 98 92 this.platformComboBox.Location = new System.Drawing.Point(90, 81); 99 93 this.platformComboBox.Name = "platformComboBox"; 100 this.platformComboBox.Size = new System.Drawing.Size( 495, 21);94 this.platformComboBox.Size = new System.Drawing.Size(543, 21); 101 95 this.platformComboBox.TabIndex = 6; 102 96 this.platformComboBox.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged); … … 119 113 this.algorithmClassComboBox.Location = new System.Drawing.Point(90, 108); 120 114 this.algorithmClassComboBox.Name = "algorithmClassComboBox"; 121 this.algorithmClassComboBox.Size = new System.Drawing.Size( 495, 21);115 this.algorithmClassComboBox.Size = new System.Drawing.Size(543, 21); 122 116 this.algorithmClassComboBox.TabIndex = 8; 123 117 this.algorithmClassComboBox.SelectedValueChanged += new System.EventHandler(this.algorithmClassComboBox_SelectedValueChanged); … … 165 159 // storeUsersButton 166 160 // 167 this.storeUsersButton.Image = ((System.Drawing.Image)(resources.GetObject("storeUsersButton.Image")));161 this.storeUsersButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.PublishToWeb; 168 162 this.storeUsersButton.Location = new System.Drawing.Point(36, 6); 169 163 this.storeUsersButton.Name = "storeUsersButton"; … … 176 170 // refreshUsersButton 177 171 // 178 this.refreshUsersButton.Image = ((System.Drawing.Image)(resources.GetObject("refreshUsersButton.Image")));172 this.refreshUsersButton.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.Refresh; 179 173 this.refreshUsersButton.Location = new System.Drawing.Point(6, 6); 180 174 this.refreshUsersButton.Name = "refreshUsersButton"; … … 198 192 // algorithmDataView 199 193 // 194 this.algorithmDataView.AlgorithmId = ((long)(0)); 200 195 this.algorithmDataView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 201 196 | System.Windows.Forms.AnchorStyles.Left) … … 224 219 this.Controls.SetChildIndex(this.platformComboBox, 0); 225 220 this.Controls.SetChildIndex(this.tabControl, 0); 226 this.Controls.SetChildIndex(this.modifiedPictureBox, 0);227 221 this.Controls.SetChildIndex(this.storeButton, 0); 228 222 this.Controls.SetChildIndex(this.nameTextBox, 0); … … 230 224 this.Controls.SetChildIndex(this.descriptionLabel, 0); 231 225 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 232 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();233 226 this.tabControl.ResumeLayout(false); 234 227 this.usersTabPage.ResumeLayout(false); -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/AlgorithmView.cs
r4481 r4492 46 46 } 47 47 48 protected override void DeregisterContentEvents() {49 // ...50 base.DeregisterContentEvents();51 }52 protected override void RegisterContentEvents() {53 base.RegisterContentEvents();54 // ...55 }56 57 48 protected override void OnContentChanged() { 58 49 base.OnContentChanged(); … … 72 63 protected override void SetEnabledStateOfControls() { 73 64 base.SetEnabledStateOfControls(); 74 platformComboBox.Enabled = Content != null;75 algorithmClassComboBox.Enabled = Content != null;65 platformComboBox.Enabled = (Content != null) && !ReadOnly; 66 algorithmClassComboBox.Enabled = (Content != null) && !ReadOnly; 76 67 refreshUsersButton.Enabled = Content != null; 77 storeUsersButton.Enabled = usersListBox.DataSource != null;78 usersListBox.Enabled = usersListBox.DataSource != null;68 storeUsersButton.Enabled = (usersListBox.DataSource != null) && !ReadOnly; 69 usersListBox.Enabled = (usersListBox.DataSource != null) && !ReadOnly; 79 70 algorithmDataView.Enabled = Content != null; 80 71 } … … 82 73 protected override void OnContentPropertyChanged(string propertyName) { 83 74 switch (propertyName) { 75 case "Id": 76 algorithmDataView.AlgorithmId = Content.Id; 77 break; 84 78 case "PlatformId": 85 79 platformComboBox.SelectedItem = Administrator.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); … … 113 107 foreach (Guid id in ids) 114 108 usersListBox.SelectedItems.Add(users.First(u => u.Id == id)); 115 usersListBox.Enabled = true;109 usersListBox.Enabled = !ReadOnly; 116 110 storeUsersButton.Enabled = false; 117 111 } … … 122 116 } 123 117 private void usersListBox_SelectedIndexChanged(object sender, EventArgs e) { 124 storeUsersButton.Enabled = true;118 storeUsersButton.Enabled = !ReadOnly; 125 119 } 126 120 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/DataTypeView.Designer.cs
r4466 r4492 48 48 this.nameTextBox = new System.Windows.Forms.TextBox(); 49 49 this.sqlNameLabel = new System.Windows.Forms.Label(); 50 this.sqlNameTextBox = new System.Windows.Forms.TextBox();51 50 this.platformLabel = new System.Windows.Forms.Label(); 52 51 this.platformComboBox = new System.Windows.Forms.ComboBox(); 53 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit(); 52 this.comboBox1 = new System.Windows.Forms.ComboBox(); 53 this.sqlNameComboBox = new System.Windows.Forms.ComboBox(); 54 54 this.SuspendLayout(); 55 55 // … … 57 57 // 58 58 this.toolTip.SetToolTip(this.storeButton, "Store Data"); 59 //60 // modifiedPictureBox61 //62 this.modifiedPictureBox.Location = new System.Drawing.Point(308, 3);63 59 // 64 60 // nameLabel … … 77 73 this.nameTextBox.Location = new System.Drawing.Point(71, 29); 78 74 this.nameTextBox.Name = "nameTextBox"; 79 this.nameTextBox.Size = new System.Drawing.Size(2 31, 20);75 this.nameTextBox.Size = new System.Drawing.Size(279, 20); 80 76 this.nameTextBox.TabIndex = 2; 81 77 this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged); … … 91 87 this.sqlNameLabel.Text = "&SQL Name:"; 92 88 // 93 // sqlNameTextBox94 //95 this.sqlNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)96 | System.Windows.Forms.AnchorStyles.Right)));97 this.sqlNameTextBox.Location = new System.Drawing.Point(71, 55);98 this.sqlNameTextBox.Name = "sqlNameTextBox";99 this.sqlNameTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;100 this.sqlNameTextBox.Size = new System.Drawing.Size(231, 20);101 this.sqlNameTextBox.TabIndex = 4;102 this.sqlNameTextBox.TextChanged += new System.EventHandler(this.sqlNameTextBox_TextChanged);103 this.sqlNameTextBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.sqlNameTextBox_KeyDown);104 //105 89 // platformLabel 106 90 // 107 91 this.platformLabel.AutoSize = true; 108 this.platformLabel.Location = new System.Drawing.Point(3, 8 4);92 this.platformLabel.Location = new System.Drawing.Point(3, 85); 109 93 this.platformLabel.Name = "platformLabel"; 110 94 this.platformLabel.Size = new System.Drawing.Size(48, 13); … … 118 102 this.platformComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 119 103 this.platformComboBox.FormattingEnabled = true; 120 this.platformComboBox.Location = new System.Drawing.Point(71, 8 1);104 this.platformComboBox.Location = new System.Drawing.Point(71, 82); 121 105 this.platformComboBox.Name = "platformComboBox"; 122 this.platformComboBox.Size = new System.Drawing.Size(2 31, 21);106 this.platformComboBox.Size = new System.Drawing.Size(279, 21); 123 107 this.platformComboBox.TabIndex = 6; 124 108 this.platformComboBox.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged); 109 // 110 // comboBox1 111 // 112 this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 113 | System.Windows.Forms.AnchorStyles.Right))); 114 this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 115 this.comboBox1.FormattingEnabled = true; 116 this.comboBox1.Location = new System.Drawing.Point(71, 55); 117 this.comboBox1.Name = "comboBox1"; 118 this.comboBox1.Size = new System.Drawing.Size(279, 21); 119 this.comboBox1.TabIndex = 6; 120 this.comboBox1.SelectedValueChanged += new System.EventHandler(this.platformComboBox_SelectedValueChanged); 121 // 122 // sqlNameComboBox 123 // 124 this.sqlNameComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 125 | System.Windows.Forms.AnchorStyles.Right))); 126 this.sqlNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 127 this.sqlNameComboBox.FormattingEnabled = true; 128 this.sqlNameComboBox.Items.AddRange(new object[] { 129 "bigint", 130 "bit", 131 "float", 132 "nvarchar", 133 "varbinary"}); 134 this.sqlNameComboBox.Location = new System.Drawing.Point(71, 55); 135 this.sqlNameComboBox.Name = "sqlNameComboBox"; 136 this.sqlNameComboBox.Size = new System.Drawing.Size(279, 21); 137 this.sqlNameComboBox.TabIndex = 4; 138 this.sqlNameComboBox.SelectedValueChanged += new System.EventHandler(this.sqlNameComboBox_SelectedValueChanged); 125 139 // 126 140 // DataTypeView … … 128 142 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 129 143 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 144 this.Controls.Add(this.sqlNameComboBox); 145 this.Controls.Add(this.comboBox1); 130 146 this.Controls.Add(this.platformComboBox); 131 this.Controls.Add(this.sqlNameTextBox);132 147 this.Controls.Add(this.platformLabel); 133 148 this.Controls.Add(this.sqlNameLabel); … … 135 150 this.Controls.Add(this.nameTextBox); 136 151 this.Name = "DataTypeView"; 137 this.Size = new System.Drawing.Size(350, 229); 138 this.Controls.SetChildIndex(this.modifiedPictureBox, 0); 152 this.Size = new System.Drawing.Size(350, 126); 139 153 this.Controls.SetChildIndex(this.storeButton, 0); 140 154 this.Controls.SetChildIndex(this.nameTextBox, 0); … … 142 156 this.Controls.SetChildIndex(this.sqlNameLabel, 0); 143 157 this.Controls.SetChildIndex(this.platformLabel, 0); 144 this.Controls.SetChildIndex(this.sqlNameTextBox, 0);145 158 this.Controls.SetChildIndex(this.platformComboBox, 0); 146 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit(); 159 this.Controls.SetChildIndex(this.comboBox1, 0); 160 this.Controls.SetChildIndex(this.sqlNameComboBox, 0); 147 161 this.ResumeLayout(false); 148 162 this.PerformLayout(); … … 155 169 private System.Windows.Forms.Label nameLabel; 156 170 private System.Windows.Forms.Label sqlNameLabel; 157 private System.Windows.Forms.TextBox sqlNameTextBox;158 171 private System.Windows.Forms.Label platformLabel; 159 172 private System.Windows.Forms.ComboBox platformComboBox; 173 private System.Windows.Forms.ComboBox comboBox1; 174 private System.Windows.Forms.ComboBox sqlNameComboBox; 160 175 } 161 176 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/DataTypeView.cs
r4466 r4492 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Windows.Forms; 24 using System.Linq;25 using HeuristicLab.Core.Views;26 25 using HeuristicLab.MainForm; 27 26 using HeuristicLab.MainForm.WindowsForms; … … 49 48 if (Content == null) { 50 49 nameTextBox.Text = string.Empty; 51 sqlName TextBox.Text = string.Empty;50 sqlNameComboBox.SelectedIndex = -1; 52 51 platformComboBox.SelectedIndex = -1; 53 52 if (ViewAttribute.HasViewAttribute(this.GetType())) … … 57 56 } else { 58 57 nameTextBox.Text = Content.Name; 59 sqlName TextBox.Text = Content.SqlName;58 sqlNameComboBox.Text = Content.SqlName; 60 59 platformComboBox.SelectedItem = Administrator.Instance.Platforms.FirstOrDefault(p => p.Id == Content.PlatformId); 61 60 Caption = Content.Name; … … 65 64 protected override void SetEnabledStateOfControls() { 66 65 base.SetEnabledStateOfControls(); 67 if (Content == null) { 68 nameTextBox.Enabled = false; 69 sqlNameTextBox.Enabled = false; 70 platformComboBox.Enabled = false; 71 } else { 72 nameTextBox.Enabled = true; 73 nameTextBox.ReadOnly = ReadOnly; 74 sqlNameTextBox.Enabled = true; 75 sqlNameTextBox.ReadOnly = ReadOnly; 76 platformComboBox.Enabled = true; 77 } 66 nameTextBox.Enabled = Content != null; 67 nameTextBox.ReadOnly = ReadOnly; 68 sqlNameComboBox.Enabled = (Content != null) && !ReadOnly; 69 platformComboBox.Enabled = (Content != null) && !ReadOnly; 78 70 } 79 71 … … 85 77 break; 86 78 case "SqlName": 87 sqlName TextBox.Text = Content.SqlName;79 sqlNameComboBox.Text = Content.SqlName; 88 80 break; 89 81 case "PlatformId": … … 105 97 Content.Name = nameTextBox.Text; 106 98 } 107 private void sqlNameTextBox_KeyDown(object sender, KeyEventArgs e) { 108 if ((e.KeyCode == Keys.Enter) || (e.KeyCode == Keys.Return)) 109 sqlNameLabel.Focus(); // set focus on label to validate data 110 if (e.KeyCode == Keys.Escape) { 111 sqlNameTextBox.Text = Content.SqlName; 112 sqlNameLabel.Focus(); // set focus on label to validate data 99 private void sqlNameComboBox_SelectedValueChanged(object sender, EventArgs e) { 100 if (sqlNameComboBox.Text != Content.SqlName) { 101 Content.SqlName = sqlNameComboBox.Text; 113 102 } 114 }115 private void sqlNameTextBox_TextChanged(object sender, EventArgs e) {116 if (sqlNameTextBox.Text != Content.SqlName)117 Content.SqlName = sqlNameTextBox.Text;118 103 } 119 104 private void platformComboBox_SelectedValueChanged(object sender, System.EventArgs e) { -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/NamedOKBItemView.Designer.cs
r4441 r4492 49 49 this.descriptionLabel = new System.Windows.Forms.Label(); 50 50 this.descriptionTextBox = new System.Windows.Forms.TextBox(); 51 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();52 51 this.SuspendLayout(); 53 52 // … … 55 54 // 56 55 this.toolTip.SetToolTip(this.storeButton, "Store Data"); 57 //58 // modifiedPictureBox59 //60 this.modifiedPictureBox.Location = new System.Drawing.Point(308, 3);61 this.modifiedPictureBox.Size = new System.Drawing.Size(39, 130);62 56 // 63 57 // nameLabel … … 76 70 this.nameTextBox.Location = new System.Drawing.Point(72, 29); 77 71 this.nameTextBox.Name = "nameTextBox"; 78 this.nameTextBox.Size = new System.Drawing.Size(2 30, 20);72 this.nameTextBox.Size = new System.Drawing.Size(278, 20); 79 73 this.nameTextBox.TabIndex = 2; 80 74 this.nameTextBox.TextChanged += new System.EventHandler(this.nameTextBox_TextChanged); … … 97 91 this.descriptionTextBox.Name = "descriptionTextBox"; 98 92 this.descriptionTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 99 this.descriptionTextBox.Size = new System.Drawing.Size(2 30, 20);93 this.descriptionTextBox.Size = new System.Drawing.Size(278, 20); 100 94 this.descriptionTextBox.TabIndex = 4; 101 95 this.descriptionTextBox.TextChanged += new System.EventHandler(this.descriptionTextBox_TextChanged); … … 111 105 this.Controls.Add(this.nameTextBox); 112 106 this.Name = "NamedOKBItemView"; 113 this.Size = new System.Drawing.Size(350, 229); 114 this.Controls.SetChildIndex(this.modifiedPictureBox, 0); 107 this.Size = new System.Drawing.Size(350, 93); 115 108 this.Controls.SetChildIndex(this.storeButton, 0); 116 109 this.Controls.SetChildIndex(this.nameTextBox, 0); … … 118 111 this.Controls.SetChildIndex(this.descriptionLabel, 0); 119 112 this.Controls.SetChildIndex(this.descriptionTextBox, 0); 120 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();121 113 this.ResumeLayout(false); 122 114 this.PerformLayout(); -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/NamedOKBItemView.cs
r4456 r4492 60 60 protected override void SetEnabledStateOfControls() { 61 61 base.SetEnabledStateOfControls(); 62 if (Content == null) { 63 nameTextBox.Enabled = false; 64 descriptionTextBox.Enabled = false; 65 } else { 66 nameTextBox.Enabled = true; 67 nameTextBox.ReadOnly = ReadOnly; 68 descriptionTextBox.Enabled = true; 69 descriptionTextBox.ReadOnly = ReadOnly; 70 } 62 nameTextBox.Enabled = Content != null; 63 nameTextBox.ReadOnly = ReadOnly; 64 descriptionTextBox.Enabled = Content != null; 65 descriptionTextBox.ReadOnly = ReadOnly; 71 66 } 72 67 -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBItemView.Designer.cs
r4441 r4492 48 48 this.storeButton = new System.Windows.Forms.Button(); 49 49 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 50 this.modifiedPictureBox = new System.Windows.Forms.PictureBox();51 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).BeginInit();52 50 this.SuspendLayout(); 53 51 // … … 63 61 this.storeButton.Click += new System.EventHandler(this.storeButton_Click); 64 62 // 65 // modifiedPictureBox66 //67 this.modifiedPictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));68 this.modifiedPictureBox.Image = HeuristicLab.Common.Resources.VS2008ImageLibrary.HighPriorityLarge;69 this.modifiedPictureBox.Location = new System.Drawing.Point(312, 3);70 this.modifiedPictureBox.Name = "modifiedPictureBox";71 this.modifiedPictureBox.Size = new System.Drawing.Size(39, 130);72 this.modifiedPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;73 this.modifiedPictureBox.TabIndex = 1;74 this.modifiedPictureBox.TabStop = false;75 this.toolTip.SetToolTip(this.modifiedPictureBox, "Data Modified");76 this.modifiedPictureBox.Visible = false;77 //78 63 // OKBItemView 79 64 // 80 65 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 81 66 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 82 this.Controls.Add(this.modifiedPictureBox);83 67 this.Controls.Add(this.storeButton); 84 68 this.Name = "OKBItemView"; 85 69 this.Size = new System.Drawing.Size(354, 308); 86 ((System.ComponentModel.ISupportInitialize)(this.modifiedPictureBox)).EndInit();87 70 this.ResumeLayout(false); 88 71 … … 93 76 protected System.Windows.Forms.Button storeButton; 94 77 protected System.Windows.Forms.ToolTip toolTip; 95 protected System.Windows.Forms.PictureBox modifiedPictureBox;96 78 97 79 -
branches/OKB/HeuristicLab.Clients.OKB-3.3/Views/OKBItemView.cs
r4441 r4492 54 54 protected override void SetEnabledStateOfControls() { 55 55 base.SetEnabledStateOfControls(); 56 storeButton.Enabled = (Content != null) && Content.Modified; 57 modifiedPictureBox.Visible = (Content != null) && Content.Modified; 56 storeButton.Enabled = (Content != null) && !ReadOnly && Content.Modified; 58 57 } 59 58 … … 69 68 if (InvokeRequired) 70 69 Invoke(new EventHandler(Content_ModifiedChanged), sender, e); 71 else { 72 storeButton.Enabled = Content.Modified; 73 modifiedPictureBox.Visible = Content.Modified; 74 } 70 else 71 SetEnabledStateOfControls(); 75 72 } 76 73
Note: See TracChangeset
for help on using the changeset viewer.