我正在尝试将我的Windows Phone 8 Silverlight应用程序转换为8.1手机应用程序,作为通用应用程序的一部分.我不知道那是否相关,因为这是我第一次尝试正确实现视图模型.我想在Windows和Windows Phone中的视图之间共享数据.无论如何,这是我得到的错误.
Error 3 Type not found in cache: ScoreAlerts.ViewModel.FixturesViewModel. C:\Users\Dave\Documents\Visual Studio 2012\Projects\Score Alerts\ScoreAlerts\ScoreAlerts.WindowsPhone\Pages\Fixtures.xaml 9 5 ScoreAlerts.WindowsPhone
Error 4 Type not found in cache: ScoreAlerts.ViewModel.HomePageViewModel. C:\Users\Dave\Documents\Visual Studio 2012\Projects\Score Alerts\ScoreAlerts\ScoreAlerts.Shared\Pages\HomePage.xaml 34 9 ScoreAlerts.WindowsPhone
Run Code Online (Sandbox Code Playgroud)
这就是我的视图模型定位器的外观
public class ViewModelLocator
{
/// <summary>
/// Initializes a new instance of the ViewModelLocator class.
/// </summary>
public ViewModelLocator()
{
if (!ViewModelBase.IsInDesignModeStatic)
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
if (ViewModelBase.IsInDesignModeStatic)
{
// Create design time view services and models
//SimpleIoc.Default.Register<IDataService, DesignDataService>();
}
else
{
// Create …Run Code Online (Sandbox Code Playgroud) 我正在尝试在PHP中为Windows应用商店应用验证IAP收据.基本上,尝试将此示例代码转换为PHP http://msdn.microsoft.com/en-us/library/windows/apps/jj649137.aspx.收据看起来像这样
<Receipt Version="1.0" ReceiptDate="2012-08-30T23:08:52Z" CertificateId="b809e47cd0110a4db043b3f73e83acd917fe1336" ReceiptDeviceId="4e362949-acc3-fe3a-e71b-89893eb4f528">
<ProductReceipt Id="6bbf4366-6fb2-8be8-7947-92fd5f683530" ProductId="Product1" PurchaseDate="2012-08-30T23:08:52Z" ExpirationDate="2012-09-02T23:08:49Z" ProductType="Durable" AppId="55428GreenlakeApps.CurrentAppSimulatorEventTest_z7q3q7z11crfr" />
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
<Reference URI="">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
<DigestValue>Uvi8jkTYd3HtpMmAMpOm94fLeqmcQ2KCrV1XmSuY1xI=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>TT5fDET1X9nBk9/yKEJAjVASKjall3gw8u9N5Uizx4/Le9RtJtv+E9XSMjrOXK/TDicidIPLBjTbcZylYZdGPkMvAIc3/1mdLMZYJc+EXG9IsE9L74LmJ0OqGH5WjGK/UexAXxVBWDtBbDI2JLOaBevYsyy+4hLOcTXDSUA4tXwPa2Bi+BRoUTdYE2mFW7ytOJNEs3jTiHrCK6JRvTyU9lGkNDMNx9loIr+mRks+BSf70KxPtE9XCpCvXyWa/Q1JaIyZI7llCH45Dn4SKFn6L/JBw8G8xSTrZ3sBYBKOnUDbSCfc8ucQX97EyivSPURvTyImmjpsXDm2LBaEgAMADg==</SignatureValue>
</Signature>
</Receipt>
Run Code Online (Sandbox Code Playgroud)
我已经为这样的服务器检索了证书
function getCertificate($certID)
{
$url = 'https://lic.apps.microsoft.com/licensing/certificateserver/?cid=' . $certID;
$path = '/mypath/certs/' . $certID;
if(!file_exists($path)) {
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
curl_close($ch);
fclose($fp);
}
$cert = file_get_contents($path);
//var_dump(openssl_x509_parse($cert));
return openssl_x509_read($cert);
} …Run Code Online (Sandbox Code Playgroud) 有没有办法ListViewItem在ListViews选择发生变化时获取容器.我试过用了
listView.ItemContainerGenerator.ContainerFromItem(listView.SelectedItem);
Run Code Online (Sandbox Code Playgroud)
从ListViews选择更改事件但这总是返回null.我有什么想法我做错了吗?
我在我的Unity应用程序中遇到了一个问题,Android构建在运行Android 4.3的设备上启动时崩溃该应用程序加载了我在后台播放音乐而应用程序暂停时编写的本机插件.它正在使用Android MediaBrowser API,因此我使用的是"Compat"版本,因此请继续支持以前版本的Android.
06-07 09:59:37.000: E/AndroidRuntime(1748): FATAL EXCEPTION: main
06-07 09:59:37.000: E/AndroidRuntime(1748): java.lang.Error: FATAL EXCEPTION [main]
06-07 09:59:37.000: E/AndroidRuntime(1748): Unity version : 5.6.1f1
06-07 09:59:37.000: E/AndroidRuntime(1748): Device model : samsung GT-I9300
06-07 09:59:37.000: E/AndroidRuntime(1748): Device fingerprint: samsung/m0xx/m0:4.3/JSS15J/I9300XXUGMK6:user/release-keys
06-07 09:59:37.000: E/AndroidRuntime(1748): Caused by: java.lang.RuntimeException: Unable to create service com.help.stressfree.mediabrowser.MusicService: java.lang.IllegalArgumentException: MediaButtonReceiver component may not be null.
06-07 09:59:37.000: E/AndroidRuntime(1748): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2697)
06-07 09:59:37.000: E/AndroidRuntime(1748): at android.app.ActivityThread.access$1700(ActivityThread.java:159)
06-07 09:59:37.000: E/AndroidRuntime(1748): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1404)
06-07 09:59:37.000: E/AndroidRuntime(1748): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 09:59:37.000: E/AndroidRuntime(1748): at …Run Code Online (Sandbox Code Playgroud) 运行Unity应用程序时,我遇到了类错误。我有一个本机代码库,我将其编写为aar。我刚刚更新了一些代码来支持Android 8上的本地通知,并且使用了Android X“ Worker”类。我的aar编译正常,但我想我缺少要包含在Unity项目中的库。我应该添加哪个库?
错误是
06-05 10:57:52.970: E/AndroidRuntime(21759): FATAL EXCEPTION: IntentService[com.help.stressfree.localnotifications.NotificationService]
06-05 10:57:52.970: E/AndroidRuntime(21759): Process: com.help.stressfree, PID: 21759
06-05 10:57:52.970: E/AndroidRuntime(21759): java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/work/Data$Builder;
06-05 10:57:52.970: E/AndroidRuntime(21759): at com.help.stressfree.localnotifications.NotificationService.ScheduleNotification(NotificationService.java:99)
06-05 10:57:52.970: E/AndroidRuntime(21759): at com.help.stressfree.localnotifications.NotificationService.onHandleIntent(NotificationService.java:82)
06-05 10:57:52.970: E/AndroidRuntime(21759): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
06-05 10:57:52.970: E/AndroidRuntime(21759): at android.os.Handler.dispatchMessage(Handler.java:105)
06-05 10:57:52.970: E/AndroidRuntime(21759): at android.os.Looper.loop(Looper.java:164)
06-05 10:57:52.970: E/AndroidRuntime(21759): at android.os.HandlerThread.run(HandlerThread.java:65)
06-05 10:57:52.970: E/AndroidRuntime(21759): Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.work.Data$Builder" on path: DexPathList[[zip file "/data/app/com.help.stressfree-FN_ED1fyI9LY4tcsB1RWqQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.help.stressfree-FN_ED1fyI9LY4tcsB1RWqQ==/lib/arm, /data/app/com.help.stressfree-FN_ED1fyI9LY4tcsB1RWqQ==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
06-05 10:57:52.970: E/AndroidRuntime(21759): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
06-05 …Run Code Online (Sandbox Code Playgroud) 我正在使用此代码反序列化Object
PlayerData = JsonConvert.DeserializeObject<UserData>(response.Content);
Run Code Online (Sandbox Code Playgroud)
我的UserData类如下
public class UserData : BindableBase
{
public string UID { get; set; }
public string UDID { get; set; }
public object liveID { get; set; }
public int timeLastSeen { get; set; }
public string country { get; set; }
public string username { get; set; }
public string session { get; set; }
public int serverTime { get; set; }
public int PremiumCurrency { get; set; }
public UserData()
{
}
}
Run Code Online (Sandbox Code Playgroud)
当它反序列化时,我得到一个返回的对象,就像我刚刚调用一样, …
我正在尝试创建一个CSS样式,它将拍摄图像并将其缩放到最适合信箱形状的div.溢出将被裁掉.我很接近这个,目前看起来像这样:
原始图像是
我想修改它,以便图像在div中垂直居中而不是顶部对齐.我在这里错过了什么?我的HTML是
.crop {
width: 670px;
height: 200px;
overflow: hidden;
}
.crop img {
width: 670px;
}Run Code Online (Sandbox Code Playgroud)
<div class='crop'>
<img src='http://cycle.travel/images/600/amsterdam_ccby_conor_luddy.jpg' />
</div>Run Code Online (Sandbox Code Playgroud)
我无法假设图像的高度在我使用它的任何地方都是一样的.
我正在编写通用Windows应用程序,我有一个ListView,其中ListViewItems包含TextBox和Button.当我单击文本框时,我希望ListViewItem被选中.我找到了WPF的解决方案,但是UWP中没有Style.Triggers.任何人都可以指出我这样做的正确方法吗?
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:CycleStreetsUniversal.Controls"
xmlns:common="using:CycleStreetsUniversal.Common"
xmlns:utils="using:CycleStreetsUniversal.Utils"
xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core"
xmlns:converters="using:CycleStreetsUniversal.Converters"
x:Class="CycleStreetsUniversal.Pages.HomePage"
mc:Ignorable="d" FontWeight="Light">
<Page.Resources>
<DataTemplate x:Key="DirectionItem">
<Grid Padding="8,6,0,6">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<AutoSuggestBox x:Name="autoSuggestBox" PlaceholderText="{Binding Watermark}" QueryIcon="Find" Text="{Binding LocationName}" />
<Button Grid.Column="2" Visibility="{Binding ShowAddButton, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button Grid.Column="1" Visibility="{Binding ShowMinusButton, Converter={StaticResource BooleanToVisibilityConverter}}" />
</Grid>
</DataTemplate>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid x:Name="Directions" HorizontalAlignment="Left" Margin="0" Width="346" DataContext="{Binding DirectionPlanner, Mode=OneWay, Source={StaticResource Locator}}">
<Grid.Background>
<SolidColorBrush Color="{ThemeResource SystemAltHighColor}"/>
</Grid.Background>
<StackPanel VerticalAlignment="Top">
<ListView x:Name="DirectionEntryList" ItemTemplate="{StaticResource DirectionItem}" ItemsSource="{Binding Entries}">
<ListView.ItemContainerStyle>
<Style …Run Code Online (Sandbox Code Playgroud) 我正在尝试从我的服务器传递数据并将其显示在UWP Windows应用程序中.数据存储在mySQL数据库中
这是通过PHP输出到这里的网页http://www.rwscripts.com/scorealerts/v3/request.php?action=getTeams使用此代码
// Serialize the data structure
$result = json_encode($data,JSON_PRETTY_PRINT);
// Display the XML document
header('Content-type: application/json; charset=utf-8');
print $result;
Run Code Online (Sandbox Code Playgroud)
然后我在我的应用程序中使用HttpWebRequest读取它,然后使用JSON.net反序列化JSON
JArray obj = JsonConvert.DeserializeObject(str.Trim()) as JArray;
if (obj == null || obj.Count == 0) return;
foreach (NotificationTeam nt in from JObject team in obj
select
new NotificationTeam
{
Title = team.Value<string>("teamName"),
TeamID = team.Value<int>("tid"),
Followers = team.Value<int>("followers")
})
{
nt.Notifications = ScoreManager.GetMgr().GetTeamNotification(nt.TeamID);
notificationTeams.Add(nt);
}
Run Code Online (Sandbox Code Playgroud)
在我的应用程序中显示的输出是这样的
需要更改流的哪一部分才能正确显示unicode字符?
我尝试$localize在我的 ts 文件中使用时遇到一个奇怪的错误。我收到这个错误
Error: Uncaught (in promise): TypeError: _angular_localize_init__WEBPACK_IMPORTED_MODULE_3__.$localize is not a function
TypeError: _angular_localize_init__WEBPACK_IMPORTED_MODULE_3__.$localize is not a function
Run Code Online (Sandbox Code Playgroud)
我的模板文件中有本地化工作,并且调用时没有错误ng build。$localize该错误发生在运行时调用包含该方法的组件时。我的ts代码是
private handleServerErrors(error: HttpErrorResponse): void {
// Handle errors
this.complete = true;
switch (error.status) {
...
case 500:
default:
// Could not update user
this.errorMessage = $localize`:@@CalmBreathing_Desc_Short:Cobblers`;
break;
}
console.error(error);
}
Run Code Online (Sandbox Code Playgroud)
polyfills.ts 文件的顶部有此内容
/***************************************************************************************************
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
Run Code Online (Sandbox Code Playgroud)
这是带有 …
我正在尝试将一些代码移植到WinRT/Metro,我遇到了一个问题,我不确定该解决的问题.似乎Type缺少IsPrimitive和IsSubclassOf(myClass)等的访问函数.有谁知道如何在Windows 8中获得此功能?
我希望我的 xaml 中的文本字段绑定到一个属性PlayerData.Instance.data.MyXP类结构是这样的
class PlayerData
{
public static PlayerData Instance = new PlayerData();
public UserData data {get;set;}
}
class UserData
{
public int MyXP {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释我如何(如果有的话)我可以做到这一点。我从关于 SO 的问题中尝试了多种方法,但没有找到任何成功的方法。我遇到的最大问题是 PlayerData.Instance.data 是在创建 UI 后分配的,所以我可能需要在 UserData 上设置某种通知事件,但在 MyXP 上也需要,因为我希望 UI 在 xp 更改时更新。