我认为这是一个非常普遍的问题,但我找不到合适的解决方案.众所周知,WP支持黑暗和浅色主题.用户可以更改主题,并且有多种方法可以覆盖他的决定并在您选择的颜色主题中显示所有内容.但是,我只是想对这两种主题类型做出反应,我想以正确的颜色显示图标.
如果使用应用程序栏,则可以从许多内置图标中进行选择,这些图标将自动从亮到暗反转,反之亦然.
为什么没有对普通图像的支持?例如:我想显示一个电话图标.我从内置图标中选择了一个,并将其从Microsoft SDK文件夹复制到我项目的Image文件夹中.如果用户使用黑暗主题,一切都会很好,因为白色电话图标将在黑色背景上可见.但如果他切换到灯光主题,图标将是隐形的,因为它是白色的白色.
我完全了解文本框或背景颜色的样式资源,它们使用手机的重音或主题颜色.但是为什么不支持我作为Image添加到我的XAML页面的简单图标?
当然,如果用户处于黑暗或轻度模式,我可以在页面的构造函数中检测到.然后我会加载黑色或白色版本的电话图标.但每次访问页面时都会进行此检查,并减慢所有操作.每次添加主题感知图像时手动添加主题检查也很烦人.
有没有解决方案,只适用于XAML?或者至少容易维护?为什么我不能从一开始就使用SDK中的内置图像?它们已经有深色和浅色版本,并且已经在应用程序栏中使用.
我目前正在研究Android Support Package v4 Rev 10的NotificationCompat功能.文档说'setContentText()'显示通知中的第二行.这适用于API 8直到API 15.但是,如果我尝试在API 16中使用此方法,我的通知将错过第二行.我只看到标题而不是第二行.添加多行是没有问题的(使用'addline()').
这是我使用的NotificationCompat.Builder的代码:
private NotificationCompat.Builder buildNormal(CharSequence pTitle) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(
getSherlockActivity());
builder.setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL);
// set the shown date
builder.setWhen(System.currentTimeMillis());
// the title of the notification
builder.setContentTitle(pTitle);
// set the text for pre API 16 devices
builder.setContentText(pTitle);
// set the action for clicking the notification
builder.setContentIntent(buildPendingIntent(Settings.ACTION_SECURITY_SETTINGS));
// set the notifications icon
builder.setSmallIcon(android.R.drawable.stat_sys_download_done);
// set the small ticker text which runs in the tray for a few seconds
builder.setTicker("This is your …Run Code Online (Sandbox Code Playgroud) 有人知道在WP7的Data Protection API中使用了什么加密算法吗?
我已经阅读了一些关于此的MSDN和维基百科文章,但大多数都专注于Windows版的PC版本的DPAPI.我可以假设它是3DES,就像在本白皮书中所述,但我希望AES.在2001年和2011年之间,密码学发生了很多事情:)
任何额外的信息应该高度赞赏:)
我正在尝试将我的 WP8 项目从自制的 MVVM 实现调整为 MVVM Light。我已经成功地完成了这个例子,而且效果很好。然后我开始为我自己的项目重复相同的步骤。
应用程序编译没有错误,但是当我在 Expression Blend 中打开 MainPage.xaml 时,我会收到此错误:
类 project.Services.IDataService 已经注册。App.xaml,第 6 行,第 5 列
如果我查了一下,它是注册 ViewModelLocator 的那一行:
<Application.Resources>
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
我的 ViewModelLocator.cs:
/// <summary>
/// Initializes a new instance of the ViewModelLocator class.
/// </summary>
public ViewModelLocator()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
if (ViewModelBase.IsInDesignModeStatic)
{
// Create design time view services and models
// see: http://developingux.com/2012/06/10/how-to-fix-error-design-time-data-in-blend-with-mvvm-light/
if (!SimpleIoc.Default.IsRegistered<IDataService>())
{
SimpleIoc.Default.Register<IDataService, DesignDataService>();
}
}
else
{
// Create run time view …Run Code Online (Sandbox Code Playgroud)