Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
Jay1122 #1
Member since Jun 2014 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: Events not firing.
Hello,
     I am creating a simple login application using agsXMPP v1.1.0.0. The problem i am facing is that, am not able to fire any event. Here is the code that i am working with,

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using agsXMPP;
  11. using System.IO;
  12. using agsXMPP.Xml.Dom;
  13. using agsXMPP.protocol.client;
  14. using agsXMPP.Collections;
  15. using System.Xml;
  16. using System.Collections.ObjectModel;
  17.  
  18. namespace Nuke_Mobileserver
  19. {
  20.     public partial class Form1 : Form
  21.     {
  22.         agsXMPP.XmppClientConnection  h = new agsXMPP.XmppClientConnection ();
  23.         public Form1()
  24.         {
  25.             InitializeComponent();
  26.            
  27.          
  28.         }
  29.  
  30.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  31.         {
  32.             if (checkBox1.Checked == true)
  33.             {
  34.             h.AutoResolveConnectServer = false;
  35.             h.Server = "nimbuzz.com";
  36.             h.ConnectServer = "o.nimbuzz.com";
  37.             h.Port = 5222;
  38.             h.UseSSL = true;
  39.             h.Open(textbox1.text, textbox2.text,textbox3.text, 2);
  40.             h.OnAuthError += new agsXMPP.XmppElementHandler(hahaha);
  41.             }
  42.         }
  43.  
  44.         private void hahaha(object sender, agsXMPP.Xml.Dom.Element e)
  45.         {
  46.             if (base.InvokeRequired)
  47.             {
  48.                 base.BeginInvoke(new XmppElementHandler(hahaha), new object[] { sender, e });
  49.             }
  50.             else
  51.             {
  52.                 checkBox1.Text = "*Wrong password*";
  53.                
  54.             }
  55.         }
And yea, i am trying only wrong username and wrong password. And hence OnAuthError should fire, but it is not !
Am I missing something ?

Ok, now i even added that code to get xml received and send from me like this,

  1.    h.OnReadXml += new XmlHandler(XmppCon_OnReadXml);
  2.    h.OnWriteXml += new XmlHandler(XmppCon_OnWriteXml);
  3.    private void XmppCon_OnReadXml(object sender, string xml)
  4.     {   
  5.         rtfDebug.AppendText("Recv: " + xml);   
  6.     }
  7.      
  8.     private void XmppCon_OnWriteXml(object sender, string xml)
  9.     {
  10.         rtfDebug.AppendText("Send: " + xml);   
  11.     }
even doing this is not firing OnReadXml and OnWriteXml, and my rtfdebug remains empty entire time. I even set a breakpoint at rtfDebug.AppendText("Recv: " + xml);   and  rtfDebug.AppendText("Send: " + xml);   but it never executes ! Any Idea how to make this work ?

I tried something more, I removed agsxmpp v1.1.0.0 refrence and download a fresh and latest copy of agsxmpp v1.3.1.0 and still nothing worked !!

Did one more thing, I added the same refrence to Visual Basic 2010 and It is working fine there but not working in c# !!!! Am i missing something ?
This post was edited 3 times, last on 2014-06-16, 10:28 by Alex.
Edit reason: code formatting
Avatar
Alex #2
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
it does behave exactly the same on vb.net and c#.. There must be a difference in your codes.
Have you looked at the MiniClient exmaple?

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS