OSDN Git Service

RAD-72: Add ability to see other people's groups on the profile page
authorLatif Khalifa <latifer@streamgrid.net>
Fri, 6 Nov 2009 12:15:55 +0000 (12:15 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Fri, 6 Nov 2009 12:15:55 +0000 (12:15 +0000)
git-svn-id: https://radegast.googlecode.com/svn/trunk@427 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/GUI/Consoles/GroupDetails.cs
Radegast/GUI/Dialogs/MainForm.cs
Radegast/GUI/Dialogs/Profile.Designer.cs
Radegast/GUI/Dialogs/Profile.cs

index 8316d7c..5954766 100644 (file)
@@ -301,7 +301,10 @@ namespace Radegast
                 item.Tag = member;\r
                 item.Name = member.Base.ID.ToString();\r
                 item.SubItems.Add(new ListViewItem.ListViewSubItem(item, member.Base.Title));\r
-                item.SubItems.Add(new ListViewItem.ListViewSubItem(item, member.Base.OnlineStatus));\r
+                if (member.LastOnline != DateTime.MinValue)\r
+                {\r
+                    item.SubItems.Add(new ListViewItem.ListViewSubItem(item, member.Base.OnlineStatus));\r
+                }\r
 \r
                 newItems.Add(item);\r
             }\r
@@ -516,7 +519,7 @@ namespace Radegast
             {\r
                 LastOnline = DateTime.Now;\r
             }\r
-            else if (string.IsNullOrEmpty(baseMember.OnlineStatus))\r
+            else if (string.IsNullOrEmpty(baseMember.OnlineStatus) || baseMember.OnlineStatus == "unknown")\r
             {\r
                 LastOnline = DateTime.MinValue;\r
             }\r
index d00153c..9fded92 100644 (file)
@@ -643,6 +643,17 @@ namespace Radegast
 \r
         private Dictionary<UUID, frmGroupInfo> shownGroupProfiles = new Dictionary<UUID, frmGroupInfo>();\r
 \r
+        public void ShowGroupProfile(AvatarGroup group)\r
+        {\r
+            ShowGroupProfile(new OpenMetaverse.Group()\r
+            {\r
+                ID = group.GroupID,\r
+                InsigniaID = group.GroupInsigniaID,\r
+                Name = group.GroupName\r
+            }\r
+            );\r
+        }\r
+\r
         public void ShowGroupProfile(OpenMetaverse.Group group)\r
         {\r
             lock (shownGroupProfiles)\r
index 6fd96c7..6c34a6c 100644 (file)
@@ -61,6 +61,9 @@ namespace Radegast
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmProfile));\r
             this.tabProfile = new System.Windows.Forms.TabControl();\r
             this.tpgProfile = new System.Windows.Forms.TabPage();\r
+            this.lvwGroups = new Radegast.ListViewNoFlicker();\r
+            this.clGroupName = new System.Windows.Forms.ColumnHeader();\r
+            this.clGroupTitle = new System.Windows.Forms.ColumnHeader();\r
             this.txtFullName = new System.Windows.Forms.TextBox();\r
             this.anPartner = new Radegast.AgentNameTextBox();\r
             this.btnIM = new System.Windows.Forms.Button();\r
@@ -70,8 +73,6 @@ namespace Radegast
             this.btnPay = new System.Windows.Forms.Button();\r
             this.rtbAccountInfo = new System.Windows.Forms.RichTextBox();\r
             this.rtbAbout = new System.Windows.Forms.RichTextBox();\r
-            this.txtUUID = new System.Windows.Forms.TextBox();\r
-            this.label9 = new System.Windows.Forms.Label();\r
             this.label5 = new System.Windows.Forms.Label();\r
             this.label4 = new System.Windows.Forms.Label();\r
             this.label3 = new System.Windows.Forms.Label();\r
@@ -95,6 +96,8 @@ namespace Radegast
             this.pickPicturePanel = new System.Windows.Forms.Panel();\r
             this.pickListPanel = new System.Windows.Forms.Panel();\r
             this.tpgFirstLife = new System.Windows.Forms.TabPage();\r
+            this.txtUUID = new System.Windows.Forms.TextBox();\r
+            this.label9 = new System.Windows.Forms.Label();\r
             this.rlPicPanel = new System.Windows.Forms.Panel();\r
             this.rtbAboutFL = new System.Windows.Forms.RichTextBox();\r
             this.label8 = new System.Windows.Forms.Label();\r
@@ -128,6 +131,7 @@ namespace Radegast
             // \r
             // tpgProfile\r
             // \r
+            this.tpgProfile.Controls.Add(this.lvwGroups);\r
             this.tpgProfile.Controls.Add(this.txtFullName);\r
             this.tpgProfile.Controls.Add(this.anPartner);\r
             this.tpgProfile.Controls.Add(this.btnIM);\r
@@ -137,8 +141,6 @@ namespace Radegast
             this.tpgProfile.Controls.Add(this.btnPay);\r
             this.tpgProfile.Controls.Add(this.rtbAccountInfo);\r
             this.tpgProfile.Controls.Add(this.rtbAbout);\r
-            this.tpgProfile.Controls.Add(this.txtUUID);\r
-            this.tpgProfile.Controls.Add(this.label9);\r
             this.tpgProfile.Controls.Add(this.label5);\r
             this.tpgProfile.Controls.Add(this.label4);\r
             this.tpgProfile.Controls.Add(this.label3);\r
@@ -153,17 +155,53 @@ namespace Radegast
             this.tpgProfile.Text = "Profile";\r
             this.tpgProfile.UseVisualStyleBackColor = true;\r
             // \r
+            // lvwGroups\r
+            // \r
+            this.lvwGroups.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)\r
+                        | System.Windows.Forms.AnchorStyles.Left)\r
+                        | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.lvwGroups.BackColor = System.Drawing.SystemColors.Window;\r
+            this.lvwGroups.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {\r
+            this.clGroupName,\r
+            this.clGroupTitle});\r
+            this.lvwGroups.FullRowSelect = true;\r
+            this.lvwGroups.GridLines = true;\r
+            this.lvwGroups.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;\r
+            this.lvwGroups.HideSelection = false;\r
+            this.lvwGroups.LabelWrap = false;\r
+            this.lvwGroups.Location = new System.Drawing.Point(9, 199);\r
+            this.lvwGroups.MultiSelect = false;\r
+            this.lvwGroups.Name = "lvwGroups";\r
+            this.lvwGroups.ShowGroups = false;\r
+            this.lvwGroups.Size = new System.Drawing.Size(445, 82);\r
+            this.lvwGroups.Sorting = System.Windows.Forms.SortOrder.Ascending;\r
+            this.lvwGroups.TabIndex = 21;\r
+            this.lvwGroups.UseCompatibleStateImageBehavior = false;\r
+            this.lvwGroups.View = System.Windows.Forms.View.Details;\r
+            this.lvwGroups.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lvwGroups_MouseDoubleClick);\r
+            // \r
+            // clGroupName\r
+            // \r
+            this.clGroupName.Text = "Group Name";\r
+            this.clGroupName.Width = 212;\r
+            // \r
+            // clGroupTitle\r
+            // \r
+            this.clGroupTitle.Text = "Active Title";\r
+            this.clGroupTitle.Width = 196;\r
+            // \r
             // txtFullName\r
             // \r
             this.txtFullName.Location = new System.Drawing.Point(50, 6);\r
             this.txtFullName.Name = "txtFullName";\r
             this.txtFullName.ReadOnly = true;\r
-            this.txtFullName.Size = new System.Drawing.Size(196, 21);\r
+            this.txtFullName.Size = new System.Drawing.Size(172, 21);\r
             this.txtFullName.TabIndex = 4;\r
             // \r
             // anPartner\r
             // \r
             this.anPartner.AgentID = ((OpenMetaverse.UUID)(resources.GetObject("anPartner.AgentID")));\r
+            this.anPartner.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
             this.anPartner.Location = new System.Drawing.Point(306, 34);\r
             this.anPartner.Name = "anPartner";\r
             this.anPartner.ReadOnly = true;\r
@@ -172,7 +210,8 @@ namespace Radegast
             // \r
             // btnIM\r
             // \r
-            this.btnIM.Location = new System.Drawing.Point(312, 368);\r
+            this.btnIM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
+            this.btnIM.Location = new System.Drawing.Point(312, 427);\r
             this.btnIM.Name = "btnIM";\r
             this.btnIM.Size = new System.Drawing.Size(96, 23);\r
             this.btnIM.TabIndex = 19;\r
@@ -182,7 +221,8 @@ namespace Radegast
             // \r
             // btnFriend\r
             // \r
-            this.btnFriend.Location = new System.Drawing.Point(210, 368);\r
+            this.btnFriend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
+            this.btnFriend.Location = new System.Drawing.Point(210, 427);\r
             this.btnFriend.Name = "btnFriend";\r
             this.btnFriend.Size = new System.Drawing.Size(96, 23);\r
             this.btnFriend.TabIndex = 18;\r
@@ -192,15 +232,16 @@ namespace Radegast
             // \r
             // slPicPanel\r
             // \r
+            this.slPicPanel.BackColor = System.Drawing.SystemColors.Control;\r
             this.slPicPanel.Location = new System.Drawing.Point(9, 33);\r
             this.slPicPanel.Name = "slPicPanel";\r
-            this.slPicPanel.Size = new System.Drawing.Size(237, 178);\r
+            this.slPicPanel.Size = new System.Drawing.Size(213, 160);\r
             this.slPicPanel.TabIndex = 17;\r
             // \r
             // btnOfferTeleport\r
             // \r
             this.btnOfferTeleport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
-            this.btnOfferTeleport.Location = new System.Drawing.Point(6, 368);\r
+            this.btnOfferTeleport.Location = new System.Drawing.Point(6, 427);\r
             this.btnOfferTeleport.Name = "btnOfferTeleport";\r
             this.btnOfferTeleport.Size = new System.Drawing.Size(96, 23);\r
             this.btnOfferTeleport.TabIndex = 16;\r
@@ -211,7 +252,7 @@ namespace Radegast
             // btnPay\r
             // \r
             this.btnPay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
-            this.btnPay.Location = new System.Drawing.Point(108, 368);\r
+            this.btnPay.Location = new System.Drawing.Point(108, 427);\r
             this.btnPay.Name = "btnPay";\r
             this.btnPay.Size = new System.Drawing.Size(96, 23);\r
             this.btnPay.TabIndex = 15;\r
@@ -233,33 +274,14 @@ namespace Radegast
             // \r
             this.rtbAbout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)\r
                         | System.Windows.Forms.AnchorStyles.Right)));\r
-            this.rtbAbout.Location = new System.Drawing.Point(6, 231);\r
+            this.rtbAbout.Location = new System.Drawing.Point(6, 300);\r
             this.rtbAbout.Name = "rtbAbout";\r
             this.rtbAbout.ReadOnly = true;\r
-            this.rtbAbout.Size = new System.Drawing.Size(448, 131);\r
+            this.rtbAbout.Size = new System.Drawing.Size(448, 121);\r
             this.rtbAbout.TabIndex = 13;\r
             this.rtbAbout.Text = "";\r
             this.rtbAbout.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.rtbAbout_LinkClicked);\r
             // \r
-            // txtUUID\r
-            // \r
-            this.txtUUID.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
-            this.txtUUID.Location = new System.Drawing.Point(41, 430);\r
-            this.txtUUID.Name = "txtUUID";\r
-            this.txtUUID.ReadOnly = true;\r
-            this.txtUUID.Size = new System.Drawing.Size(259, 21);\r
-            this.txtUUID.TabIndex = 10;\r
-            // \r
-            // label9\r
-            // \r
-            this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
-            this.label9.AutoSize = true;\r
-            this.label9.Location = new System.Drawing.Point(6, 433);\r
-            this.label9.Name = "label9";\r
-            this.label9.Size = new System.Drawing.Size(29, 13);\r
-            this.label9.TabIndex = 9;\r
-            this.label9.Text = "Key:";\r
-            // \r
             // label5\r
             // \r
             this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
@@ -274,7 +296,7 @@ namespace Radegast
             // \r
             this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
             this.label4.AutoSize = true;\r
-            this.label4.Location = new System.Drawing.Point(6, 215);\r
+            this.label4.Location = new System.Drawing.Point(6, 284);\r
             this.label4.Name = "label4";\r
             this.label4.Size = new System.Drawing.Size(40, 13);\r
             this.label4.TabIndex = 8;\r
@@ -488,6 +510,8 @@ namespace Radegast
             // \r
             // tpgFirstLife\r
             // \r
+            this.tpgFirstLife.Controls.Add(this.txtUUID);\r
+            this.tpgFirstLife.Controls.Add(this.label9);\r
             this.tpgFirstLife.Controls.Add(this.rlPicPanel);\r
             this.tpgFirstLife.Controls.Add(this.rtbAboutFL);\r
             this.tpgFirstLife.Controls.Add(this.label8);\r
@@ -500,6 +524,25 @@ namespace Radegast
             this.tpgFirstLife.Text = "First Life";\r
             this.tpgFirstLife.UseVisualStyleBackColor = true;\r
             // \r
+            // txtUUID\r
+            // \r
+            this.txtUUID.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.txtUUID.Location = new System.Drawing.Point(43, 430);\r
+            this.txtUUID.Name = "txtUUID";\r
+            this.txtUUID.ReadOnly = true;\r
+            this.txtUUID.Size = new System.Drawing.Size(259, 21);\r
+            this.txtUUID.TabIndex = 17;\r
+            // \r
+            // label9\r
+            // \r
+            this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.label9.AutoSize = true;\r
+            this.label9.Location = new System.Drawing.Point(8, 433);\r
+            this.label9.Name = "label9";\r
+            this.label9.Size = new System.Drawing.Size(29, 13);\r
+            this.label9.TabIndex = 16;\r
+            this.label9.Text = "Key:";\r
+            // \r
             // rlPicPanel\r
             // \r
             this.rlPicPanel.Location = new System.Drawing.Point(6, 22);\r
@@ -574,6 +617,7 @@ namespace Radegast
             this.Controls.Add(this.tabProfile);\r
             this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));\r
+            this.MinimumSize = new System.Drawing.Size(508, 574);\r
             this.Name = "frmProfile";\r
             this.Text = "Profile";\r
             this.tabProfile.ResumeLayout(false);\r
@@ -627,8 +671,6 @@ namespace Radegast
         public System.Windows.Forms.Panel pickPicturePanel;\r
         public System.Windows.Forms.Panel pickListPanel;\r
         public System.Windows.Forms.TextBox textBox1;\r
-        public System.Windows.Forms.TextBox txtUUID;\r
-        public System.Windows.Forms.Label label9;\r
         public System.Windows.Forms.Button btnFriend;\r
         public System.Windows.Forms.Button btnIM;\r
         public System.Windows.Forms.TextBox pickLocation;\r
@@ -636,6 +678,11 @@ namespace Radegast
         public System.Windows.Forms.Button btnTeleport;\r
         public AgentNameTextBox anPartner;\r
         public System.Windows.Forms.TextBox txtFullName;\r
+        public System.Windows.Forms.TextBox txtUUID;\r
+        public System.Windows.Forms.Label label9;\r
+        public ListViewNoFlicker lvwGroups;\r
+        private System.Windows.Forms.ColumnHeader clGroupName;\r
+        private System.Windows.Forms.ColumnHeader clGroupTitle;\r
 \r
     }\r
 }
\ No newline at end of file
index 7d201c5..9932357 100644 (file)
@@ -82,6 +82,7 @@ namespace Radegast
             client.Avatars.AvatarPicksReply += new EventHandler<AvatarPicksReplyEventArgs>(Avatars_AvatarPicksReply);\r
             client.Avatars.PickInfoReply += new EventHandler<PickInfoReplyEventArgs>(Avatars_PickInfoReply);\r
             client.Parcels.ParcelInfoReply += new EventHandler<ParcelInfoReplyEventArgs>(Parcels_ParcelInfoReply);\r
+            client.Avatars.AvatarGroupsReply += new EventHandler<AvatarGroupsReplyEventArgs>(Avatars_AvatarGroupsReply);\r
             netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected);\r
 \r
             InitializeProfile();\r
@@ -93,9 +94,36 @@ namespace Radegast
             client.Avatars.AvatarPicksReply -= new EventHandler<AvatarPicksReplyEventArgs>(Avatars_AvatarPicksReply);\r
             client.Avatars.PickInfoReply -= new EventHandler<PickInfoReplyEventArgs>(Avatars_PickInfoReply);\r
             client.Parcels.ParcelInfoReply -= new EventHandler<ParcelInfoReplyEventArgs>(Parcels_ParcelInfoReply);\r
+            client.Avatars.AvatarGroupsReply -= new EventHandler<AvatarGroupsReplyEventArgs>(Avatars_AvatarGroupsReply);\r
             netcom.ClientDisconnected -= new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected);\r
         }\r
 \r
+        void Avatars_AvatarGroupsReply(object sender, AvatarGroupsReplyEventArgs e)\r
+        {\r
+            if (e.AvatarID != agentID) return;\r
+\r
+            if (InvokeRequired)\r
+            {\r
+                BeginInvoke(new MethodInvoker(() => Avatars_AvatarGroupsReply(sender, e)));\r
+                return;\r
+            }\r
+\r
+            lvwGroups.BeginUpdate();\r
+            \r
+            foreach (AvatarGroup g in e.Groups)\r
+            {\r
+                ListViewItem item = new ListViewItem();\r
+                item.Name = g.GroupID.ToString();\r
+                item.Text = g.GroupName;\r
+                item.Tag = g;\r
+                item.SubItems.Add(new ListViewItem.ListViewSubItem(item, g.GroupTitle));\r
+                lvwGroups.Items.Add(item);\r
+            }\r
+\r
+            lvwGroups.EndUpdate();\r
+            \r
+        }\r
+\r
         void Avatars_AvatarPicksReply(object sender, AvatarPicksReplyEventArgs e)\r
         {\r
             if (e.AvatarID != agentID) return;\r
@@ -431,5 +459,19 @@ namespace Radegast
                 ((int)currentPick.PosGlobal.Z) % 256\r
             );\r
         }\r
+\r
+        private void lvwGroups_MouseDoubleClick(object sender, MouseEventArgs e)\r
+        {\r
+            ListViewItem item = lvwGroups.GetItemAt(e.X, e.Y);\r
+            \r
+            if (item != null)\r
+            {\r
+                try\r
+                {\r
+                    instance.MainForm.ShowGroupProfile((AvatarGroup)item.Tag);\r
+                }\r
+                catch (Exception) { }\r
+            }\r
+        }\r
     }\r
 }
\ No newline at end of file