Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all i am fed up with these error.I am trying to develop a chat application in windows phone 8.1.i have...

1.openfire server installed
2.using XMPP

when i am trying to connect with server which showing errors..after connnecting how can i send and recive messages.Actualy am xactli new tho this..


this is the error in
    XMPPClient ObjXmppClient = new XMPPClient();


<pre>An exception of type 'System.IO.FileNotFoundException' occurred in xmppStart.exe but was not handled in user code

Additional information: Could not load file or assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. The system cannot find the file specified.</pre>


here is my code



<pre>using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using System.Net.XMPP;
using System.Threading;
using Windows.UI.Popups;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641

namespace xmppStart
{
    public sealed partial class MainPage : Page
    {



        public XMPPClient ObjXmppClient { get; set; }

        public XMPPConnection ObjXmppCon { get; set; }
        public string username = "sree";
        public string password = "sree";
        public readonly string server = "servername";
        private Boolean IsXmppSuccess { get; set; }
        private readonly String ServerIPAddress = "127.0.0.1:9090/";
     




        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;
        }




        

        private void IsXmppValid()
        {

       
            
            XMPPClient ObjXmppClient = new XMPPClient();// here am getting error!!!!!!


            //initializing the xmpp client with credentials
            ObjXmppClient.JID = username + "@" + server;
            ObjXmppClient.Password = password;
            ObjXmppClient.Server = server;  //user server for emulator and ip address for device.
            ObjXmppClient.AutoReconnect = true;
            ObjXmppClient.RetrieveRoster = true;
            ObjXmppClient.PresenceStatus = new PresenceStatus() { PresenceType = PresenceType.available, IsOnline = true };
            ObjXmppClient.AutoAcceptPresenceSubscribe = true;
            ObjXmppClient.AttemptReconnectOnBadPing = true;
            ObjXmppCon = new XMPPConnection(ObjXmppClient);
            ObjXmppCon.Connect();
            ObjXmppClient.Connect();

            //initializing the xmpp connection

            ObjXmppCon.OnAsyncConnectFinished += ObjXmppCon_OnAsyncConnectFinished;
            ObjXmppClient.OnStateChanged += new EventHandler(xMPPClient_OnStateChanged);

        }



        void ObjXmppCon_OnAsyncConnectFinished(xmedianet.socketserver.SocketClient client, bool bSuccess, string strErrors)
        {
            IsXmppSuccess = client.Connected;
        }




        public async void xMPPClient_OnStateChanged(object sender, EventArgs e)
        {
            switch (ObjXmppClient.XMPPState)
            {
                case XMPPState.Ready:


                    if (IsXmppSuccess)
                    {


                        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
                        {


                            Frame.Navigate(typeof(Logedin));


                        });
                    }



                    else
                    {

                        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
                        {


                            MessageDialog msgbox = new MessageDialog("Check server name/IpAddress");


                        });


                    }
                    break;

                case XMPPState.AuthenticationFailed: await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =&gt;
                {


                    MessageDialog msgbox = new MessageDialog("Enter valid username and password");


                    return;

                }); break;
            }
        }



        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
           
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (txtname.Text == string.Empty)
            {
                MessageDialog msgbox = new MessageDialog("enter user name");
                return;
            }
            if (txtpassword.Text == string.Empty)
            {
                MessageDialog msgbox = new MessageDialog("enter password");
                return;
            }

            username = txtname.Text;
            password = txtpassword.Text;
          IsXmppValid();
        }
    }
}</pre>
Posted
Comments
[no name] 28-Sep-15 0:31am    
my code

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using System.Net.XMPP;
using System.Threading;
using Windows.UI.Popups;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641

namespace xmppStart
{
public sealed partial class MainPage : Page
{



public XMPPClient ObjXmppClient { get; set; }

public XMPPConnection ObjXmppCon { get; set; }
public string username = "sree";
public string password = "sree";
public readonly string server = "taurus";
private Boolean IsXmppSuccess { get; set; }
private readonly String ServerIPAddress = "127.0.0.1:9090/";





public MainPage()
{
this.InitializeComponent();

this.NavigationCacheMode = NavigationCacheMode.Required;
}






private void IsXmppValid()
{

XMPPConnection con = new XMPPConnection("sree",);

XMPPClient ObjXmppClient = new XMPPClient();//error here


//initializing the xmpp client with credentials
ObjXmppClient.JID = username + "@" + server;
ObjXmppClient.Password = password;
ObjXmppClient.Server = server; //user server for emulator and ip address for device.
ObjXmppClient.AutoReconnect = true;
ObjXmppClient.RetrieveRoster = true;
ObjXmppClient.PresenceStatus = new PresenceStatus() { PresenceType = PresenceType.available, IsOnline = true };
ObjXmppClient.AutoAcceptPresenceSubscribe = true;
ObjXmppClient.AttemptReconnectOnBadPing = true;
ObjXmppCon = new XMPPConnection(ObjXmppClient);
ObjXmppCon.Connect();
ObjXmppClient.Connect();

//initializing the xmpp connection

ObjXmppCon.OnAsyncConnectFinished += ObjXmppCon_OnAsyncConnectFinished;
ObjXmppClient.OnStateChanged += new EventHandler(xMPPClient_OnStateChanged);

}



void ObjXmppCon_OnAsyncConnectFinished(xmedianet.socketserver.SocketClient client, bool bSuccess, string strErrors)
{
IsXmppSuccess = client.Connected;
}




public async void xMPPClient_OnStateChanged(object sender, EventArgs e)
{
switch (ObjXmppClient.XMPPState)
{
case XMPPState.Ready:


if (IsXmppSuccess)
{


await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{


Frame.Navigate(typeof(Logedin));


});
}



else
{

await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{


MessageDialog msgbox = new MessageDialog("Check server name/IpAddress");


});


}
break;

case XMPPState.AuthenticationFailed: await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{


MessageDialog msgbox = new MessageDialog("Enter valid username and password");


return;

}); break;
}
}



protected override void OnNavigatedTo(NavigationEventArgs e)
{

}

private void Button_Click(object sender, RoutedEventArgs e)
{
if (txtname.Text == string.Empty)
Richard MacCutchan 28-Sep-15 4:21am    
Look at the error message and find out which assembly is missing from your system.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900