コード例 #1
0
        private void ctxMnuRosterMessage_Click(object sender, EventArgs e)
        {
            ListViewItem itm = GetSelectedListViewItem();

            if (itm != null)
            {
                if (!Util.Forms.ContainsKey(itm.Tag))
                {
                    frmMsg fMsg = new frmMsg(XmppCon, new Jid((string)itm.Tag));
                    fMsg.Show();
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// We received a message
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="msg"></param>
        private void XmppCon_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
            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 OnMessageDelegate(XmppCon_OnMessage), new object[] { sender, msg });
                return;
            }

            // check for xData Message
            Element e = msg.SelectSingleElement(typeof(Data));

            if (e != null)
            {
                Data xdata = e as Data;
                if (xdata.Type == XDataFormType.form)
                {
                    // This is not supported by the WM5 MiniClient sample
                }
            }
            else
            {
                if (msg.Type == MessageType.chat)
                {
                    if (!Util.Forms.ContainsKey(msg.From.Bare))
                    {
                        ListViewItem itm  = FindRosterListViewItem(msg.From);
                        string       nick = itm == null ? msg.From.Bare : itm.Text;

                        frmChat f = new frmChat(msg.From, XmppCon, nick);
                        f.Show();
                        f.IncomingMessage(msg);
                    }
                }
                else if (msg.Type == MessageType.normal)
                {
                    frmMsg fMsg = new frmMsg(msg);
                    fMsg.Show();
                }
                else if (msg.Type == MessageType.headline)
                {
                    // not handeled in this example
                }
            }
        }
コード例 #3
0
        private void mnuSendMessage_Click(object sender, EventArgs e)
        {
            frmMsg f = new frmMsg(this.XmppCon);

            f.Show();
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: phiree/dzdocs
        /// <summary>
        /// We received a message
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="msg"></param>
        private void XmppCon_OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
            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 OnMessageDelegate(XmppCon_OnMessage), new object[] { sender, msg });
                return;
            }

            // check for xData Message
            Element e = msg.SelectSingleElement(typeof(Data));
            if (e != null)
            {
                Data xdata = e as Data;
                if (xdata.Type == XDataFormType.form)
                {
                    // This is not supported by the WM5 MiniClient sample
                }
            }
            else
            {
                if (msg.Type == MessageType.chat)
                {
                    if (!Util.Forms.ContainsKey(msg.From.Bare))
                    {
                        ListViewItem itm = FindRosterListViewItem(msg.From);
                        string nick = itm == null ? msg.From.Bare : itm.Text;

                        frmChat f = new frmChat(msg.From, XmppCon, nick);
                        f.Show();
                        f.IncomingMessage(msg);
                    }
                }
                else if (msg.Type == MessageType.normal)
                {
                    frmMsg fMsg = new frmMsg(msg);
                    fMsg.Show();
                }
                else if (msg.Type == MessageType.headline)
                {
                    // not handeled in this example
                }
            }
        }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: phiree/dzdocs
 private void mnuSendMessage_Click(object sender, EventArgs e)
 {
     frmMsg f = new frmMsg(this.XmppCon);
     f.Show();
 }
コード例 #6
0
ファイル: frmMain.cs プロジェクト: phiree/dzdocs
 private void ctxMnuRosterMessage_Click(object sender, EventArgs e)
 {
     ListViewItem itm = GetSelectedListViewItem();
     if (itm != null)
     {
         if (!Util.Forms.ContainsKey(itm.Tag))
         {
             frmMsg fMsg = new frmMsg(XmppCon, new Jid((string)itm.Tag));
             fMsg.Show();
         }
     }
 }