Example #1
0
        private void RefreshTabInfo()
        {
            if (tabChats.TabPages.Count > 0)
            {
                TabPage  tab = tabChats.TabPages[tabChats.SelectedIndex];
                LiveChat lc  = (LiveChat)tab.Controls[0];

                string visitorIP = lc.ChatRequest.VisitorIp;

                if (currentVisitors.ContainsKey(visitorIP))
                {
                    WebRequest req = currentVisitors[visitorIP] as WebRequest;

                    // Clear the panel info control
                    splitContainer1.Panel1.Controls.Clear();

                    TabInfo tabInfo = null;
                    foreach (TabInfo t in chatInfo)
                    {
                        if (t.ChatId == lc.ChatRequest.ChatId)
                        {
                            tabInfo = t;
                            tabInfo.RequestEntity = req;
                            tabInfo.Dock          = DockStyle.Fill;
                            break;
                        }
                    }

                    splitContainer1.Panel1.Controls.Add(tabInfo);
                }
            }
        }
Example #2
0
        public void EndChat(TabPage tab, Guid chatId)
        {
            if (tab == null)
            {
                LiveChat lc = null;
                // Get the tab page by chat id
                foreach (TabPage t in tabChats.TabPages)
                {
                    lc = t.Controls[0] as LiveChat;
                    if (lc.ChatRequest.ChatId == chatId)
                    {
                        tab = t;
                        break;
                    }
                }
            }

            tabChats.TabPages.Remove(tab);
            myChats.Remove(chatId);

            splitContainer1.Panel1.Controls.Clear();
            for (int i = 0; i < chatInfo.Count; i++)
            {
                if (chatId == chatInfo[i].ChatId)
                {
                    chatInfo.RemoveAt(i);
                    break;
                }
            }
        }
Example #3
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            // Accept a new chat request
            if (drpChatRequest.SelectedItem != null)
            {
                player.Stop();


                ChatRequest req = (ChatRequest)drpChatRequest.SelectedItem;

                // Remove the chat request from the combo
                drpChatRequest.Items.Remove(req);
                drpChatRequest.Text = string.Empty;

                // Accept the chat request
                ws.AcceptRequest(new Guid(Program.CurrentOperator.Password), req.ChatId, Program.CurrentOperator.OperatorId);

                // Add a new tab page that will contain the chat session
                TabPage  tab = new TabPage(req.VisitorIp);
                LiveChat lc  = new LiveChat();
                lc.ChatRequest = req;
                lc.Dock        = DockStyle.Fill;
                tab.Controls.Add(lc);
                tabChats.TabPages.Add(tab);
                tab.Focus();

                // Add a new TabInfo control
                TabInfo tabInfo = new TabInfo();
                tabInfo.ChatId      = req.ChatId;
                tabInfo.ChatRequest = req;
                tabInfo.MyTab       = tab;
                tabInfo.Dock        = DockStyle.Fill;



                // Get the request
                if (currentVisitors.ContainsKey(req.VisitorIp))
                {
                    tabInfo.RequestEntity = currentVisitors[req.VisitorIp] as WebRequest;
                }


                chatInfo.Add(tabInfo);
                RefreshTabInfo();
            }
        }
Example #4
0
        private void btnInvite_Click(object sender, EventArgs e)
        {
            if (lstVisitors.SelectedIndices.Count > 0)
            {
                List <string> ips = new List <string>();
                foreach (int item in lstVisitors.SelectedIndices)
                {
                    ips.Add(lstVisitors.Items[item].SubItems[2].Text);
                }

                if (MessageBox.Show("Are you sure you want to invite " + ips.Count + " visitor(s)?", "LCSK", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                {
                    foreach (string ip in ips)
                    {
                        ChatRequest req = ws.Invite(new Guid(Program.CurrentOperator.Password), Program.CurrentOperator.OperatorId, ip, "");

                        // Add a new tab page that will contain the chat session
                        TabPage  tab = new TabPage(req.VisitorIp);
                        LiveChat lc  = new LiveChat();
                        lc.ChatRequest = req;
                        lc.Dock        = DockStyle.Fill;
                        tab.Controls.Add(lc);
                        tabChats.TabPages.Add(tab);
                        tab.Focus();

                        // Add a new TabInfo control
                        TabInfo tabInfo = new TabInfo();
                        tabInfo.ChatId      = req.ChatId;
                        tabInfo.ChatRequest = req;
                        tabInfo.MyTab       = tab;
                        tabInfo.Dock        = DockStyle.Fill;

                        // Get the request
                        if (currentVisitors.ContainsKey(req.VisitorIp))
                        {
                            tabInfo.RequestEntity = currentVisitors[req.VisitorIp] as WebRequest;
                        }

                        chatInfo.Add(tabInfo);
                        RefreshTabInfo();
                    }
                }
            }
        }
Example #5
0
		private void btnInvite_Click(object sender, EventArgs e)
		{
			if (lstVisitors.SelectedIndices.Count > 0)
			{
				List<string> ips = new List<string>();
				foreach(int item in lstVisitors.SelectedIndices)
					ips.Add(lstVisitors.Items[item].SubItems[2].Text);

				if (MessageBox.Show("Are you sure you want to invite " + ips.Count + " visitor(s)?", "LCSK", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
				{
					foreach (string ip in ips)
					{
						ChatRequest req = ws.Invite(new Guid(Program.CurrentOperator.Password), Program.CurrentOperator.OperatorId, ip, "");
						
						// Add a new tab page that will contain the chat session
						TabPage tab = new TabPage(req.VisitorIp);
						LiveChat lc = new LiveChat();
						lc.ChatRequest = req;
						lc.Dock = DockStyle.Fill;
						tab.Controls.Add(lc);
						tabChats.TabPages.Add(tab);
						tab.Focus();

						// Add a new TabInfo control
						TabInfo tabInfo = new TabInfo();
						tabInfo.ChatId = req.ChatId;
						tabInfo.ChatRequest = req;
						tabInfo.MyTab = tab;
						tabInfo.Dock = DockStyle.Fill;

						// Get the request
						if (currentVisitors.ContainsKey(req.VisitorIp))
						{
							tabInfo.RequestEntity = currentVisitors[req.VisitorIp] as WebRequest;
						}

						chatInfo.Add(tabInfo);
						RefreshTabInfo();
					}

					
				}
			}
		}
Example #6
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            // Accept a new chat request
            if (drpChatRequest.SelectedItem != null)
            {
                player.Stop();


                ChatRequest req = (ChatRequest)drpChatRequest.SelectedItem;

                // Remove the chat request from the combo
                drpChatRequest.Items.Remove(req);
                drpChatRequest.Text = string.Empty;

				// Accept the chat request
				ws.AcceptRequest(new Guid(Program.CurrentOperator.Password), req.ChatId, Program.CurrentOperator.OperatorId);

                // Add a new tab page that will contain the chat session
                TabPage tab = new TabPage(req.VisitorIp);
                LiveChat lc = new LiveChat();
                lc.ChatRequest = req;
                lc.Dock = DockStyle.Fill;
                tab.Controls.Add(lc);
                tabChats.TabPages.Add(tab);
                tab.Focus();

                // Add a new TabInfo control
                TabInfo tabInfo = new TabInfo();
                tabInfo.ChatId = req.ChatId;
				tabInfo.ChatRequest = req;
				tabInfo.MyTab = tab;
                tabInfo.Dock = DockStyle.Fill;



                // Get the request
                if (currentVisitors.ContainsKey(req.VisitorIp))
                {
                    tabInfo.RequestEntity = currentVisitors[req.VisitorIp] as WebRequest;
                }


                chatInfo.Add(tabInfo);
                RefreshTabInfo();
            }
        }