我正在开始一个WPF项目,刚刚完成了UI的基础,但它似乎非常复杂,所以我不确定我是否已经以正确的方式进行了解决.我不想开始开发后端,并意识到我做错了前提,让自己的生活更加艰难.
从<DIV>和CSS的背景到风格,这是一个很大的不同,并且真的想从一开始就把它弄好.
基本上它是一个星期的日历(7天,周一至周日,默认为当前一周.)最终将链接到数据库,如果我在这一天预约某事,它将在相关日显示.
我选择了Grid而不是ListView,因为它的工作方式我不会将结果绑定到集合或其他任何行.相反,我将在画布中为每个事件填写一个组合框(每天都放在代码中),并且在选择时它将向我显示更多细节.
XAML:
<Window x:Class="WOW_Widget.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:Extensions="clr-namespace:WOW_Widget"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Title="Window1" Height="239" Width="831">
<Window.Resources>
<LinearGradientBrush x:Key="NormalBrush" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="1.0" Color="White"/>
<GradientStop Offset="0.0" Color="LightSlateGray"/>
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="grdDayHeader" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0.0" Color="Peru" />
<GradientStop Offset="1.0" Color="White" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="grdToday" StartPoint="0,0" EndPoint="0,1">
<GradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Offset="0.0" Color="LimeGreen"/>
<GradientStop Offset="1.0" Color="DarkGreen" />
</GradientStopCollection>
</GradientBrush.GradientStops>
</LinearGradientBrush>
<Style TargetType="{x:Type GridViewColumnHeader}">
<Setter Property="Background" Value="Khaki" />
</Style>
<Style x:Key="DayHeader" TargetType="{x:Type Label}">
<Setter Property="Background" …Run Code Online (Sandbox Code Playgroud) 我正在c++使用Visual Studio 2017 开发应用程序。
我正在使用Windows库winscard。我从一个简单的项目开始,在该项目中,我将调用函数SCardEstablishContext作为读取智能卡所需的第一步。
我正在使用的代码段如下:
LONG resContext = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hSC);
if (resContext != SCARD_S_SUCCESS) {
printf("Failed\n");
printf("Error %X\n", resContext);
}
Run Code Online (Sandbox Code Playgroud)
我所知道的是,此功能使用Windows服务(称为“智能卡”)来获取执行数据库操作(读/写卡)的范围。
不幸的是,这个简单的应用程序SCARD_S_SUCCESS仅在Windows 7环境中有效(即返回代码)。在我测试过的所有Windows 10系统中,返回代码始终0x8010001DL与SCARD_E_NO_SERVICE断言的定义相关联:
智能卡资源管理器未运行。
在Windows 7系统上,该程序无需管理员权限即可工作;在Windows 10系统上,我也尝试使用管理员权限,但错误相同。
在我测试的每个Windows 10系统中,我在测试程序之前都手动启动了“智能卡”服务,并在测试过程中检查了该程序是否仍在运行。
在Windows 7和Windows 10系统中,我都没有连接智能卡读卡器。
winscard.lib我使用的文件带有Microsoft Windows SDK版本10.0.17763.0
要使其与Windows 10兼容,还有其他事情要做?