小编Nii*_*yea的帖子

创建JObject时的参数异常

如果我有这个方法:

public void doSomething (Dictionary<String, Object> data)
{
    JObject jsonObject = new JObject(data);
    ...
}
Run Code Online (Sandbox Code Playgroud)

我得到了一个System.ArgumentException我创建JObject的行.我正在使用Newton-King的Json.net包装器.

我得到的错误是:

Newtonsoft.Json.DLL中出现'System.ArgumentException'类型的第一次机会异常Newtonsoft.Json.DLL中出现类型'System.ArgumentException'的异常,但未在用户代码中处理

我在这做错了什么?

c# json json.net

45
推荐指数
1
解决办法
2万
查看次数

如何为stackpanel实现click事件

我在这里查看了stackpanel类http://msdn.microsoft.com/en-us/library/system.windows.controls.stackpanel.aspx,它没有点击事件.

我正在开发一个Windows Phone 8应用程序,我有一个文本框和堆栈面板上的一些按钮.我想要包含一个可以单击stackpanel的功能,然后将其上的控件的可见性设置为折叠,然后再次单击它们时,它们将变为可见.

我该怎么做呢?

c# visibility stackpanel windows-phone-8

6
推荐指数
3
解决办法
2万
查看次数

在 Windows Phone 8 中使用 HttpClient 执行 POST 时出现内部服务器错误

我以这种方式将字符串发布到网络服务器:

private async Task makeRequest(string url, string postData)
    {
        HttpClient client = null;
        HttpResponseMessage response = null;
        try
        {
            client = new HttpClient();
            response = await client.PostAsync(url, new StringContent(postData));

            response.EnsureSuccessStatusCode();
            Debug.WriteLine(response.StatusCode + " " + response.ReasonPhrase);
        }
        catch (HttpRequestException e)
        {
            Debug.WriteLine(e.Message);
        }
    }
Run Code Online (Sandbox Code Playgroud)

response.EnsureSuccessStatusCode();抛出一个HttpRequestException. e.Message当我对异常进行处理时,它说: Response status code does not indicate success: 500 (Internal Server Error).

我做错了什么导致出现该错误?我该如何纠正它?

c# internal-server-error dotnet-httpclient windows-phone-8 asynchttpclient

6
推荐指数
2
解决办法
3万
查看次数

Windows手机设备中的哪个位置/存储了SQLite db文件?

我正在开发一个涉及SQLite的WP8应用程序.因此,当执行创建和填充数据库的代码时,我想确保在设备上真正创建了db文件,并使用SQLite浏览器验证其内容.

在创建数据库时,我指定了位置,ApplicationData.Current.LocalFolder但我不知道设备指向的确切位置.

我可以在设备中的哪个位置找到SQLite db文件?

sqlite windows-phone-8

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

如何获取视频缩略图路径,而不是位图

这个问题实际上是在这里被问到并且应该回答:android获取视频缩略图PATH,而不是Bitmap.

我已经尝试了好几次但却无法上班.我总是得到null返回.对此有何帮助?

编辑: 我现在使用的示例代码:

public static String getVideoThumbnailPath(Context context,
        String filePath) {
    String thubmnailPath;
    String where = Video.Thumbnails.VIDEO_ID
            + " In ( select _id from video where _data =?)";
    final String[] VIDEO_THUMBNAIL_TABLE = new String[] { Video.Media._ID, // 0
            Video.Media.DATA, // 1
    };
    Uri videoUri = MediaStore.Video.Thumbnails.getContentUri("external");

    Cursor c = context.getContentResolver().query(videoUri,
            VIDEO_THUMBNAIL_TABLE, where, new String[] { filePath }, null);

    if ((c != null) && c.moveToFirst()) {
        thubmnailPath = c.getString(1);
        c.close();
        Log.i(TAG, "thumb path: " + thubmnailPath);
        return thubmnailPath; …
Run Code Online (Sandbox Code Playgroud)

android thumbnails

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

将自定义字体添加到Windows Phone 8应用程序

我读过这样的文章,比如这31天的windows phone第24天嵌入字体和这个windows 8 xaml提示自定义字体,解释非常清楚,简单如何做到这一点.

但由于某些原因我无法弄清楚,我的自定义字体不会显示在我的应用程序上,无论是在设计器视图中还是在我运行它时.

为了确保我没有离开任何一步,我正在展示我在这里所做的任何有关我的问题的建议:

1.首先,这是我的xaml文本块代码

<StackPanel Grid.Row="1" x:Name="BottomPanel" Height="120" Width="800" Orientation="Horizontal">
            <StackPanel.Background>
            <SolidColorBrush Color="{StaticResource PhoneSemitransparentColor}"/>
            </StackPanel.Background>
            <TextBlock x:Name="MainTextBlock" FontFamily="/Fonts/KOMIKAX_.ttf" TextWrapping="Wrap" Text="Hello" Width="680" Height="120" Margin="10,0,0,0" FontSize="25" Padding="20,10"/>

</StackPanel>
Run Code Online (Sandbox Code Playgroud)

2.我在项目中创建了一个文件夹,称为"字体",这是我复制字体文件的地方.

3.Build Action将字体文件更改为Content.我最初离开了Copy To Output Directory酒店None,然后改为Copy If Newer.没有成功.

我做错了什么或者我遗漏了什么?

c# fonts xaml windows-phone-8

2
推荐指数
1
解决办法
8595
查看次数

像在Play商店应用中一样创建自定义列表视图布局

播放商店图片

大家好,我想创建一个像这样的listview项目/行.我理解如何创建一个自定义列表视图和适配器,但得到一个每个列表项/行有点"站在自己的"我无法弄清楚.

怎么会创造这样的东西?

编辑:在dcharms建议,我试过这个:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/darker_gray" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:background="@android:color/white"
    android:orientation="horizontal" >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:contentDescription="@string/none"
        android:src="@drawable/logo" />

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:minHeight="?android:attr/listPreferredItemHeight"
        android:text="@string/none" />
</LinearLayout>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

但它甚至没有我想要的东西.我只是不确定我会怎么做.任何帮助都会很棒.

xml android android-layout

2
推荐指数
1
解决办法
5295
查看次数