this.rtbIMText = new System.Windows.Forms.RichTextBox();\r
this.cbxInput = new System.Windows.Forms.ComboBox();\r
this.btnSend = new System.Windows.Forms.Button();\r
+ this.chatSplit = new System.Windows.Forms.SplitContainer();\r
+ this.btnShow = new System.Windows.Forms.Button();\r
+ this.Participants = new Radegast.ListViewNoFlicker();\r
+ this.chatSplit.Panel1.SuspendLayout();\r
+ this.chatSplit.Panel2.SuspendLayout();\r
+ this.chatSplit.SuspendLayout();\r
this.SuspendLayout();\r
// \r
// rtbIMText\r
// \r
- this.rtbIMText.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.rtbIMText.BackColor = System.Drawing.Color.White;\r
+ this.rtbIMText.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.rtbIMText.HideSelection = false;\r
- this.rtbIMText.Location = new System.Drawing.Point(3, 3);\r
+ this.rtbIMText.Location = new System.Drawing.Point(0, 0);\r
this.rtbIMText.Name = "rtbIMText";\r
this.rtbIMText.ReadOnly = true;\r
- this.rtbIMText.Size = new System.Drawing.Size(494, 295);\r
- this.rtbIMText.TabIndex = 2;\r
+ this.rtbIMText.Size = new System.Drawing.Size(373, 302);\r
+ this.rtbIMText.TabIndex = 3;\r
this.rtbIMText.Text = "";\r
this.rtbIMText.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.rtbIMText_LinkClicked);\r
// \r
this.cbxInput.FormattingEnabled = true;\r
this.cbxInput.Location = new System.Drawing.Point(3, 306);\r
this.cbxInput.Name = "cbxInput";\r
- this.cbxInput.Size = new System.Drawing.Size(413, 21);\r
+ this.cbxInput.Size = new System.Drawing.Size(373, 21);\r
this.cbxInput.TabIndex = 0;\r
this.cbxInput.KeyUp += new System.Windows.Forms.KeyEventHandler(this.cbxInput_KeyUp);\r
this.cbxInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cbxInput_KeyDown);\r
// \r
this.btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
this.btnSend.Enabled = false;\r
- this.btnSend.Location = new System.Drawing.Point(422, 304);\r
+ this.btnSend.Location = new System.Drawing.Point(380, 305);\r
this.btnSend.Name = "btnSend";\r
- this.btnSend.Size = new System.Drawing.Size(75, 23);\r
+ this.btnSend.Size = new System.Drawing.Size(55, 23);\r
this.btnSend.TabIndex = 1;\r
this.btnSend.Text = "Send";\r
this.btnSend.UseVisualStyleBackColor = true;\r
this.btnSend.Click += new System.EventHandler(this.btnSend_Click);\r
// \r
+ // chatSplit\r
+ // \r
+ this.chatSplit.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.chatSplit.Location = new System.Drawing.Point(3, 3);\r
+ this.chatSplit.Name = "chatSplit";\r
+ // \r
+ // chatSplit.Panel1\r
+ // \r
+ this.chatSplit.Panel1.Controls.Add(this.rtbIMText);\r
+ // \r
+ // chatSplit.Panel2\r
+ // \r
+ this.chatSplit.Panel2.Controls.Add(this.Participants);\r
+ this.chatSplit.Size = new System.Drawing.Size(494, 302);\r
+ this.chatSplit.SplitterDistance = 373;\r
+ this.chatSplit.TabIndex = 3;\r
+ // \r
+ // btnShow\r
+ // \r
+ this.btnShow.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+ this.btnShow.Location = new System.Drawing.Point(442, 305);\r
+ this.btnShow.Name = "btnShow";\r
+ this.btnShow.Size = new System.Drawing.Size(55, 23);\r
+ this.btnShow.TabIndex = 2;\r
+ this.btnShow.Text = "Show";\r
+ this.btnShow.UseVisualStyleBackColor = true;\r
+ this.btnShow.Click += new System.EventHandler(this.btnShow_Click);\r
+ // \r
+ // Participants\r
+ // \r
+ this.Participants.Activation = System.Windows.Forms.ItemActivation.OneClick;\r
+ this.Participants.Dock = System.Windows.Forms.DockStyle.Fill;\r
+ this.Participants.HideSelection = false;\r
+ this.Participants.Location = new System.Drawing.Point(0, 0);\r
+ this.Participants.MultiSelect = false;\r
+ this.Participants.Name = "Participants";\r
+ this.Participants.ShowGroups = false;\r
+ this.Participants.Size = new System.Drawing.Size(117, 302);\r
+ this.Participants.Sorting = System.Windows.Forms.SortOrder.Ascending;\r
+ this.Participants.TabIndex = 4;\r
+ this.Participants.UseCompatibleStateImageBehavior = false;\r
+ this.Participants.View = System.Windows.Forms.View.List;\r
+ this.Participants.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.Participants_MouseDoubleClick);\r
+ // \r
// GroupIMTabWindow\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
+ this.Controls.Add(this.chatSplit);\r
this.Controls.Add(this.cbxInput);\r
- this.Controls.Add(this.rtbIMText);\r
+ this.Controls.Add(this.btnShow);\r
this.Controls.Add(this.btnSend);\r
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));\r
this.Name = "GroupIMTabWindow";\r
this.Size = new System.Drawing.Size(500, 330);\r
+ this.chatSplit.Panel1.ResumeLayout(false);\r
+ this.chatSplit.Panel2.ResumeLayout(false);\r
+ this.chatSplit.ResumeLayout(false);\r
this.ResumeLayout(false);\r
\r
}\r
private System.Windows.Forms.RichTextBox rtbIMText;\r
private System.Windows.Forms.ComboBox cbxInput;\r
private System.Windows.Forms.Button btnSend;\r
+ private System.Windows.Forms.SplitContainer chatSplit;\r
+ private ListViewNoFlicker Participants;\r
+ private System.Windows.Forms.Button btnShow;\r
}\r
}\r
//\r
using System;\r
using System.Drawing;\r
+using System.Collections.Generic;\r
using System.Windows.Forms;\r
using System.Threading;\r
using Radegast.Netcom;\r
this.session = session;\r
\r
textManager = new IMTextManager(this.instance, new RichTextBoxPrinter(rtbIMText), this.session, sessionName);\r
- \r
+\r
+ btnShow.Text = "Show";\r
+ chatSplit.Panel2Collapsed = true;\r
+\r
// Callbacks\r
client.Self.OnGroupChatJoin += new AgentManager.GroupChatJoinedCallback(Self_OnGroupChatJoin);\r
-\r
+ client.Self.OnChatSessionMemberAdded += new AgentManager.ChatSessionMemberAddedCallback(Self_OnChatSessionMemberAdded);\r
+ client.Self.OnChatSessionMemberLeft += new AgentManager.ChatSessionMemberLeftCallback(Self_OnChatSessionMemberLeft);\r
+ client.Avatars.OnAvatarNames += new AvatarManager.AvatarNamesCallback(Avatars_OnAvatarNames);\r
client.Self.RequestJoinGroupChat(session);\r
}\r
\r
private void IMTabWindow_Disposed(object sender, EventArgs e)\r
{\r
client.Self.OnGroupChatJoin -= new AgentManager.GroupChatJoinedCallback(Self_OnGroupChatJoin);\r
+ client.Self.OnChatSessionMemberAdded -= new AgentManager.ChatSessionMemberAddedCallback(Self_OnChatSessionMemberAdded);\r
+ client.Self.OnChatSessionMemberLeft -= new AgentManager.ChatSessionMemberLeftCallback(Self_OnChatSessionMemberLeft);\r
+ client.Avatars.OnAvatarNames -= new AvatarManager.AvatarNamesCallback(Avatars_OnAvatarNames);\r
CleanUp();\r
}\r
\r
+ void Avatars_OnAvatarNames(Dictionary<UUID, string> names)\r
+ {\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new MethodInvoker(() => Avatars_OnAvatarNames(names)));\r
+ return;\r
+ }\r
+\r
+ Participants.BeginUpdate();\r
+\r
+ foreach (KeyValuePair<UUID, string> kvp in names)\r
+ {\r
+ if (Participants.Items.ContainsKey(kvp.Key.ToString()))\r
+ Participants.Items[kvp.Key.ToString()].Text = kvp.Value;\r
+ }\r
+\r
+ Participants.Sort();\r
+ Participants.EndUpdate();\r
+ }\r
+\r
+ void Self_OnChatSessionMemberLeft(UUID sessionID, UUID agent_key)\r
+ {\r
+ if (sessionID == session)\r
+ UpdateParticipantList();\r
+ }\r
+\r
+ void Self_OnChatSessionMemberAdded(UUID sessionID, UUID agent_key)\r
+ {\r
+ if (sessionID == session)\r
+ UpdateParticipantList();\r
+ }\r
+\r
+ void UpdateParticipantList()\r
+ {\r
+ if (InvokeRequired)\r
+ {\r
+ BeginInvoke(new MethodInvoker(UpdateParticipantList));\r
+ return;\r
+ }\r
+\r
+ Participants.BeginUpdate();\r
+ Participants.Items.Clear();\r
+\r
+ List<ChatSessionMember> participants;\r
+ List<UUID> nameLookup = new List<UUID>();\r
+\r
+ if (client.Self.GroupChatSessions.TryGetValue(session, out participants))\r
+ {\r
+ ChatSessionMember[] members = participants.ToArray();\r
+ for (int i = 0; i < members.Length; i++)\r
+ {\r
+ ChatSessionMember participant = members[i];\r
+ ListViewItem item = new ListViewItem();\r
+ item.Name = participant.AvatarKey.ToString();\r
+ if (instance.nameCache.ContainsKey(participant.AvatarKey))\r
+ {\r
+ item.Text = instance.nameCache[participant.AvatarKey];\r
+ }\r
+ else\r
+ {\r
+ item.Text = RadegastInstance.INCOMPLETE_NAME;\r
+ nameLookup.Add(participant.AvatarKey);\r
+ }\r
+ if (participant.IsModerator)\r
+ item.Font = new Font(item.Font, FontStyle.Bold);\r
+ Participants.Items.Add(item);\r
+ }\r
+\r
+ if (nameLookup.Count > 0)\r
+ client.Avatars.RequestAvatarNames(nameLookup);\r
+ }\r
+\r
+ Participants.Sort();\r
+ Participants.EndUpdate();\r
+ }\r
\r
void Self_OnGroupChatJoin(UUID groupChatSessionID, string sessionName, UUID tmpSessionID, bool success)\r
{\r
- if (groupChatSessionID != session && tmpSessionID != session) {\r
+ if (groupChatSessionID != session && tmpSessionID != session)\r
+ {\r
return;\r
}\r
\r
- if (InvokeRequired) {\r
+ if (InvokeRequired)\r
+ {\r
Invoke(new MethodInvoker(\r
delegate()\r
{\r
);\r
return;\r
}\r
- if (success) {\r
+ if (success)\r
+ {\r
textManager.TextPrinter.PrintTextLine("Join Group Chat Success!", Color.Green);\r
WaitForSessionStart.Set();\r
- } else {\r
+ }\r
+ else\r
+ {\r
textManager.TextPrinter.PrintTextLine("Join Group Chat failed.", Color.Red);\r
}\r
}\r
this.ClearIMInput();\r
}\r
\r
+ private void btnShow_Click(object sender, EventArgs e)\r
+ {\r
+ if (chatSplit.Panel2Collapsed)\r
+ {\r
+ chatSplit.Panel2Collapsed = false;\r
+ btnShow.Text = "Hide";\r
+ }\r
+ else\r
+ {\r
+ chatSplit.Panel2Collapsed = true;\r
+ btnShow.Text = "Show";\r
+ }\r
+ }\r
+\r
private void cbxInput_TextChanged(object sender, EventArgs e)\r
{\r
RefreshControls();\r
{\r
cbxInput.Enabled = false;\r
btnSend.Enabled = false;\r
+ btnShow.Enabled = false;\r
+ btnShow.Text = "Show";\r
+ chatSplit.Panel2Collapsed = true;\r
return;\r
}\r
\r
+ btnShow.Enabled = true;\r
+\r
if (cbxInput.Text.Length > 0)\r
{\r
btnSend.Enabled = true;\r
get { return textManager; }\r
set { textManager = value; }\r
}\r
+\r
+ private void Participants_MouseDoubleClick(object sender, MouseEventArgs e)\r
+ {\r
+ ListViewItem item = Participants.GetItemAt(e.X, e.Y);\r
+ if (item != null)\r
+ {\r
+ try\r
+ {\r
+ new frmProfile(instance, item.Text, new UUID(item.Name)).Show();\r
+ }\r
+ catch (Exception) { }\r
+ }\r
+ }\r
+\r
}\r
}\r