示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="pres"></param>
        private void XmppCon_OnPresence(object sender, Presence pres)
        {
            if (InvokeRequired)
            {
                // Windows Forms are not Thread Safe, we need to invoke this :(
                // We're not in the UI thread, so we need to call BeginInvoke
                BeginInvoke(new OnPresenceDelegate(XmppCon_OnPresence), new object[] { sender, pres });
                return;
            }

            if (pres.Type == PresenceType.subscribe)
            {
                frmSubscribe f = new frmSubscribe(XmppCon, pres.From);
                f.Show();
            }
            else if (pres.Type == PresenceType.subscribed)
            {
            }
            else if (pres.Type == PresenceType.unsubscribe)
            {
            }
            else if (pres.Type == PresenceType.unsubscribed)
            {
            }
            else
            {
                ListViewItem lvi = FindRosterListViewItem(pres.From);
                if (lvi != null)
                {
                    int imageIdx = GetRosterImageIndex(pres);
                    lvi.ImageIndex       = imageIdx;
                    lvi.SubItems[1].Text = pres.Status;
                    lvi.SubItems[2].Text = pres.From.Resource;
                }
            }
        }
示例#2
0
文件: frmMain.cs 项目: don59/agsXmpp
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="pres"></param>
		private void XmppCon_OnPresence(object sender, Presence pres)
		{
			if (InvokeRequired)
			{	
				// Windows Forms are not Thread Safe, we need to invoke this :(
				// We're not in the UI thread, so we need to call BeginInvoke				
				BeginInvoke(new OnPresenceDelegate(XmppCon_OnPresence), new object[]{sender, pres});
				return;
			}

			if (pres.Type == PresenceType.subscribe)
			{
				frmSubscribe f = new frmSubscribe(XmppCon, pres.From);
				f.Show();
			}
			else if(pres.Type == PresenceType.subscribed)
			{

			}
			else if(pres.Type == PresenceType.unsubscribe)
			{

			}
			else if(pres.Type == PresenceType.unsubscribed)
			{

			}
			else
			{
				ListViewItem lvi = FindRosterListViewItem(pres.From);
				if (lvi != null)
				{
					int imageIdx = GetRosterImageIndex(pres);
					lvi.ImageIndex = imageIdx;
					lvi.SubItems[1].Text = pres.Status;
					lvi.SubItems[2].Text = pres.From.Resource;
				}
			}

		}
示例#3
0
文件: frmMain.cs 项目: don59/agsXmpp
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="pres"></param>
		private void XmppCon_OnPresence(object sender, Presence pres)
		{
			if (InvokeRequired)
			{	
				// Windows Forms are not Thread Safe, we need to invoke this :(
				// We're not in the UI thread, so we need to call BeginInvoke				
				BeginInvoke(new OnPresenceDelegate(XmppCon_OnPresence), new object[]{sender, pres});
				return;
			}

			if (pres.Type == PresenceType.subscribe)
			{
				frmSubscribe f = new frmSubscribe(XmppCon, pres.From);
				f.Show();
			}
			else if(pres.Type == PresenceType.subscribed)
			{

			}
			else if(pres.Type == PresenceType.unsubscribe)
			{

			}
			else if(pres.Type == PresenceType.unsubscribed)
			{

			}
			else
			{
                try
                {
                    rosterControl.SetPresence(pres);
                }
                catch(Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
			}

		}