예제 #1
0
        public void NewChat(JabberUser jabberUser, bool setFocus)
        {
            int presenceStatus = 0;
            if (myClientForm.myBuddyPresence.Contains(jabberUser.JID)) presenceStatus = (int)myClientForm.myBuddyPresence[jabberUser.JID];

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChatWindow));

            if (myChatSessions[jabberUser.JID] == null)
            {
                ChatSession tmplChatSession = new ChatSession();
                ChatBox tmplChatBox = new ChatBox();
                tmplChatBox.JID = jabberUser.JID;
                tmplChatBox.ResetHTML();

                tmplChatSession.LastStatus = presenceStatus;
                tmplChatBox.wbConversation.GotFocus += new EventHandler(wbConversation_GotFocus);

                this.tmplChatTab = new Telerik.WinControls.UI.TabItem();

                //
                // tmplChatTab
                this.tmplChatTab.AccessibleDescription = "";
                this.tmplChatTab.CanFocus = true;
                this.tmplChatTab.Class = "TabItem";
                this.tmplChatTab.Tag = jabberUser.JID;
                this.tmplChatTab.ImageIndex = presenceStatus;
                this.tmplChatTab.TextImageRelation = TextImageRelation.ImageBeforeText;
                //
                // tmplChatTab.ContentPanel
                //
                this.tmplChatTab.ContentPanel.BackColor = System.Drawing.Color.Transparent;
                this.tmplChatTab.ContentPanel.Font = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Regular);
                this.tmplChatTab.ContentPanel.Location = new System.Drawing.Point(1, 22);
                this.tmplChatTab.ContentPanel.Name = "ContentPanel";
                this.tmplChatTab.ContentPanel.Size = new System.Drawing.Size(490, 241);
                this.tmplChatTab.ContentPanel.Dock = DockStyle.Fill;
                this.tmplChatTab.ContentPanel.TabIndex = 0;
                this.tmplChatTab.Text = jabberUser.Nick;
                this.tmplChatTab.ToolTipText = null;

                this.myChatSessionsTabControl.Items.AddRange(new Telerik.WinControls.RadItem[] { this.tmplChatTab });
                this.tmplChatTab.ContentPanel.BackgroundImage = null;
                this.tmplChatTab.ContentPanel.BackColor = Color.White;
                this.tmplChatTab.ContentPanel.Controls.Add(tmplChatBox);
                tmplChatBox.Dock = DockStyle.Fill;
                this.tmplChatTab.ContentPanel.Invalidate();

                //wire up all events

                tmplChatBox.toolStripCallUser.Click += new EventHandler(tmplVoiceCallToolStripButton_Click); ;
                tmplChatBox.toolStripColor.Click += new EventHandler(tmplChangeColorToolStripButton_Click); ;
                tmplChatBox.toolStripEmotSmile.Click += new EventHandler(tmplEmoticonSmileToolStripButton_Click); ;
                tmplChatBox.toolStripEvilgrin.Click += new EventHandler(tmplEmoticonEvilGrinToolStripButton_Click); ;
                tmplChatBox.toolStripFont.Click += new EventHandler(tmplChangeFontToolStripButton_Click);
                tmplChatBox.toolStripGrin.Click += new EventHandler(tmplEmoticonGrinToolStripButton_Click); ;
                tmplChatBox.toolStripHappy.Click += new EventHandler(tmplEmoticonHappyToolStripButton_Click); ;
                tmplChatBox.toolStripOpenArchive.Click += new EventHandler(toolStripOpenArchive_Click); ;
                tmplChatBox.toolStripSendMessage.Click += new EventHandler(tmplSendMessageToolStripButton_Click); ;
                tmplChatBox.toolStripStartVideo.Click += new EventHandler(tmplVideoCallToolStripButton_Click); ;
                tmplChatBox.toolStripSurprised.Click += new EventHandler(tmplEmoticonSurprisedToolStripButton_Click); ;
                tmplChatBox.toolStripTongue.Click += new EventHandler(tmplEmoticonToungeToolStripButton_Click); ;
                tmplChatBox.toolStripUnhappy.Click += new EventHandler(tmplEmoticonUnhappyToolStripButton_Click); ;
                tmplChatBox.toolStripWaii.Click += new EventHandler(tmplEmoticonWaiiToolStripButton_Click); ;
                tmplChatBox.toolStripWink.Click += new EventHandler(tmplEmoticonWinkToolStripButton_Click); ;
                tmplChatBox.toolStripSendNudge.Click += new EventHandler(toolStripSendNudge_Click);
                tmplChatBox.toolStripSendFile.Click += new EventHandler(toolStripSendFile_Click);
                tmplChatBox.tbMessage.KeyUp += new KeyEventHandler(tmplChatTabMessage_KeyUp);

                //disable foreign networks features
                if (jabberUser.Network != ConfigXMPPNetwork.Default)
                {
                    tmplChatBox.toolStripCallUser.Enabled = false;
                    tmplChatBox.toolStripStartVideo.Enabled = false;
                    tmplChatBox.toolStripSendNudge.Enabled = false;
                    tmplChatBox.toolStripSendFile.Enabled = false;
                    tmplChatBox.toolStripCallUser.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                    tmplChatBox.toolStripStartVideo.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                    tmplChatBox.toolStripSendNudge.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                    tmplChatBox.toolStripSendFile.ToolTipText = Properties.Localization.txtChatFeatureOnlyHomeNetwork;
                }

#if NOVIDEO
                tmplChatBox.toolStripStartVideo.Visible = false;
                tmplChatBox.toolStripStartVideo.Enabled = false;
#endif
#if NOFILESHARING
                tmplChatBox.toolStripSendFile.Visible = false;
                tmplChatBox.toolStripSendFile.Enabled = false;
#endif

                tmplChatBox.LinkClicked += new ChatBox.LinkClickedHandler(tmplChatBox_LinkClicked);
                tmplChatBox.FileDroped += new ChatBox.FilesDropedHandler(tmplChatBox_FileDroped);

                this.myChatSessionsTabControl.SelectedTab = this.tmplChatTab;

                this.tmplChatTab.ContentPanel.ResumeLayout(true);

                RadButtonElement tmplCloseButton = new RadButtonElement("x");
                tmplCloseButton.ToolTipText = Properties.Localization.txtChatInfoCloseTab;
                tmplCloseButton.Tag = jabberUser.JID;
                tmplCloseButton.Click += new EventHandler(tmplCloseButton_Click);

                tmplCloseButton.Alignment = ContentAlignment.TopRight;
                tmplChatTab.Children[2].Margin = new Padding(0, 0, 15, 0);
                tmplChatTab.Children.Add(tmplCloseButton);

                tmplChatSession.ChatTab = tmplChatTab;
                tmplChatSession.ChatBox = tmplChatBox;
                tmplChatSession.JabberUser = jabberUser;

                myChatSessions.Add(jabberUser.JID, tmplChatSession);
                Search("%");
                tmplChatSession.ChatBox.ChatTabMessage.Focus();
            }
            else
            {
                ChatSession tmplChatSession = (ChatSession)myChatSessions[jabberUser.JID];
                myChatSessionsTabControl.SelectedTab = tmplChatSession.ChatTab;
            }

            if (myClientForm.mUserAccount.LoggedIn)
            {
                ShowIt();
            }

        }
예제 #2
0
        public void NewChat(string jabberID, bool setFocus)
        {

            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChatWindow));

            if (myChatSessions.List[jabberID] == null)
            {
                ChatSession tmplChatSession = new ChatSession();
                this.tmplChatTab = new Telerik.WinControls.UI.TabItem();
                this.tmplChatTabSplitter = new System.Windows.Forms.SplitContainer();
                this.tmplChatTabConversation = new System.Windows.Forms.WebBrowser();
                this.tmplChatTabMessage = new System.Windows.Forms.TextBox();
                this.tmplChatTab.ContentPanel.SuspendLayout();
                this.tmplChatTabSplitter.Panel1.SuspendLayout();
                this.tmplChatTabSplitter.Panel2.SuspendLayout();
                this.tmplChatTabSplitter.SuspendLayout();
                this.myChatSessionsTabControl.Items.AddRange(new Telerik.WinControls.RadItem[] { this.tmplChatTab });
                //
                // tmplChatTab
                this.tmplChatTab.AccessibleDescription = "";
                this.tmplChatTab.CanFocus = true;
                this.tmplChatTab.Class = "TabItem";
                this.tmplChatTab.Tag = jabberID;
                this.tmplChatTab.ImageIndex = 0;
                this.tmplChatTab.TextImageRelation = TextImageRelation.ImageBeforeText;
                //
                // tmplChatTab.ContentPanel
                //
                this.tmplChatTab.ContentPanel.BackColor = System.Drawing.Color.Transparent;
                this.tmplChatTab.ContentPanel.Controls.Add(this.tmplChatTabSplitter);
                this.tmplChatTab.ContentPanel.Font = new System.Drawing.Font("Trebuchet MS", 9F, System.Drawing.FontStyle.Regular);
                this.tmplChatTab.ContentPanel.Location = new System.Drawing.Point(1, 22);
                this.tmplChatTab.ContentPanel.Name = "ContentPanel";
                this.tmplChatTab.ContentPanel.Size = new System.Drawing.Size(490, 241);
                this.tmplChatTab.ContentPanel.Dock = DockStyle.Fill;
                this.tmplChatTab.ContentPanel.TabIndex = 0;
                this.tmplChatTab.Text = jabberID;
                this.tmplChatTab.ToolTipText = null;
                //
                // tmplChatTabSplitter
                //
                this.tmplChatTabSplitter.Dock = System.Windows.Forms.DockStyle.Fill;
                this.tmplChatTabSplitter.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
                this.tmplChatTabSplitter.Location = new System.Drawing.Point(0, 0);
                this.tmplChatTabSplitter.Name = "tmplChatTabSplitter";
                this.tmplChatTabSplitter.Orientation = System.Windows.Forms.Orientation.Horizontal;
                //
                // tmplChatTabSplitter.Panel1
                //
                this.tmplChatTabSplitter.Panel1.Controls.Add(this.tmplChatTabConversation);
                //
                // tmplChatTabSplitter.Panel2
                //
                this.tmplChatTabSplitter.Panel2.Controls.Add(this.tmplChatTabMessage);
                this.tmplChatTabSplitter.Size = new System.Drawing.Size(459, 264);
                this.tmplChatTabSplitter.SplitterDistance = 153;
                this.tmplChatTabSplitter.TabIndex = 0;
                //
                // tmplChatTabConversation
                //
                this.tmplChatTabConversation.AllowNavigation = false;
                this.tmplChatTabConversation.AllowWebBrowserDrop = false;
                this.tmplChatTabConversation.Dock = System.Windows.Forms.DockStyle.Fill;
                this.tmplChatTabConversation.IsWebBrowserContextMenuEnabled = false;
                this.tmplChatTabConversation.Location = new System.Drawing.Point(0, 0);
                this.tmplChatTabConversation.MinimumSize = new System.Drawing.Size(20, 20);
                this.tmplChatTabConversation.Name = "tmplChatTabConversation";
                this.tmplChatTabConversation.ScriptErrorsSuppressed = true;
                this.tmplChatTabConversation.Size = new System.Drawing.Size(459, 153);
                this.tmplChatTabConversation.TabIndex = 0;
                this.tmplChatTabConversation.WebBrowserShortcutsEnabled = false;
                this.tmplChatTabConversation.DocumentText = "<HTML><BODY></BODY></HTML>";

                //ToolStrip Buttons
                this.tmplChatWindowToolStrip = new System.Windows.Forms.ToolStrip();
                this.tmplChangeFontToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplChangeColorToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonSeparatorToolStripButton = new System.Windows.Forms.ToolStripSeparator();
                this.tmplEmoticonSmileToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonGrinToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonEvilGrinToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonWinkToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonHappyToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonSurprisedToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonToungeToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonUnhappyToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplEmoticonWaiiToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplToolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
                this.tmplSendMessageToolStripButton = new System.Windows.Forms.ToolStripButton();

                this.tmplVideoCallToolStripButton = new System.Windows.Forms.ToolStripButton();
                this.tmplVoiceCallToolStripButton = new System.Windows.Forms.ToolStripButton();





                this.tmplChatWindowToolStrip.SuspendLayout();

                this.tmplChatTabSplitter.Panel2.Controls.Add(this.tmplChatWindowToolStrip);

                // 
                // tmplChatWindowToolStrip
                // 
                this.tmplChatWindowToolStrip.AllowItemReorder = true;
                this.tmplChatWindowToolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
                this.tmplChatWindowToolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.tmplChangeFontToolStripButton,
            this.tmplChangeColorToolStripButton,
            this.tmplEmoticonSeparatorToolStripButton,
            this.tmplEmoticonSmileToolStripButton,
            this.tmplEmoticonGrinToolStripButton,
            this.tmplEmoticonEvilGrinToolStripButton,
            this.tmplEmoticonWinkToolStripButton,
            this.tmplEmoticonHappyToolStripButton,
            this.tmplEmoticonSurprisedToolStripButton,
            this.tmplEmoticonToungeToolStripButton,
            this.tmplEmoticonUnhappyToolStripButton,
            this.tmplEmoticonWaiiToolStripButton,
                       this.tmplVideoCallToolStripButton,
                this.tmplVoiceCallToolStripButton,
                 this.tmplSendMessageToolStripButton,
                 this.tmplToolStripSeparator
                 });
                this.tmplChatWindowToolStrip.Location = new System.Drawing.Point(0, 0);
                this.tmplChatWindowToolStrip.Name = "tmplChatWindowToolStrip";
                this.tmplChatWindowToolStrip.Size = new System.Drawing.Size(490, 25);
                this.tmplChatWindowToolStrip.TabIndex = 0;
                this.tmplChatWindowToolStrip.Text = "";
                // 
                // tmplChangeFontToolStripButton
                // 
                this.tmplChangeFontToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplChangeFontToolStripButton.Image = myMessageMenuImagesList.Images[0];
                this.tmplChangeFontToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplChangeFontToolStripButton.Name = "tmplChangeFontToolStripButton";
                this.tmplChangeFontToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplChangeFontToolStripButton.Text = "";
                this.tmplChangeFontToolStripButton.Click += new EventHandler(tmplChangeFontToolStripButton_Click);
                // 
                // tmplChangeColorToolStripButton
                // 
                this.tmplChangeColorToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplChangeColorToolStripButton.Image = myMessageMenuImagesList.Images[1];
                this.tmplChangeColorToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplChangeColorToolStripButton.Name = "tmplChangeColorToolStripButton";
                this.tmplChangeColorToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplChangeColorToolStripButton.Text = "";
                this.tmplChangeColorToolStripButton.Click += new EventHandler(tmplChangeColorToolStripButton_Click);
                // 
                // tmplEmoticonSeparatorToolStripButton
                // 
                this.tmplEmoticonSeparatorToolStripButton.Name = "tmplEmoticonSeparatorToolStripButton";
                this.tmplEmoticonSeparatorToolStripButton.Size = new System.Drawing.Size(6, 25);
                // 
                // tmplEmoticonSmileToolStripButton
                // 
                this.tmplEmoticonSmileToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonSmileToolStripButton.Image = myMessageMenuImagesList.Images[2];
                this.tmplEmoticonSmileToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonSmileToolStripButton.Name = "tmplEmoticonSmileToolStripButton";
                this.tmplEmoticonSmileToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonSmileToolStripButton.ToolTipText = "smile";
                this.tmplEmoticonSmileToolStripButton.Click += new EventHandler(tmplEmoticonSmileToolStripButton_Click);
                // 
                // tmplEmoticonEvilGrinToolStripButton
                // 
                this.tmplEmoticonEvilGrinToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonEvilGrinToolStripButton.Image = myMessageMenuImagesList.Images[4];
                this.tmplEmoticonEvilGrinToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonEvilGrinToolStripButton.Name = "tmplEmoticonEvilGrinToolStripButton";
                this.tmplEmoticonEvilGrinToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonEvilGrinToolStripButton.ToolTipText = "evilgrin";
                this.tmplEmoticonEvilGrinToolStripButton.Click += new EventHandler(tmplEmoticonEvilGrinToolStripButton_Click);
                // 
                // tmplEmoticonGrinToolStripButton
                // 
                this.tmplEmoticonGrinToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonGrinToolStripButton.Image = myMessageMenuImagesList.Images[3];
                this.tmplEmoticonGrinToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonGrinToolStripButton.Name = "tmplEmoticonGrinToolStripButton";
                this.tmplEmoticonGrinToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonGrinToolStripButton.ToolTipText = "grin";
                this.tmplEmoticonGrinToolStripButton.Click += new EventHandler(tmplEmoticonGrinToolStripButton_Click);
                // 
                // tmplEmoticonHappyToolStripButton
                // 
                this.tmplEmoticonHappyToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonHappyToolStripButton.Image = myMessageMenuImagesList.Images[6];
                this.tmplEmoticonHappyToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonHappyToolStripButton.Name = "tmplEmoticonHappyToolStripButton";
                this.tmplEmoticonHappyToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonHappyToolStripButton.ToolTipText = "happy";
                this.tmplEmoticonHappyToolStripButton.Click += new EventHandler(tmplEmoticonHappyToolStripButton_Click);
                // 
                // tmplEmoticonSurprisedToolStripButton
                // 
                this.tmplEmoticonSurprisedToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonSurprisedToolStripButton.Image = myMessageMenuImagesList.Images[7];
                this.tmplEmoticonSurprisedToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonSurprisedToolStripButton.Name = "tmplEmoticonSurprisedToolStripButton";
                this.tmplEmoticonSurprisedToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonSurprisedToolStripButton.ToolTipText = "surprised";
                this.tmplEmoticonSurprisedToolStripButton.Click += new EventHandler(tmplEmoticonSurprisedToolStripButton_Click);
                // 
                // tmplEmoticonToungeToolStripButton
                // 
                this.tmplEmoticonToungeToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonToungeToolStripButton.Image = myMessageMenuImagesList.Images[8];
                this.tmplEmoticonToungeToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonToungeToolStripButton.Name = "tmplEmoticonToungeToolStripButton";
                this.tmplEmoticonToungeToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonToungeToolStripButton.Text = "tongue";
                this.tmplEmoticonToungeToolStripButton.Click += new EventHandler(tmplEmoticonToungeToolStripButton_Click);
                // 
                // tmplEmoticonUnhappyToolStripButton
                // 
                this.tmplEmoticonUnhappyToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonUnhappyToolStripButton.Image = myMessageMenuImagesList.Images[9];
                this.tmplEmoticonUnhappyToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonUnhappyToolStripButton.Name = "tmplEmoticonUnhappyToolStripButton";
                this.tmplEmoticonUnhappyToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonUnhappyToolStripButton.ToolTipText = "unhappy";
                this.tmplEmoticonUnhappyToolStripButton.Click += new EventHandler(tmplEmoticonUnhappyToolStripButton_Click);
                // 
                // tmplEmoticonWaiiToolStripButton
                // 
                this.tmplEmoticonWaiiToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonWaiiToolStripButton.Image = myMessageMenuImagesList.Images[10];
                this.tmplEmoticonWaiiToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonWaiiToolStripButton.Name = "tmplEmoticonWaiiToolStripButton";
                this.tmplEmoticonWaiiToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonWaiiToolStripButton.ToolTipText = "waii";
                this.tmplEmoticonWaiiToolStripButton.Click += new EventHandler(tmplEmoticonWaiiToolStripButton_Click);
                // 
                // tmplEmoticonWinkToolStripButton
                // 
                this.tmplEmoticonWinkToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
                this.tmplEmoticonWinkToolStripButton.Image = myMessageMenuImagesList.Images[5];
                this.tmplEmoticonWinkToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplEmoticonWinkToolStripButton.Name = "tmplEmoticonWinkToolStripButton";
                this.tmplEmoticonWinkToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplEmoticonWinkToolStripButton.ToolTipText = "wink";
                this.tmplEmoticonWinkToolStripButton.Click += new EventHandler(tmplEmoticonWinkToolStripButton_Click);
                // 
                // tmplToolStripSeparator
                // 
                this.tmplToolStripSeparator.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
                this.tmplToolStripSeparator.Name = "tmplToolStripSeparator";
                this.tmplToolStripSeparator.Size = new System.Drawing.Size(6, 25);
                // 
                // tmplSendMessageToolStripButton
                // 
                this.tmplSendMessageToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
                this.tmplSendMessageToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
                this.tmplSendMessageToolStripButton.Image = myMessageMenuImagesList.Images[11];
                this.tmplSendMessageToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplSendMessageToolStripButton.Name = "tmplSendMessageToolStripButton";
                this.tmplSendMessageToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplSendMessageToolStripButton.ToolTipText = "Send message";
                this.tmplSendMessageToolStripButton.Text = "Send";
                this.tmplSendMessageToolStripButton.Click += new EventHandler(tmplSendMessageToolStripButton_Click);
                // 
                // tmplVoiceCallToolStripButton
                // 
                this.tmplVoiceCallToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
                this.tmplVoiceCallToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
                this.tmplVoiceCallToolStripButton.Image = myMessageMenuImagesList.Images[12];
                this.tmplVoiceCallToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplVoiceCallToolStripButton.Name = "tmplVoiceCallToolStripButton";
                this.tmplVoiceCallToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplVoiceCallToolStripButton.ToolTipText = "Start a PC to PC call";
                this.tmplVoiceCallToolStripButton.Text = "Call";
                this.tmplVoiceCallToolStripButton.Click += new EventHandler(tmplVoiceCallToolStripButton_Click);
                // 
                // tmplVideoCallToolStripButton
                // 
                this.tmplVideoCallToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
                this.tmplVideoCallToolStripButton.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
                this.tmplVideoCallToolStripButton.Image = myMessageMenuImagesList.Images[13];
                this.tmplVideoCallToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
                this.tmplVideoCallToolStripButton.Name = "tmplVideoCallToolStripButton";
                this.tmplVideoCallToolStripButton.Size = new System.Drawing.Size(23, 22);
                this.tmplVideoCallToolStripButton.ToolTipText = "Start video call";
                this.tmplVideoCallToolStripButton.Text = "Video";
                this.tmplVideoCallToolStripButton.Click += new EventHandler(tmplVideoCallToolStripButton_Click);
                //
                // tmplChatTabMessage
                //
                this.tmplChatTabMessage.Dock = System.Windows.Forms.DockStyle.Fill;
                this.tmplChatTabMessage.Location = new System.Drawing.Point(0, 25);
                this.tmplChatTabMessage.Multiline = true;
                this.tmplChatTabMessage.Name = "tmplChatTabMessage";
                this.tmplChatTabMessage.Size = new System.Drawing.Size(354, 82);
                this.tmplChatTabMessage.TabIndex = 0;
                this.tmplChatTabMessage.KeyUp += new KeyEventHandler(tmplChatTabMessage_KeyUp);

                this.tmplChatTab.ContentPanel.ResumeLayout(false);
                this.tmplChatTabSplitter.Panel1.ResumeLayout(false);
                this.tmplChatTabSplitter.Panel2.ResumeLayout(false);
                this.tmplChatTabSplitter.ResumeLayout(false);
                this.tmplChatWindowToolStrip.ResumeLayout(false);
                this.tmplChatWindowToolStrip.PerformLayout();
                this.myChatSessionsTabControl.SelectedTab = this.tmplChatTab;

                RadButtonElement tmplCloseButton = new RadButtonElement("x");
                tmplCloseButton.ToolTipText = "Close Tab";
                tmplCloseButton.Click += new EventHandler(tmplCloseButton_Click);

                tmplCloseButton.Alignment = ContentAlignment.TopRight;
                // Let's say that you want to place the close button in "tabItem1"                
                tmplChatTab.Children[2].Margin = new Padding(0, 0, 15, 0);
                tmplChatTab.Children.Add(tmplCloseButton);

                tmplChatSession.ChatTab = tmplChatTab;
                tmplChatSession.ChatTabConversation = tmplChatTabConversation;
                tmplChatSession.ChatTabMessage = tmplChatTabMessage;
                tmplChatSession.JabberID = jabberID;


                myChatSessions.List.Add(jabberID, tmplChatSession);
            }
            else
            {
                ChatSession tmplChatSession = (ChatSession)myChatSessions.List[jabberID];
                tmplChatSession.ChatTab.Visibility = ElementVisibility.Visible;

            }
            try
            {

           
            
            if (myClientForm.myUserAccount.LoggedIn())
            {
                this.Update();
                this.Show();
                UpdatePresence(jabberID,(int)myClientForm.myBuddyPresence[jabberID]);
            }
        }
            catch (Exception)
            {
                
             //   throw;
                ;
            }


        }