LIBOMV-686 Implements new event patterns based on the Microsoft Framework Design Guidelines in GroupManager
* BREAKING CHANGE * this is a major shift in the way events are internally handled. git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3162 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -36,33 +36,32 @@ namespace OpenMetaverse.TestClient
|
||||
|
||||
GroupUUID = Client.GroupName2UUID(GroupName);
|
||||
if (UUID.Zero != GroupUUID) {
|
||||
GroupManager.GroupRolesCallback callback =
|
||||
new GroupManager.GroupRolesCallback(GroupRolesHandler);
|
||||
Client.Groups.OnGroupRoles += callback;
|
||||
Client.Groups.GroupRoleDataReply += Groups_GroupRoles;
|
||||
GroupRequestID = Client.Groups.RequestGroupRoles(GroupUUID);
|
||||
GroupsEvent.WaitOne(30000, false);
|
||||
GroupsEvent.Reset();
|
||||
Client.Groups.OnGroupRoles -= callback;
|
||||
Client.Groups.GroupRoleDataReply += Groups_GroupRoles;
|
||||
return Client.ToString() + " got group roles";
|
||||
}
|
||||
return Client.ToString() + " doesn't seem to have any roles in the group " + GroupName;
|
||||
}
|
||||
|
||||
private void GroupRolesHandler(UUID requestID, UUID groupID, Dictionary<UUID, GroupRole> roles)
|
||||
void Groups_GroupRoles(object sender, GroupRolesDataReplyEventArgs e)
|
||||
{
|
||||
if (requestID == GroupRequestID) {
|
||||
if (e.RequestID == GroupRequestID)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine();
|
||||
sb.AppendFormat("GroupRole: RequestID {0}", requestID).AppendLine();
|
||||
sb.AppendFormat("GroupRole: RequestID {0}", e.RequestID).AppendLine();
|
||||
sb.AppendFormat("GroupRole: GroupUUID {0}", GroupUUID).AppendLine();
|
||||
sb.AppendFormat("GroupRole: GroupName {0}", GroupName).AppendLine();
|
||||
if (roles.Count > 0)
|
||||
foreach (KeyValuePair<UUID, GroupRole> role in roles)
|
||||
if (e.Roles.Count > 0)
|
||||
foreach (KeyValuePair<UUID, GroupRole> role in e.Roles)
|
||||
sb.AppendFormat("GroupRole: Role {0} {1}|{2}", role.Value.ID, role.Value.Name, role.Value.Title).AppendLine();
|
||||
sb.AppendFormat("GroupRole: RoleCount {0}", roles.Count).AppendLine();
|
||||
sb.AppendFormat("GroupRole: RoleCount {0}", e.Roles.Count).AppendLine();
|
||||
Console.WriteLine(sb.ToString());
|
||||
GroupsEvent.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user