Changeset 7381
- Timestamp:
- 01/20/12 13:26:08 (13 years ago)
- Location:
- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Administration/Views
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Administration/Views/ProblemView.Designer.cs
r7331 r7381 34 34 /// </summary> 35 35 private void InitializeComponent() { 36 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ProblemView)); 36 37 this.platformLabel = new System.Windows.Forms.Label(); 37 38 this.platformComboBox = new System.Windows.Forms.ComboBox(); … … 40 41 this.tabControl = new System.Windows.Forms.TabControl(); 41 42 this.usersTabPage = new System.Windows.Forms.TabPage(); 42 this.usersListBox = new System.Windows.Forms.CheckedListBox();43 43 this.storeUsersButton = new System.Windows.Forms.Button(); 44 this. refreshUsersButton = new System.Windows.Forms.Button();44 this.problemUserView = new HeuristicLab.Clients.Access.Views.RefreshableLightweightUserView(); 45 45 this.dataTabPage = new System.Windows.Forms.TabPage(); 46 46 this.noViewAvailableLabel = new System.Windows.Forms.Label(); … … 104 104 this.problemClassLabel.Location = new System.Drawing.Point(3, 111); 105 105 this.problemClassLabel.Name = "problemClassLabel"; 106 this.problemClassLabel.Size = new System.Drawing.Size( 81, 13);106 this.problemClassLabel.Size = new System.Drawing.Size(76, 13); 107 107 this.problemClassLabel.TabIndex = 7; 108 108 this.problemClassLabel.Text = "&Problem Class:"; … … 135 135 // usersTabPage 136 136 // 137 this.usersTabPage.Controls.Add(this.usersListBox);138 137 this.usersTabPage.Controls.Add(this.storeUsersButton); 139 this.usersTabPage.Controls.Add(this. refreshUsersButton);138 this.usersTabPage.Controls.Add(this.problemUserView); 140 139 this.usersTabPage.Location = new System.Drawing.Point(4, 22); 141 140 this.usersTabPage.Name = "usersTabPage"; … … 146 145 this.usersTabPage.UseVisualStyleBackColor = true; 147 146 // 148 // usersListBox149 //150 this.usersListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)151 | System.Windows.Forms.AnchorStyles.Left)152 | System.Windows.Forms.AnchorStyles.Right)));153 this.usersListBox.CheckOnClick = true;154 this.usersListBox.FormattingEnabled = true;155 this.usersListBox.Location = new System.Drawing.Point(6, 35);156 this.usersListBox.Name = "usersListBox";157 this.usersListBox.Size = new System.Drawing.Size(613, 139);158 this.usersListBox.TabIndex = 2;159 this.usersListBox.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.usersListBox_ItemCheck);160 //161 147 // storeUsersButton 162 148 // 163 149 this.storeUsersButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 164 this.storeUsersButton.Location = new System.Drawing.Point(3 6, 6);150 this.storeUsersButton.Location = new System.Drawing.Point(38, 9); 165 151 this.storeUsersButton.Name = "storeUsersButton"; 166 152 this.storeUsersButton.Size = new System.Drawing.Size(24, 24); … … 170 156 this.storeUsersButton.Click += new System.EventHandler(this.storeUsersButton_Click); 171 157 // 172 // refreshUsersButton 173 // 174 this.refreshUsersButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.Refresh; 175 this.refreshUsersButton.Location = new System.Drawing.Point(6, 6); 176 this.refreshUsersButton.Name = "refreshUsersButton"; 177 this.refreshUsersButton.Size = new System.Drawing.Size(24, 24); 178 this.refreshUsersButton.TabIndex = 0; 179 this.toolTip.SetToolTip(this.refreshUsersButton, "Refresh Authorized Users"); 180 this.refreshUsersButton.UseVisualStyleBackColor = true; 181 this.refreshUsersButton.Click += new System.EventHandler(this.refreshUsersButton_Click); 158 // problemUserView 159 // 160 this.problemUserView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 161 | System.Windows.Forms.AnchorStyles.Left) 162 | System.Windows.Forms.AnchorStyles.Right))); 163 this.problemUserView.Caption = "RefreshableLightweightUser View"; 164 this.problemUserView.Content = null; 165 this.problemUserView.FetchSelectedUsers = null; 166 this.problemUserView.Location = new System.Drawing.Point(6, 6); 167 this.problemUserView.Name = "problemUserView"; 168 this.problemUserView.ReadOnly = false; 169 this.problemUserView.Size = new System.Drawing.Size(613, 168); 170 this.problemUserView.TabIndex = 2; 171 this.problemUserView.SelectedUsersChanged += new System.EventHandler(this.problemUserView_SelectedUsersChanged); 182 172 // 183 173 // dataTabPage … … 388 378 private System.Windows.Forms.TabPage usersTabPage; 389 379 private System.Windows.Forms.Button storeUsersButton; 390 private System.Windows.Forms.Button refreshUsersButton;391 380 private System.Windows.Forms.TabPage dataTabPage; 392 private System.Windows.Forms.CheckedListBox usersListBox;393 381 private System.Windows.Forms.Label dataTypeNameLabel; 394 382 private System.Windows.Forms.GroupBox dataTypeGroupBox; … … 405 393 private MainForm.WindowsForms.ViewHost dataViewHost; 406 394 private System.Windows.Forms.Label noViewAvailableLabel; 395 private Access.Views.RefreshableLightweightUserView problemUserView; 407 396 408 397 } -
branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Administration/Views/ProblemView.cs
r7331 r7381 25 25 using System.Linq; 26 26 using System.Windows.Forms; 27 using HeuristicLab.Clients.OKB.Authentication;28 27 using HeuristicLab.Common; 29 28 using HeuristicLab.Core.Views; … … 73 72 problemClassComboBox.SelectedValueChanged += new EventHandler(problemClassComboBox_SelectedValueChanged); 74 73 75 usersListBox.DataSource = null;76 74 data = null; 77 75 dataViewHost.Content = null; … … 81 79 dataTypeNameTextBox.Text = string.Empty; 82 80 dataTypeTypeNameTextBox.Text = string.Empty; 81 problemUserView.Content = null; 82 problemUserView.FetchSelectedUsers = null; 83 83 } else { 84 84 platformComboBox.SelectedItem = platformComboBoxValues.FirstOrDefault(p => p.Id == Content.PlatformId); … … 86 86 dataTypeNameTextBox.Text = Content.DataTypeName; 87 87 dataTypeTypeNameTextBox.Text = Content.DataTypeTypeName; 88 problemUserView.Content = Access.AccessClient.Instance; 89 problemUserView.FetchSelectedUsers = new Func<List<Guid>>(delegate { return AdministrationClient.GetProblemUsers(Content.Id); }); 88 90 } 89 91 } … … 94 96 problemClassComboBox.Enabled = (Content != null) && !ReadOnly; 95 97 dataTypeGroupBox.Enabled = (Content != null) && !ReadOnly; 96 refreshUsersButton.Enabled = (Content != null) && (Content.Id != 0); 97 storeUsersButton.Enabled = (usersListBox.DataSource != null) && !ReadOnly; 98 usersListBox.Enabled = (usersListBox.DataSource != null) && !ReadOnly; 98 problemUserView.Enabled = (problemUserView.Content != null) && !ReadOnly; 99 storeUsersButton.Enabled = (problemUserView.GetCheckedUsers() != null) && !ReadOnly; 99 100 refreshDataButton.Enabled = (Content != null) && (Content.Id != 0); 100 101 storeDataButton.Enabled = ((data != null) || (dataViewHost.Content != null)) && !ReadOnly; … … 155 156 } 156 157 157 private void refreshUsersButton_Click(object sender, System.EventArgs e) {158 try {159 List<Guid> ids = AdministrationClient.GetProblemUsers(Content.Id);160 if (ids != null) {161 if (AuthenticationClient.Instance.Users == null) AuthenticationClient.Instance.Refresh();162 List<User> users = AuthenticationClient.Instance.Users.ToList();163 usersListBox.DataSource = users;164 usersListBox.DisplayMember = "Name";165 for (int i = 0; i < users.Count; i++)166 usersListBox.SetItemChecked(i, ids.Contains(users[i].Id));167 usersListBox.Enabled = !ReadOnly;168 storeUsersButton.Enabled = false;169 }170 }171 catch (Exception ex) {172 ErrorHandling.ShowErrorDialog(this, "Refresh authorized users and groups failed.", ex);173 }174 }175 158 private void storeUsersButton_Click(object sender, System.EventArgs e) { 176 159 try { 177 AdministrationClient.UpdateProblemUsers(Content.Id, usersListBox.SelectedItems.Cast<User>().Select(u => u.Id).ToList());160 AdministrationClient.UpdateProblemUsers(Content.Id, problemUserView.GetCheckedUsers().CheckedItems.Select(x => x.Value.Id).ToList()); 178 161 storeUsersButton.Enabled = false; 179 162 } … … 182 165 } 183 166 } 184 private void usersListBox_ItemCheck(object sender, ItemCheckEventArgs e) {167 private void problemUserView_SelectedUsersChanged(object sender, EventArgs e) { 185 168 storeUsersButton.Enabled = !ReadOnly; 186 169 } 170 187 171 188 172 private void refreshDataButton_Click(object sender, EventArgs e) {
Note: See TracChangeset
for help on using the changeset viewer.