在Windows 8 Metro App中使用agsXMPP时出错

时间:2012-11-28 11:01:44

标签: c# windows-8 microsoft-metro agsxmpp

我在Windows 8 Metro应用程序中使用'agsXMPP',

    private void loginclick_Click_1(object sender, RoutedEventArgs e)
    {
        if (!string.IsNullOrEmpty(id.Text) && !string.IsNullOrEmpty(id.Text))
            client.Login(id.Text, pwd.Password);
        client.OnLoginResult = success => appendLog("Connection to Facebook established " + (success ? "" : "un") + "successfully");
        client.OnLogout = () => appendLog("Client logged out");
        client.OnMessageReceived = (msg, user) => appendLog(user.name + ":" + msg);
        client.OnUserIsTyping = user => appendLog("The user " + user.name + " " + (user.isTyping ? "started typing" : "stopped typing"));
        client.OnUserAdded = user =>
        {
            appendLog("User " + user.name + " is now available for chat");
            changeContactList(user.name, true);
        };
        client.OnUserRemoved = user =>
        {
            appendLog("User " + user.name + " is not longer available for chat");
            changeContactList(user.name, false);
        };

        txtMsgInput.KeyUp += new KeyEventHandler(txtMsgInput_KeyDown);
    }

在上面的代码中,此行中出现错误,

    client.OnMessageReceived = (msg, user) => appendLog(user.name + ":" + msg);

错误是,

    Error   8   The type 'agsXMPP.protocol.client.Message' is defined in an assembly that is not referenced. You must add a reference to assembly 'agsXMPP, Version=1.1.1.0, Culture=neutral, PublicKeyToken=ff839b81f1debe86'.

如果我注释掉那一行并执行。它成功执行并获取聊天中可用人员的列表...我检查了这些链接,

http://jefferytay.wordpress.com/2011/12/16/azure-tableservicecontext-presents-an-error-with-createquery-function/

Strange error w/ NinjectValidatorFactory after updating FluentValidation w/ Nuget

但无法理解,有人会简要地告诉我这个错误。 。

提前致谢!

1 个答案:

答案 0 :(得分:1)

这是因为,在这一行

     client.OnMessageReceived = (msg, user) => appendLog(user.name + ":" + msg);

它说缺少对msg的引用

或者你使用string来替换agsXMPP.client.protocol.message(即msg)。 。