- Timestamp:
- 03/19/12 21:15:33 (13 years ago)
- Location:
- branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/AccessAdministrationClient.cs
r7635 r7637 67 67 ExecuteActionAsync(RefreshUserGroups, exceptionCallback); 68 68 } 69 #endregion 70 71 #region Store 72 public void StoreUsers() { 73 foreach (User u in users) { 74 if (u.Modified) { 75 if (u.Id == Guid.Empty) { 76 CallAccessService(s => u.Id = s.AddUser(u).Id); 77 } else { 78 CallAccessService(s => s.UpdateUser(u)); 79 } 80 u.SetUnmodified(); 81 } 82 } 83 } 84 85 public void StoreUsersAsync(Action<Exception> exceptionCallback) { 86 ExecuteActionAsync(StoreUsers, exceptionCallback); 87 } 88 89 public void StoreUserGroups() { 90 foreach (UserGroup g in Groups) { 91 if (g.Modified) { 92 if (g.Id == Guid.Empty) { 93 CallAccessService(s => g.Id = s.AddUserGroup(g)); 94 } else { 95 CallAccessService(s => s.UpdateUserGroup(g)); 96 } 97 g.SetUnmodified(); 98 } 99 } 100 } 101 102 public void StoreUserGroupsAsync(Action<Exception> exceptionCallback) { 103 ExecuteActionAsync(StoreUserGroups, exceptionCallback); 104 } 105 106 //i don't think such a generic method is a good idea 107 /*public static void Store(IAccessItem item) { 108 109 } */ 110 #endregion 111 112 #region Delete 113 public void DeleteUser(User u) { 114 CallAccessService(s => s.DeleteUser(u)); 115 } 116 117 public void DeleteUserAsync(User u, Action<Exception> exceptionCallback) { 118 Action deleteUserAction = new Action(delegate { DeleteUser(u); }); 119 ExecuteActionAsync(deleteUserAction, exceptionCallback); 120 } 121 122 public void DeleteUserGroup(UserGroup u) { 123 CallAccessService(s => s.DeleteUserGroup(u)); 124 } 125 126 public void DeleteUserGroupAsync(UserGroup u, Action<Exception> exceptionCallback) { 127 Action deleteUserGroupAction = new Action(delegate { DeleteUserGroup(u); }); 128 ExecuteActionAsync(deleteUserGroupAction, exceptionCallback); 129 } 130 #endregion 69 131 70 132 public void ExecuteActionAsync(Action action, Action<Exception> exceptionCallback) { … … 86 148 if (ex != null) exceptionCallback(ex); 87 149 }, null); 88 }89 #endregion90 91 public static void Store(IAccessItem item) {92 //TODO: storing93 150 } 94 151 -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/RefreshableUserGroupListView.Designer.cs
r7635 r7637 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RefreshableUserGroupListView)); 26 27 this.userGroupListView = new HeuristicLab.Clients.Access.Administration.UserGroupListView(); 28 this.storeButton = new System.Windows.Forms.Button(); 27 29 this.SuspendLayout(); 28 30 // 29 31 // userGroupListView 30 32 // 31 this.userGroupListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 32 | System.Windows.Forms.AnchorStyles.Left) 33 this.userGroupListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 34 | System.Windows.Forms.AnchorStyles.Left) 33 35 | System.Windows.Forms.AnchorStyles.Right))); 34 36 this.userGroupListView.Caption = "UserGroupList View"; … … 40 42 this.userGroupListView.TabIndex = 2; 41 43 // 44 // storeButton 45 // 46 this.storeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 47 this.storeButton.Location = new System.Drawing.Point(33, 3); 48 this.storeButton.Name = "storeButton"; 49 this.storeButton.Size = new System.Drawing.Size(24, 24); 50 this.storeButton.TabIndex = 4; 51 this.storeButton.UseVisualStyleBackColor = true; 52 this.storeButton.Click += new System.EventHandler(this.storeButton_Click); 53 // 42 54 // RefreshableUserGroupListView 43 55 // 44 56 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 45 57 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 58 this.Controls.Add(this.storeButton); 46 59 this.Controls.Add(this.userGroupListView); 47 60 this.Name = "RefreshableUserGroupListView"; … … 49 62 this.Controls.SetChildIndex(this.userGroupListView, 0); 50 63 this.Controls.SetChildIndex(this.refreshButton, 0); 64 this.Controls.SetChildIndex(this.storeButton, 0); 51 65 this.ResumeLayout(false); 52 66 … … 56 70 57 71 private UserGroupListView userGroupListView; 72 private System.Windows.Forms.Button storeButton; 58 73 59 74 } -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/RefreshableUserGroupListView.cs
r7635 r7637 37 37 base.Content_Refreshing(sender, e); 38 38 userGroupListView.Enabled = false; 39 if (Content.Groups != null) { 40 Content.Groups.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<UserGroup>>(Groups_ItemsRemoved); 41 } 39 42 } 40 43 } … … 47 50 userGroupListView.Enabled = true; 48 51 userGroupListView.Content = Content.Groups; 52 if (Content.Groups != null) { 53 Content.Groups.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<UserGroup>>(Groups_ItemsRemoved); 54 } 49 55 } 56 } 57 58 void Groups_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<UserGroup>> e) { 59 foreach (var u in e.Items) { 60 Content.DeleteUserGroupAsync(u.Value, PluginInfrastructure.ErrorHandling.ShowErrorDialog); 61 } 62 } 63 64 protected override void DeregisterContentEvents() { 65 if (Content.Groups != null) { 66 Content.Groups.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<UserGroup>>(Groups_ItemsRemoved); 67 } 68 base.DeregisterContentEvents(); 69 } 70 71 private void storeButton_Click(object sender, EventArgs e) { 72 Content.StoreUserGroupsAsync(PluginInfrastructure.ErrorHandling.ShowErrorDialog); 50 73 } 51 74 } -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/RefreshableUserListView.Designer.cs
r7614 r7637 25 25 private void InitializeComponent() { 26 26 this.userListView = new HeuristicLab.Clients.Access.Administration.UserListView(); 27 this.storeButton = new System.Windows.Forms.Button(); 27 28 this.SuspendLayout(); 28 29 // … … 30 31 // 31 32 this.userListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 32 33 33 | System.Windows.Forms.AnchorStyles.Left) 34 | System.Windows.Forms.AnchorStyles.Right))); 34 35 this.userListView.Caption = "UserList View"; 35 36 this.userListView.Content = null; … … 40 41 this.userListView.TabIndex = 2; 41 42 // 43 // storeButton 44 // 45 this.storeButton.Location = new System.Drawing.Point(33, 3); 46 this.storeButton.Image = HeuristicLab.Common.Resources.VSImageLibrary.PublishToWeb; 47 this.storeButton.Name = "storeButton"; 48 this.storeButton.Size = new System.Drawing.Size(24, 24); 49 this.storeButton.TabIndex = 3; 50 this.storeButton.UseVisualStyleBackColor = true; 51 this.storeButton.Click += new System.EventHandler(this.storeButton_Click); 52 // 42 53 // RefreshableUserListView 43 54 // … … 45 56 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 46 57 this.Controls.Add(this.userListView); 58 this.Controls.Add(this.storeButton); 47 59 this.Name = "RefreshableUserListView"; 48 60 this.Size = new System.Drawing.Size(565, 411); 61 this.Controls.SetChildIndex(this.storeButton, 0); 49 62 this.Controls.SetChildIndex(this.userListView, 0); 50 63 this.Controls.SetChildIndex(this.refreshButton, 0); … … 56 69 57 70 private UserListView userListView; 71 private System.Windows.Forms.Button storeButton; 58 72 } 59 73 } -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/RefreshableUserListView.cs
r7635 r7637 37 37 base.Content_Refreshing(sender, e); 38 38 userListView.Enabled = false; 39 if (Content.Users != null) { 40 Content.Users.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<User>>(Users_ItemsRemoved); 41 } 39 42 } 40 43 } … … 47 50 userListView.Enabled = true; 48 51 userListView.Content = Content.Users; 52 if (Content.Users != null) { 53 Content.Users.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<User>>(Users_ItemsRemoved); 54 } 49 55 } 56 } 57 58 protected override void DeregisterContentEvents() { 59 if (Content.Users != null) { 60 Content.Users.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<User>>(Users_ItemsRemoved); 61 } 62 base.DeregisterContentEvents(); 63 } 64 65 void Users_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<User>> e) { 66 foreach (var u in e.Items) { 67 Content.DeleteUserAsync(u.Value, PluginInfrastructure.ErrorHandling.ShowErrorDialog); 68 } 69 } 70 71 private void storeButton_Click(object sender, EventArgs e) { 72 Content.StoreUsersAsync(PluginInfrastructure.ErrorHandling.ShowErrorDialog); 50 73 } 51 74 } -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.Designer.cs
r7635 r7637 56 56 this.groupNameTextBox.Size = new System.Drawing.Size(282, 20); 57 57 this.groupNameTextBox.TabIndex = 2; 58 this.groupNameTextBox.TextChanged += new System.EventHandler(this.groupNameTextBox_TextChanged); 58 59 // 59 60 // idTextBox … … 61 62 this.idTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 62 63 | System.Windows.Forms.AnchorStyles.Right))); 64 this.idTextBox.Enabled = false; 63 65 this.idTextBox.Location = new System.Drawing.Point(79, 29); 64 66 this.idTextBox.Name = "idTextBox"; -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserGroupView.cs
r7635 r7637 47 47 } 48 48 } 49 50 private void groupNameTextBox_TextChanged(object sender, System.EventArgs e) { 51 if (Content.Name != this.groupNameTextBox.Text) 52 Content.Name = this.groupNameTextBox.Text; 53 } 49 54 } 50 55 } -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserView.Designer.cs
r7614 r7637 50 50 // userNameTextBox 51 51 // 52 this.userNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 53 | System.Windows.Forms.AnchorStyles.Right))); 52 this.userNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 53 | System.Windows.Forms.AnchorStyles.Right))); 54 this.userNameTextBox.Enabled = false; 54 55 this.userNameTextBox.Location = new System.Drawing.Point(72, 3); 55 56 this.userNameTextBox.Name = "userNameTextBox"; 56 57 this.userNameTextBox.Size = new System.Drawing.Size(289, 20); 57 58 this.userNameTextBox.TabIndex = 2; 59 this.userNameTextBox.TextChanged += new System.EventHandler(this.userNameTextBox_TextChanged); 58 60 // 59 61 // fullNameTextBox 60 62 // 61 this.fullNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 62 63 this.fullNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 64 | System.Windows.Forms.AnchorStyles.Right))); 63 65 this.fullNameTextBox.Location = new System.Drawing.Point(72, 29); 64 66 this.fullNameTextBox.Name = "fullNameTextBox"; 65 67 this.fullNameTextBox.Size = new System.Drawing.Size(289, 20); 66 68 this.fullNameTextBox.TabIndex = 3; 69 this.fullNameTextBox.TextChanged += new System.EventHandler(this.fullNameTextBox_TextChanged); 67 70 // 68 71 // UserView -
branches/ClientUserManagement/HeuristicLab.Clients.Access.Administration/3.3/Views/UserView.cs
r7614 r7637 47 47 } 48 48 } 49 50 private void fullNameTextBox_TextChanged(object sender, System.EventArgs e) { 51 if (Content.FullName != fullNameTextBox.Text) 52 Content.FullName = fullNameTextBox.Text; 53 } 54 55 private void userNameTextBox_TextChanged(object sender, System.EventArgs e) { 56 if (Content.UserName != userNameTextBox.Text) 57 Content.UserName = userNameTextBox.Text; 58 } 49 59 } 50 60 }
Note: See TracChangeset
for help on using the changeset viewer.