diff --git a/OpenMetaverse.GUI/AvatarList.cs b/OpenMetaverse.GUI/AvatarList.cs index 1001649a..bbe56958 100644 --- a/OpenMetaverse.GUI/AvatarList.cs +++ b/OpenMetaverse.GUI/AvatarList.cs @@ -134,15 +134,30 @@ namespace OpenMetaverse.GUI { item = this.Items[avatar.LocalID.ToString()]; item.SubItems[1].Text = (int)Vector3.Distance(_Client.Self.SimPosition, avatar.Position) + "m"; + item.Tag = avatar; } + else { - _Avatars.Add(avatar.LocalID); - string key = avatar.LocalID.ToString(); - item = this.Items.Add(key, avatar.Name, null); - item.SubItems.Add((int)Vector3.Distance(_Client.Self.SimPosition, avatar.Position) + "m"); - } - item.Tag = avatar; + bool replace = false; + for (int i = 0; i < this.Items.Count; i++) + { + if (this.Items[i].Text == avatar.Name) + { + this.Items[i].Name = avatar.LocalID.ToString(); + this.Items[i].Tag = avatar; + replace = true; + } + } + if (!replace) + { + _Avatars.Add(avatar.LocalID); + string key = avatar.LocalID.ToString(); + item = this.Items.Add(key, avatar.Name, null); + item.SubItems.Add((int)Vector3.Distance(_Client.Self.SimPosition, avatar.Position) + "m"); + item.Tag = avatar; + } + } } } } @@ -177,10 +192,7 @@ namespace OpenMetaverse.GUI private void Objects_OnNewAvatar(Simulator simulator, Avatar avatar, ulong regionHandle, ushort timeDilation) { - lock (_Avatars) - { - if (!_Avatars.Contains(avatar.LocalID)) UpdateAvatar(avatar); - } + UpdateAvatar(avatar); } private void Objects_OnObjectKilled(Simulator simulator, uint objectID) diff --git a/Programs/examples/Dashboard/Dashboard.Designer.cs b/Programs/examples/Dashboard/Dashboard.Designer.cs index 812a5e80..031067f3 100644 --- a/Programs/examples/Dashboard/Dashboard.Designer.cs +++ b/Programs/examples/Dashboard/Dashboard.Designer.cs @@ -29,22 +29,26 @@ namespace Dashboard private void InitializeComponent() { this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.splitContainer3 = new System.Windows.Forms.SplitContainer(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage4 = new System.Windows.Forms.TabPage(); - this.txtStatus = new System.Windows.Forms.Label(); - this.localChat1 = new OpenMetaverse.GUI.LocalChat(); 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(); + this.splitContainer3.Panel1.SuspendLayout(); + this.splitContainer3.Panel2.SuspendLayout(); + this.splitContainer3.SuspendLayout(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); @@ -58,23 +62,39 @@ namespace Dashboard // // splitContainer1 // - this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.splitContainer1.Location = new System.Drawing.Point(2, 3); + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Name = "splitContainer1"; // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.localChat1); + this.splitContainer1.Panel1.Controls.Add(this.splitContainer3); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Size = new System.Drawing.Size(627, 419); - this.splitContainer1.SplitterDistance = 415; + this.splitContainer1.Size = new System.Drawing.Size(632, 443); + this.splitContainer1.SplitterDistance = 418; this.splitContainer1.TabIndex = 4; // + // splitContainer3 + // + this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer3.Location = new System.Drawing.Point(0, 0); + this.splitContainer3.Name = "splitContainer3"; + this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer3.Panel1 + // + this.splitContainer3.Panel1.Controls.Add(this.localChat1); + // + // splitContainer3.Panel2 + // + this.splitContainer3.Panel2.Controls.Add(this.statusOutput1); + this.splitContainer3.Size = new System.Drawing.Size(418, 443); + this.splitContainer3.SplitterDistance = 335; + this.splitContainer3.TabIndex = 0; + // // splitContainer2 // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; @@ -89,8 +109,8 @@ namespace Dashboard // splitContainer2.Panel2 // this.splitContainer2.Panel2.Controls.Add(this.miniMap1); - this.splitContainer2.Size = new System.Drawing.Size(208, 419); - this.splitContainer2.SplitterDistance = 209; + this.splitContainer2.Size = new System.Drawing.Size(210, 443); + this.splitContainer2.SplitterDistance = 225; this.splitContainer2.TabIndex = 9; // // tabControl1 @@ -103,7 +123,7 @@ namespace Dashboard this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(208, 209); + this.tabControl1.Size = new System.Drawing.Size(210, 225); this.tabControl1.TabIndex = 1; // // tabPage1 @@ -112,7 +132,7 @@ namespace Dashboard this.tabPage1.Location = new System.Drawing.Point(4, 22); this.tabPage1.Name = "tabPage1"; this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(200, 183); + this.tabPage1.Size = new System.Drawing.Size(202, 199); this.tabPage1.TabIndex = 0; this.tabPage1.Text = "Nearby"; this.tabPage1.UseVisualStyleBackColor = true; @@ -123,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(200, 183); + this.tabPage2.Size = new System.Drawing.Size(202, 194); this.tabPage2.TabIndex = 1; this.tabPage2.Text = "Friends"; this.tabPage2.UseVisualStyleBackColor = true; @@ -133,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(200, 183); + this.tabPage3.Size = new System.Drawing.Size(202, 194); this.tabPage3.TabIndex = 2; this.tabPage3.Text = "Groups"; this.tabPage3.UseVisualStyleBackColor = true; @@ -143,38 +163,18 @@ 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(200, 183); + this.tabPage4.Size = new System.Drawing.Size(202, 194); this.tabPage4.TabIndex = 3; this.tabPage4.Text = "Inventory"; this.tabPage4.UseVisualStyleBackColor = true; // - // txtStatus - // - this.txtStatus.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtStatus.AutoEllipsis = true; - this.txtStatus.Location = new System.Drawing.Point(10, 426); - this.txtStatus.Name = "txtStatus"; - this.txtStatus.Size = new System.Drawing.Size(611, 13); - this.txtStatus.TabIndex = 5; - this.txtStatus.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // localChat1 - // - this.localChat1.Client = null; - this.localChat1.Dock = System.Windows.Forms.DockStyle.Fill; - this.localChat1.Location = new System.Drawing.Point(0, 0); - this.localChat1.Name = "localChat1"; - this.localChat1.Size = new System.Drawing.Size(415, 419); - this.localChat1.TabIndex = 3; - // // 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(194, 177); + 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; @@ -185,7 +185,7 @@ namespace Dashboard 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(194, 177); + 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; @@ -196,7 +196,7 @@ namespace Dashboard 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(200, 183); + 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; @@ -207,7 +207,7 @@ namespace Dashboard 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(200, 183); + this.inventoryTree1.Size = new System.Drawing.Size(202, 194); this.inventoryTree1.TabIndex = 1; // // miniMap1 @@ -218,23 +218,46 @@ namespace Dashboard 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(208, 206); + 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; + this.localChat1.Dock = System.Windows.Forms.DockStyle.Fill; + this.localChat1.Location = new System.Drawing.Point(0, 0); + this.localChat1.Name = "localChat1"; + this.localChat1.Size = new System.Drawing.Size(418, 335); + this.localChat1.TabIndex = 4; + // + // statusOutput1 + // + this.statusOutput1.BackColor = System.Drawing.Color.White; + this.statusOutput1.Client = null; + this.statusOutput1.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusOutput1.Location = new System.Drawing.Point(0, 0); + this.statusOutput1.Name = "statusOutput1"; + this.statusOutput1.ReadOnly = true; + this.statusOutput1.Size = new System.Drawing.Size(418, 104); + this.statusOutput1.TabIndex = 0; + this.statusOutput1.Text = ""; + // // Dashboard // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(632, 443); - this.Controls.Add(this.txtStatus); this.Controls.Add(this.splitContainer1); this.Name = "Dashboard"; this.Text = "Dashboard"; this.splitContainer1.Panel1.ResumeLayout(false); this.splitContainer1.Panel2.ResumeLayout(false); this.splitContainer1.ResumeLayout(false); + this.splitContainer3.Panel1.ResumeLayout(false); + this.splitContainer3.Panel2.ResumeLayout(false); + this.splitContainer3.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel2.ResumeLayout(false); this.splitContainer2.ResumeLayout(false); @@ -251,7 +274,6 @@ namespace Dashboard #endregion private System.Windows.Forms.SplitContainer splitContainer1; - private OpenMetaverse.GUI.LocalChat localChat1; private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.TabControl tabControl1; private System.Windows.Forms.TabPage tabPage1; @@ -263,7 +285,9 @@ namespace Dashboard private System.Windows.Forms.TabPage tabPage4; private OpenMetaverse.GUI.InventoryTree inventoryTree1; private OpenMetaverse.GUI.MiniMap miniMap1; - private System.Windows.Forms.Label txtStatus; + private System.Windows.Forms.SplitContainer splitContainer3; + private OpenMetaverse.GUI.LocalChat localChat1; + private OpenMetaverse.GUI.StatusOutput statusOutput1; } } diff --git a/Programs/examples/Dashboard/Dashboard.cs b/Programs/examples/Dashboard/Dashboard.cs index a85b6245..5f72d1fa 100644 --- a/Programs/examples/Dashboard/Dashboard.cs +++ b/Programs/examples/Dashboard/Dashboard.cs @@ -29,7 +29,6 @@ namespace Dashboard //initialize client object Client = new GridClient(); Client.Settings.USE_TEXTURE_CACHE = true; - Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin); LoginParams ClientLogin = Client.Network.DefaultLoginParams(firstName, lastName, password, "OpenMetaverse Dashboard", Assembly.GetExecutingAssembly().GetName().Version.ToString()); ClientLogin.Start = "last"; @@ -40,6 +39,7 @@ namespace Dashboard inventoryTree1.Client = Client; localChat1.Client = Client; miniMap1.Client = Client; + statusOutput1.Client = Client; //double-click events avatarList1.OnAvatarDoubleClick += new AvatarList.AvatarDoubleClickCallback(avatarList1_OnAvatarDoubleClick); @@ -50,12 +50,6 @@ namespace Dashboard Client.Network.BeginLogin(ClientLogin); } - private void SetLabelText(Label label, string text) - { - if (this.InvokeRequired) this.BeginInvoke((MethodInvoker)delegate { SetLabelText(label, text); }); - else { label.Text = text; } - } - private void Dashboard_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; @@ -63,11 +57,6 @@ namespace Dashboard Environment.Exit(0); } - private void Network_OnLogin(LoginStatus login, string message) - { - SetLabelText(txtStatus, message); - } - private void avatarList1_OnAvatarDoubleClick(Avatar avatar) { MessageBox.Show(avatar.Name + " = " + avatar.ID);