小编Lem*_*ngs的帖子

无法确定呼叫者的应用程序身份?

我正在VS2010 for Windows Phone中编写一个Silverlight透视应用程序.我刚刚在这里添加了msdn的示例代码.现在,每当我重新加载设计器时,我都会遇到异常:

无法确定调用者的应用程序标识.

在System.IO.IsolatedStorage.IsolatedStorage.InitStore(IsolatedStorageScope范围,输入appEvidenceType)

在System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(IsolatedStorageScope范围,输入applicationEvidenceType)

在C:..\Settings.cs:第34行的SettingsSample.AppSettings..ctor()中的System.IO.IsolatedStorage.IsolatedStorageSettings.get_ApplicationSettings()

这是Visual Studio/Windows Phone SDK中的错误吗?

这是第34行构造函数中的代码:

public AppSettings()
    {
        // Get the settings for this application.
        try
        {
            settings = IsolatedStorageSettings.ApplicationSettings;
        }
        catch (System.Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
Run Code Online (Sandbox Code Playgroud)

我添加了try-catch以查看发生了什么.

我怀疑Visual Studio(调用者)正在尝试运行代码,但没有关联的应用程序(应用程序标识),因此它失败了.也许?

有什么想法吗?

c# silverlight exception visual-studio-2010 windows-phone-7

13
推荐指数
1
解决办法
9510
查看次数

Windows Phone 7上的Dispatcher.Invoke()?

在回调方法中,我试图获取textBox的text属性,如下所示:

string postData = tbSendBox.Text;
Run Code Online (Sandbox Code Playgroud)

但是因为它没有在UI线程上执行,所以它给了我一个跨线程的异常.

我想要这样的东西:

Dispatcher.BeginInvoke(() =>
{
    string postData = tbSendBox.Text;
});
Run Code Online (Sandbox Code Playgroud)

但这是异步运行的.同步版本是:

Dispatcher.Invoke(() =>
{
    string postData = tbSendBox.Text;
});
Run Code Online (Sandbox Code Playgroud)

但是Windows Phone不存在Dispatcher.Invoke().有没有相当的东西?有不同的方法吗?

这是整个功能:

public void GetRequestStreamCallback(IAsyncResult asynchronousResult)
    {
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;

        // End the operation
        Stream postStream = request.EndGetRequestStream(asynchronousResult);

        string postData = tbSendBox.Text;

        // Convert the string into a byte array.
        byte[] byteArray = Encoding.UTF8.GetBytes(postData);

        // Write to the request stream.
        postStream.Write(byteArray, 0, postData.Length);
        postStream.Close();

        // Start the asynchronous operation to get the response
        request.BeginGetResponse(new …
Run Code Online (Sandbox Code Playgroud)

dispatcher windows-phone-7

4
推荐指数
1
解决办法
6799
查看次数