LIBOMV-686 Implements new event patterns based on the Microsoft Framework Design Guidelines in DirectoryManager
* Completes Full documentation of DirectoryManager class * Cleaned up Search Methods in DirectoryManager to be more developer friendly * Adds Several TestClient commands related to DirectoryManager: searchgroups, searchland, searchpeople * Adds a StructToString method to helpers to simplify parsing and printing Structs for debugging purposes * Many other code cleanups * BREAKING - this is a major shift in the way events are internally handled, Take a look at the newly added TestClient commands for example code that implement this pattern. git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3139 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -28,23 +28,24 @@ namespace OpenMetaverse.TestClient.Commands
|
||||
waitQuery.Reset();
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
DirectoryManager.ClassifiedReplyCallback callback = delegate(List<DirectoryManager.Classified> classifieds)
|
||||
|
||||
EventHandler<DirClassifiedsReplyEventArgs> callback = delegate(object sender, DirClassifiedsReplyEventArgs e)
|
||||
{
|
||||
result.AppendFormat("Your search string '{0}' returned {1} classified ads" + System.Environment.NewLine,
|
||||
searchText, classifieds.Count);
|
||||
foreach (DirectoryManager.Classified ad in classifieds)
|
||||
searchText, e.Classifieds.Count);
|
||||
foreach (DirectoryManager.Classified ad in e.Classifieds)
|
||||
{
|
||||
result.AppendLine(ad.ToString());
|
||||
}
|
||||
|
||||
// classifieds are sent 16 ads at a time
|
||||
if (classifieds.Count < 16)
|
||||
if (e.Classifieds.Count < 16)
|
||||
{
|
||||
waitQuery.Set();
|
||||
}
|
||||
};
|
||||
|
||||
Client.Directory.OnClassifiedReply += callback;
|
||||
Client.Directory.DirClassifiedsReply += callback;
|
||||
|
||||
UUID searchID = Client.Directory.StartClassifiedSearch(searchText, DirectoryManager.ClassifiedCategories.Any, DirectoryManager.ClassifiedQueryFlags.Mature | DirectoryManager.ClassifiedQueryFlags.PG);
|
||||
|
||||
@@ -53,9 +54,9 @@ namespace OpenMetaverse.TestClient.Commands
|
||||
result.AppendLine("Timeout waiting for simulator to respond to query.");
|
||||
}
|
||||
|
||||
Client.Directory.OnClassifiedReply -= callback;
|
||||
Client.Directory.DirClassifiedsReply -= callback;
|
||||
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user