小编Ric*_*Ric的帖子

使用httpClient.GetAsync时添加标头

我在Windows商店应用程序项目中实现了其他同事与Apiary.io的api.

他们展示了我必须实现的方法的这个例子

var baseAddress = new Uri("https://private-a8014-xxxxxx.apiary-mock.com/");

using (var httpClient = new HttpClient{ BaseAddress = baseAddress })
{
    using (var response = await httpClient.GetAsync("user/list{?organizationId}"))
    {
        string responseData = await response.Content.ReadAsStringAsync();
    }
}
Run Code Online (Sandbox Code Playgroud)

在这个和其他一些方法中,我需要一个带有我之前获得的标记的标题

下面是一个邮递员(镀铬扩展)的图像,标题我正在谈论 在此输入图像描述

如何将该授权标头添加到请求中?

c# windows-runtime dotnet-httpclient windows-store-apps apiary.io

117
推荐指数
6
解决办法
16万
查看次数

在telerik网格上的列中使用控件

在asp.net mvc页面中我使用的telerik网格看起来像这样

    <div>
    @(Html.Kendo().Grid<Project.Models.Bench>
        ()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.name).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")));
            columns.Bound(p => p.seatsCount).Filterable(ftb => ftb.Cell(cell => cell.Operator("gte")));
            columns.Bound(p => p.bookedSeats).Filterable(ftb => ftb.Cell(cell => cell.Operator("gte")));
        })

.Pageable()
.Sortable()
.Scrollable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
            //.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
    //.ServerOperation(true)
.Read(read => read.Action("GetBenches", "home"))
)
    )
</div>
Run Code Online (Sandbox Code Playgroud)

这是我的Bench类:

public class Bench
{
    public int id { get; set; }
    public string name { get; set; }
    public bool bookable { get; …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc telerik telerik-grid

10
推荐指数
1
解决办法
180
查看次数

以编程方式访问应用程序通知

在Android应用程序中,我有一个按钮,我想要具有打开应用程序通知设置的功能(在Android设置中).

Android应用程序的Android通知设置的屏幕截图

我可以用这个打开Android设置

startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
Run Code Online (Sandbox Code Playgroud)

但我想直接在我的应用通知设置上打开

替代

如果有办法以编程方式打开和关闭"阻止通知"也可以.

android android-notifications android-settings

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

Asp.net 和 Kerberos 身份验证

Asp.net MVC我正在尝试使用身份验证进行操作Kerberos。\n到目前为止我还没有找到如何实现这一点的好例子。

\n\n

Kerberos我如何在 ASP.net 上实现用户访问 API 服务器(我可以在页面上显示信息,例如用户列表、文件列表等)之类的功能

\n\n

我看到的许多网站都有已退役的内容或已过时,例如这个\n https://msdn.microsoft.com/en-us/library/ff649207.aspx

\n\n

Kerberos 还使用 Windows 帐户凭据还是可以是其他凭据?

\n\n

现在我只有一个使用 Visual Studio 2013 创建的 ASP.net MVC 默认模板(在创建项目时我勾选了使用 Windows 身份验证)\n当我运行页面时,我得到一个 Hello,domain\\user!)。

\n\n

抱歉,如果这看起来是一个愚蠢的问题,但我不知道从哪里开始。

\n

asp.net asp.net-mvc kerberos windows-authentication

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

Keydown事件发生两次

在Windows商店App上,我有这个简单的TextBox

<TextBox Name="TextBoxUser" HorizontalAlignment="Right" Width="147" Margin="20,0,0,0" KeyDown="TextBox_KeyDown" /
Run Code Online (Sandbox Code Playgroud)

这有一个与之关联的KeyDown事件.

        private async void TextBox_KeyDown(object sender, KeyRoutedEventArgs e)
    {
        if (e.Key == Windows.System.VirtualKey.Enter)
        {
           Debug.WriteLine("LA");
        }
    }
Run Code Online (Sandbox Code Playgroud)

这个函数的输出是:


LA
LA

虽然我只按一下Enter键,但它会打印2次.任何原因或我做错了什么?

c# xaml windows-runtime windows-store-apps

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

使用SimpleDateFormat时,未知的模式字符'x'

我试图将a格式化DateString使用SimpleDateFormat,而im使用的模式就是这个

"YYYY-MM-dd'T'HH:MM:ss.SSSxxx"

但到达这条线时

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSxxx");
Run Code Online (Sandbox Code Playgroud)

我得到以下异常:

java.lang.IllegalArgumentException:在java.text.SimpleDateFormat的java.text.SimpleDateFormat.validatePattern(SimpleDateFormat.java:312)的java.text.SimpleDateFormat.validatePatternCharacter(SimpleDateFormat.java:323)中的未知模式字符'x'. SimpleDateFormat.java:365)at java.text.SimpleDateFormat.(SimpleDateFormat.java:258)

我试图实现的格式是" 2017-06-16T12:19:59.001 + 02:00 "

根据文档这个模式应该工作什么错了?

编辑 为了澄清,我尝试了xxx和XXX

在XXX的情况下我得到java.lang.IllegalArgumentException:未知的模式字符'X'

java android simpledateformat android-date

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

如何在Windows 8商店应用中更改组合框箭头颜色

我在Windows商店应用程序项目中有这个组合框

<ComboBox  Grid.Row="2" x:Name="ContactoSelect" Width="200" Height="50" Margin="114,10,27,510" SelectedIndex="0" Background="White" SelectionChanged="ContactoSelect_SelectionChanged">
    <x:String>Item 1</x:String>
    <x:String>Item 2</x:String>
    <x:String>Item 3</x:String>
</ComboBox>
Run Code Online (Sandbox Code Playgroud)

我想改变箭头的颜色,默认是黑色.我怎样才能做到这一点?

c# xaml combobox windows-8 windows-store-apps

3
推荐指数
1
解决办法
1936
查看次数

图像作为地图上的图钉 - Windows Phone 8

我试图将图像添加到Windows Phone 8地图,作为图钉

我的XAML上有以下代码

<phone:PhoneApplicationPage
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:maps="clr-namespace:Microsoft.Phone.Maps.Controls;assembly=Microsoft.Phone.Maps"
x:Class="Cartuxa.Contactos"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot">
    <Grid.Background>
        <ImageBrush ImageSource="/Assets/Images/bkContacts@2x.png"/>
    </Grid.Background>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel Grid.Row="0" Margin="12,17,0,28"/>

    <Grid x:Name="ContentPanel" Grid.RowSpan="2" Margin="0,-6,0,6">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="127*"/>
            <ColumnDefinition Width="329*"/>
        </Grid.ColumnDefinitions>
        <Image HorizontalAlignment="Left" Margin="18.75,57.5,0,0" VerticalAlignment="Top" Source="/Assets/Images/logo@2x.png" Stretch="Fill" Grid.ColumnSpan="2" Width="221" Height="72"/>
        <TextBlock HorizontalAlignment="Left" …
Run Code Online (Sandbox Code Playgroud)

c# xaml here-api windows-phone windows-phone-8

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

使用 Salt/IV 创建/解密密码

我被要求在一个涉及 Windows 8 加密的项目中执行一项任务。

场景是这样的:

byte[]从服务器得到一个,前 16 个字节是IV,接下来的 128 个是Salt,其余的是文件本身。

然后用户提供一个密码,并使用该密码和盐,我应该创建一个 PKCS5 密钥,迭代 40 次,密钥长度应为 32 字节。

现在我已经拆分了byte[]我需要的 3 个,但我不知道其余的在 Windows C# 中是如何完成的。

c# encryption cryptography windows-runtime windows-store-apps

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