我想实现一个自定义屏幕,通知我的用户我为什么要请求推送通知权限.在他们按下该自定义屏幕中的按钮后,我会显示iOS推送通知权限对话框[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
如果用户尚未看到推送通知权限对话框,我只想显示此自定义屏幕一次.我不能使用,[[UIApplication sharedApplication] enabledRemoteNotificationTypes] == UIRemoteNotificationTypeNone因为如果用户决定不允许推送通知,这也将返回'none'.
任何人的想法?
我有一个简单的问题,但到目前为止我还没有找到答案:如何在C#WinRT/WinMD项目中调整jpeg图像并将其保存为新的jpeg?
我正在开发Windows 8 Metro应用程序,用于从某个站点下载日常图像并将其显示在Live Tile上.问题是图像必须小于1024x1024且小于200kB,否则它将不会显示在磁贴上:http: //msdn.microsoft.com/en-us/library/windows/apps/hh465403.aspx
如果我得到更大的图像,如何调整它以适应Live Tile?我正在考虑简单的调整大小,如宽度/ 2和高度/ 2,同时保持纵横比.
这里的具体要求是代码必须作为Windows运行时组件运行,因此WriteableBitmapEx库在这里不起作用 - 它仅适用于常规WinRT项目.WriteableBitmapEx甚至还有一个分支作为winmd项目,但它还远没有准备好.
下面是我的App.xaml
<Application
x:Class="SpinrWindowsMobile.App"
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"
>
<!--Application Resources-->
<Application.Resources >
<ResourceDictionary>
<local:LocalizedStrings xmlns:local="clr-namespace:SpinrWindowsMobile" x:Key="LocalizedStrings"/>
<converter:TextColorConverter xmlns:converter="clr-namespace:SpinrWindowsMobile.Common" x:Key="TextColorConverter"></converter:TextColorConverter>
</ResourceDictionary>
</Application.Resources>
....
</Application>
Run Code Online (Sandbox Code Playgroud)
我在NameSpace SpinrWindowsMobile.Common中编写了TextColorConverter.cs, 同时启动应用程序它给我异常无法创建类型SpinrWindowsMobile.Common.TextColorConverter的实例.我不知道我错过了哪里.下面是我的TextColorConverter.cs类
class TextColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// some code
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
// some code
}
}
Run Code Online (Sandbox Code Playgroud)
我使用Microsoft Visual Studio 2012 for Windows Phone作为我的开发工具.我要分享的另一件事我没有在System.Windows.Data命名空间中获得ValueConverstionAttribute类.任何人都可以指导我在哪里错了.
我正在尝试编写一个应用程序,其中有几个我需要播放的视频 URL。我正在使用 ExoPlayer 播放视频。
ExoPlayer is playing the videos but the problem i am facing is, ExoPlayer is loading some part of video (let's say 5 seconds) and then playing them and once exo player is done playing that part, it is trying to load next part of video and then playing that part of video. This problem is occurring even when the internet speed is good.
I tried reading ExoPlayer docs and other stackoverflow posts but i am not …
我有一个零售Xbox控制台,该控制台已激活Dev模式(已激活Unity)(最新的免费版本)和一个MSDN个人开发人员帐户。
我能够从Xbox上的Visual Studio部署测试应用程序,但是我想知道如何在Unity的Xbox上构建和运行应用程序?
我联系了unity,他们说我需要我的客户经理的批准,但是我是个人开发人员。
我想做的是从Unity部署到Xbox,我正在从Mac(Windows 10版本)并行运行,但是Mac上安装了Unity。
在Windows应用商店应用中,您可以创建用户控件来封装和重用代码隐藏和布局XAML.简单的用户控件可能如下所示:
<UserControl>
<StackPanel>
<TextBlock Text="First Name" />
<TextBox x:Name="MyTextBox" />
</StackPanel>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
现在,我想设置绑定.因此,我创建了代码隐藏,其属性公开了UI控件的Text属性.像这样的东西:
public string TextBoxText
{
get { return MyTextBoxText.Text; }
set { MyTextBoxText.Text = value; }
}
Run Code Online (Sandbox Code Playgroud)
但是,这不起作用.似乎绑定到用户控件的数据是XAML UI的重要组成部分.但它是如何完成的?
我正在尝试创建一个流/可观察的......
具体的情况是,我需要一个可观察对象,它可以在特定事件发生时进行异步 API 调用,但前提是它有订阅者。我试图避免不必要的 API 调用。
我已经设法创建了一个只有在有这样的订阅者时才会触发的流......
let dataStream = Rx.Observable
.interval(1000) // Fire an event every second
.singleInstance() // Only do something when we have subscribers
.startWith(null) // kick start as soon as something subscribes
.flatMapLatest(interval => SomeAPI.someDataGet()) // get data, returns a promise
Run Code Online (Sandbox Code Playgroud)
这有效。如果我console.log(...)在SomeAPI.someDataGet方法中,我只会看到它在流有订阅者时触发。我的实现看起来非常好,因为我这样做是为了订阅和取消订阅,这非常适合 React 组件生命周期方法。
let sub1;
sub1 = dataStream.subscribe(x => console.log('sub1', x));
sub1.dispose();
Run Code Online (Sandbox Code Playgroud)
我还希望任何新订阅者在订阅时立即收到最新值。这是我挣扎的地方。如果我这样做...
let sub1, sub2;
sub1 = dataStream.subscribe(x => console.log('sub1', x));
setTimeout( () => {
sub2 = dataStream.subscribe(x …Run Code Online (Sandbox Code Playgroud) 我的UWP应用程序未触发OnSuspending事件,但此问题仅发生在运行Windows 10的Windows Phone上.在我的本地计算机或模拟器上将其作为Windows应用商店应用程序运行时,它可以正常工作.
我正在使用此事件在应用程序关闭时保存我的应用程序设置,但这显然会导致Windows手机出现重大问题,因为此事件未触发.
如您所见,OnSuspending事件在应用程序启动时初始化
public App()
{
Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
Microsoft.ApplicationInsights.WindowsCollectors.Session);
this.InitializeComponent();
this.Suspending += OnSuspending;
}
Run Code Online (Sandbox Code Playgroud)
下面是应该调用的OnSuspending代码,但在Windows Phone 10中运行时则不行.
private async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
await Locator.MainPageViewModel.SaveSettings();
deferral.Complete();
}
Run Code Online (Sandbox Code Playgroud)
关于如何解决这个问题的任何想法,还是有潜在的解决方法?
谢谢.
更新1:
当我通过按住标志键并单击十字架以终止它来终止我的应用程序时,关闭应用程序但它仍然不会触发OnSuspending事件,但.net IDE仍然运行.当我按F5再次运行应用程序时,它会触发OnSuspending事件.我的应用程序启动但代码停止在IDE中运行.
我正在用JavaScript开发Windows Phone应用程序.我正在使用AngularJS图书馆.问题是由于安全原因我无法添加动态内容.
我得到的错误: HTML1701: Unable to add dynamic content '<div id="view_login" class="view"> <div id="view_login_container"> <img class="logo" src="http://oi60.tinypic.com/okwifa.jpg"> <input type="text" placeholder="Username" ng-model="loginUsername"> <input type="password" placeholder="******" ng-model="loginPassword"> <button ng-click="doLogin()">Login</button> <button ng-click="changeView('/signup')" class="link">... or sign up now</button> </div> </div>'. A script attempted to inject dynamic content, or elements previously modified dynamically, that might be unsafe. For example, using the innerHTML property to add script or malformed HTML will generate this exception. Use the toStaticHTML method to filter dynamic content, or explicitly …
我需要将我的应用程序的所有权转让给 Windows Marketplace 上的其他人。
该过程在Apple的App Store和Google的Play Store上很容易,但在Windows Marketplace上找不到解决方案。
我在我的xaml中定义了这个内容对话框:
<ContentDialog x:Name="AlertMessage" Background="#363636" IsSecondaryButtonEnabled="True" SecondaryButtonText="Cancel" IsPrimaryButtonEnabled="True" PrimaryButtonText="Ok" >
<ContentDialog.Content>
<StackPanel Name="rootStackPanel" Height="Auto" >
<StackPanel Margin="0">
<StackPanel Margin="0,0,0,10" Orientation="Horizontal">
<TextBlock x:Name="HeadingText" x:FieldModifier="public" Style="{StaticResource ApplicationMessageBoxHeadingStyle}" Text="Alert" />
<Image Margin="10,05,0,0" Source="/Assets/Images/alert.png" Width="35"></Image>
</StackPanel>
<TextBlock x:FieldModifier="public" x:Name="ContentText" Style="{StaticResource ApplicationMessageBoxErrorStyle}" Text="Are you sure you want to log off ?" />
</StackPanel>
</StackPanel>
</ContentDialog.Content>
</ContentDialog>
Run Code Online (Sandbox Code Playgroud)
而我这样称呼它:
private void AppBarButton_Click(object sender, RoutedEventArgs e)
{
MessageBox();
}
private async void MessageBox()
{
ContentDialogResult LogoutDialog = await AlertMessage.ShowAsync();
if (LogoutDialog == ContentDialogResult.Primary)
{
this.Frame.Navigate(typeof(MainPage));
}
else
{
// …Run Code Online (Sandbox Code Playgroud) 在尝试保存图像MediaLibrary时,我收到以下错误
Microsoft.Xna.Framework.ni.dll中出现"System.InvalidOperationException"类型的异常,但未在用户代码中处理
这是我正在使用的代码
if (SourceImage != null) // Source Image is WriteableBitmap
{
var imageArray = SourceImage.ToByteArray(); // WriteableBitmapExWinPhone (extension method)
var res = await SavePhotoToImageHub(imageArray);
await ShowMessage(res ? AppResources.MEDIA_LIBRARY_SUCCESS_MESSAGE : AppResources.MEDIA_LIBRARY_FAILURE_MESSAGE);
}
Run Code Online (Sandbox Code Playgroud)
使用的方法是
private Task<bool> SavePhotoToImageHub(byte[] imageArray)
{
using (var mediaLibrary = new MediaLibrary())
{
var fileName = string.Format("Gs{0}.jpg", Guid.NewGuid());
var picture = mediaLibrary.SavePicture(fileName, imageArray);
if (picture.Name.Contains(fileName)) return Task.FromResult(true);
}
return Task.FromResult(false);
}
Run Code Online (Sandbox Code Playgroud)
我也试过流而不是字节数组.
c# ×7
xaml ×3
javascript ×2
uwp ×2
windows-8 ×2
angularjs ×1
exoplayer ×1
exoplayer2.x ×1
frp ×1
ios ×1
java ×1
mutex ×1
performance ×1
rxjs ×1
styles ×1
unity5 ×1
windows ×1
winjs ×1
winrt-xaml ×1
xbox-one ×1