[Simulator.cs]

* Changed simulator.AvatarPositions from Dictionary to InternalDictionary
* Resolves LIBOMV-450 by removing simulator.PositionIndexYou and .PositionIndexPrey in favor of Client.Self.AgentID and simulator.PreyID for indexing AvatarPositions
[InternalDictionary.cs]
* Added lock to .TryGetValue
* Added .FindAll overload for using a key as the predicate instead of value
[OpenMetaverse.GUI]
* Visual and functional enhancements to Minimap and AvatarList (takes advantage of new AvatarPositions code)
* Added failed login retry dialog to Dashboard
* Added more documentation to public classes

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2549 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
2009-03-27 18:29:32 +00:00
parent ecbfb4b1f9
commit 154d2ef319
8 changed files with 483 additions and 183 deletions

View File

@@ -36,13 +36,13 @@ namespace Dashboard
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.localChat1 = new OpenMetaverse.GUI.LocalChat();
this.statusOutput1 = new OpenMetaverse.GUI.StatusOutput();
this.avatarList1 = new OpenMetaverse.GUI.AvatarList();
this.friendsList1 = new OpenMetaverse.GUI.FriendList();
this.groupList1 = new OpenMetaverse.GUI.GroupList();
this.inventoryTree1 = new OpenMetaverse.GUI.InventoryTree();
this.miniMap1 = new OpenMetaverse.GUI.MiniMap();
this.localChat1 = new OpenMetaverse.GUI.LocalChat();
this.statusOutput1 = new OpenMetaverse.GUI.StatusOutput();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@@ -143,7 +143,7 @@ namespace Dashboard
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(202, 194);
this.tabPage2.Size = new System.Drawing.Size(202, 199);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Friends";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -153,7 +153,7 @@ namespace Dashboard
this.tabPage3.Controls.Add(this.groupList1);
this.tabPage3.Location = new System.Drawing.Point(4, 22);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(202, 194);
this.tabPage3.Size = new System.Drawing.Size(202, 199);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Groups";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -163,66 +163,11 @@ namespace Dashboard
this.tabPage4.Controls.Add(this.inventoryTree1);
this.tabPage4.Location = new System.Drawing.Point(4, 22);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Size = new System.Drawing.Size(202, 194);
this.tabPage4.Size = new System.Drawing.Size(202, 199);
this.tabPage4.TabIndex = 3;
this.tabPage4.Text = "Inventory";
this.tabPage4.UseVisualStyleBackColor = true;
//
// avatarList1
//
this.avatarList1.Client = null;
this.avatarList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.avatarList1.Location = new System.Drawing.Point(3, 3);
this.avatarList1.Name = "avatarList1";
this.avatarList1.Size = new System.Drawing.Size(196, 193);
this.avatarList1.TabIndex = 2;
this.avatarList1.UseCompatibleStateImageBehavior = false;
this.avatarList1.View = System.Windows.Forms.View.Details;
//
// friendsList1
//
this.friendsList1.Client = null;
this.friendsList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.friendsList1.Location = new System.Drawing.Point(3, 3);
this.friendsList1.Name = "friendsList1";
this.friendsList1.Size = new System.Drawing.Size(196, 188);
this.friendsList1.TabIndex = 5;
this.friendsList1.UseCompatibleStateImageBehavior = false;
this.friendsList1.View = System.Windows.Forms.View.Details;
//
// groupList1
//
this.groupList1.Client = null;
this.groupList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupList1.Location = new System.Drawing.Point(0, 0);
this.groupList1.Name = "groupList1";
this.groupList1.Size = new System.Drawing.Size(202, 194);
this.groupList1.TabIndex = 7;
this.groupList1.UseCompatibleStateImageBehavior = false;
this.groupList1.View = System.Windows.Forms.View.Details;
//
// inventoryTree1
//
this.inventoryTree1.Client = null;
this.inventoryTree1.Dock = System.Windows.Forms.DockStyle.Fill;
this.inventoryTree1.Location = new System.Drawing.Point(0, 0);
this.inventoryTree1.Name = "inventoryTree1";
this.inventoryTree1.Size = new System.Drawing.Size(202, 194);
this.inventoryTree1.TabIndex = 1;
//
// miniMap1
//
this.miniMap1.BackColor = System.Drawing.SystemColors.Control;
this.miniMap1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.miniMap1.Client = null;
this.miniMap1.Dock = System.Windows.Forms.DockStyle.Fill;
this.miniMap1.Location = new System.Drawing.Point(0, 0);
this.miniMap1.Name = "miniMap1";
this.miniMap1.Size = new System.Drawing.Size(210, 214);
this.miniMap1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.miniMap1.TabIndex = 11;
this.miniMap1.TabStop = false;
//
// localChat1
//
this.localChat1.Client = null;
@@ -244,6 +189,61 @@ namespace Dashboard
this.statusOutput1.TabIndex = 0;
this.statusOutput1.Text = "";
//
// avatarList1
//
this.avatarList1.Client = null;
this.avatarList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.avatarList1.Location = new System.Drawing.Point(3, 3);
this.avatarList1.Name = "avatarList1";
this.avatarList1.Size = new System.Drawing.Size(196, 193);
this.avatarList1.TabIndex = 2;
this.avatarList1.UseCompatibleStateImageBehavior = false;
this.avatarList1.View = System.Windows.Forms.View.Details;
//
// friendsList1
//
this.friendsList1.Client = null;
this.friendsList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.friendsList1.Location = new System.Drawing.Point(3, 3);
this.friendsList1.Name = "friendsList1";
this.friendsList1.Size = new System.Drawing.Size(196, 193);
this.friendsList1.TabIndex = 5;
this.friendsList1.UseCompatibleStateImageBehavior = false;
this.friendsList1.View = System.Windows.Forms.View.Details;
//
// groupList1
//
this.groupList1.Client = null;
this.groupList1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupList1.Location = new System.Drawing.Point(0, 0);
this.groupList1.Name = "groupList1";
this.groupList1.Size = new System.Drawing.Size(202, 199);
this.groupList1.TabIndex = 7;
this.groupList1.UseCompatibleStateImageBehavior = false;
this.groupList1.View = System.Windows.Forms.View.Details;
//
// inventoryTree1
//
this.inventoryTree1.Client = null;
this.inventoryTree1.Dock = System.Windows.Forms.DockStyle.Fill;
this.inventoryTree1.Location = new System.Drawing.Point(0, 0);
this.inventoryTree1.Name = "inventoryTree1";
this.inventoryTree1.Size = new System.Drawing.Size(202, 199);
this.inventoryTree1.TabIndex = 1;
//
// miniMap1
//
this.miniMap1.BackColor = System.Drawing.SystemColors.Control;
this.miniMap1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.miniMap1.Client = null;
this.miniMap1.Dock = System.Windows.Forms.DockStyle.Fill;
this.miniMap1.Location = new System.Drawing.Point(0, 0);
this.miniMap1.Name = "miniMap1";
this.miniMap1.Size = new System.Drawing.Size(210, 214);
this.miniMap1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.miniMap1.TabIndex = 11;
this.miniMap1.TabStop = false;
//
// Dashboard
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@@ -12,6 +12,7 @@ namespace Dashboard
{
GridClient Client;
LoginParams ClientLogin;
/// <summary>
/// Provides a full representation of OpenMetaverse.GUI
@@ -26,11 +27,36 @@ namespace Dashboard
//force logout and exit when form is closed
this.FormClosing += new FormClosingEventHandler(Dashboard_FormClosing);
//initialize the client object and related controls
InitializeClient(true);
//double-click events
avatarList1.OnAvatarDoubleClick += new AvatarList.AvatarDoubleClickCallback(avatarList1_OnAvatarDoubleClick);
friendsList1.OnFriendDoubleClick += new FriendList.FriendDoubleClickCallback(friendsList1_OnFriendDoubleClick);
groupList1.OnGroupDoubleClick += new GroupList.GroupDoubleClickCallback(groupList1_OnGroupDoubleClick);
//login
ClientLogin = Client.Network.DefaultLoginParams(firstName, lastName, password, "OpenMetaverse Dashboard", Assembly.GetExecutingAssembly().GetName().Version.ToString());
ClientLogin.Start = "last";
Client.Network.BeginLogin(ClientLogin);
}
private void InitializeClient(bool initialize)
{
if (Client != null)
{
if (Client.Network.Connected)
Client.Network.Logout();
Client = null;
}
if (!initialize) return;
//initialize client object
Client = new GridClient();
Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin);
Client.Settings.USE_TEXTURE_CACHE = true;
LoginParams ClientLogin = Client.Network.DefaultLoginParams(firstName, lastName, password, "OpenMetaverse Dashboard", Assembly.GetExecutingAssembly().GetName().Version.ToString());
ClientLogin.Start = "last";
//define the client object for each GUI element
avatarList1.Client = Client;
@@ -40,26 +66,17 @@ namespace Dashboard
localChat1.Client = Client;
miniMap1.Client = Client;
statusOutput1.Client = Client;
//double-click events
avatarList1.OnAvatarDoubleClick += new AvatarList.AvatarDoubleClickCallback(avatarList1_OnAvatarDoubleClick);
friendsList1.OnFriendDoubleClick += new FriendList.FriendDoubleClickCallback(friendsList1_OnFriendDoubleClick);
groupList1.OnGroupDoubleClick += new GroupList.GroupDoubleClickCallback(groupList1_OnGroupDoubleClick);
//login
Client.Network.BeginLogin(ClientLogin);
}
private void Dashboard_FormClosing(object sender, FormClosingEventArgs e)
{
e.Cancel = true;
if (Client != null && Client.Network.Connected) Client.Network.Logout();
InitializeClient(false);
Environment.Exit(0);
}
private void avatarList1_OnAvatarDoubleClick(Avatar avatar)
private void avatarList1_OnAvatarDoubleClick(TrackedAvatar trackedAvatar)
{
MessageBox.Show(avatar.Name + " = " + avatar.ID);
MessageBox.Show(trackedAvatar.Name + " = " + trackedAvatar.ID);
}
private void friendsList1_OnFriendDoubleClick(FriendInfo friend)
@@ -72,5 +89,20 @@ namespace Dashboard
MessageBox.Show(group.Name + " = " + group.ID);
}
private void Network_OnLogin(LoginStatus login, string message)
{
if (login == LoginStatus.Failed)
{
this.BeginInvoke((MethodInvoker)delegate
{
if (MessageBox.Show(this, "Login failed. Try again?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
{
InitializeClient(true);
Client.Network.BeginLogin(ClientLogin);
}
});
}
}
}
}