Sivaraj Velayudham

Sivaraj Velayudham

  • 1.6k
  • 400
  • 120.1k

An exception of type 'System.IO.FileNotFoundException'

Oct 5 2015 3:16 AM
Here i am trying to develop a chat app using xmpp and openfire server in windows phone 8.1.when i am trying to connect with openfire server it showing this error.i tried out many ways but no result and i cannot understand too..(i added username and password in server)
 
this part am getting error.. -ObjXmppClient = new XMPPClient();
 
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.
 
 
 
MY CODE:
 
my code is given below [If it is not the way to connect server using xmpp pls let me know]
<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;
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; }
public MainPage()
{
this.InitializeComponent();
this.NavigationCacheMode = NavigationCacheMode.Required;
}
private void IsXmppValid()
{
//initializing the xmpp client with credentials
ObjXmppClient = new XMPPClient();
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();
}
}
 

Answers (2)