我有一个使用MKStoreKit的项目的实现问题.我正在尝试实施UIAlertView各种购买选项.
这是我做各种事情并调用的代码UIAlertView:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch
{
if(FALSE == payWallFlag)
{
// Display Alert Dialog
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Subscription Options"
message:@"You do not have an active subscription. Please purchase one of the options below."
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:nil];
[message addButtonWithTitle:@"7 Day Subscription $0.99"];
[message show];
return FALSE;
} else if(TRUE == payWallFlag)
{
// Load content
}
}
Run Code Online (Sandbox Code Playgroud)
这是alertView我试图调用的代码的物理:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if([title …Run Code Online (Sandbox Code Playgroud) 我对这个问题的情况非常相似,因为我有一个登录页面,这是我的MainPage.xaml文件,但是如果用户还没有设置密码,我还有另一个名为SetPassword.xaml的页面.基本上这是应用程序在安装后第一次加载.
我花了好几个小时尝试各种不同的解决方案(包括我链接的那个),但我只是没有得到任何地方,似乎很多解决方案都是针对WP7或WP8而且没有类似的解决方案WP8.1.
这是使用Windows.Storage进行的基本检查,我正在查看是否已设置密码.
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
if (localSettings.Values["myPassword"] == null)
{
Debug.WriteLine("Password not set");
this.Frame.Navigate(typeof(SetPassword));
}
else
{
Debug.WriteLine("Password is set, continuing as normal");
}
Run Code Online (Sandbox Code Playgroud)
如果我将它添加到public MainPage()类中我在调试消息中返回"密码未设置"的应用程序中没有问题,但this.frame.Navigate(typeof(SetPassword))导航从不加载SetPassword视图.
我也尝试过这种方法,OnNavigatedTo结果完全相同.
在我的App.xaml文件中,我也尝试了许多不同的方法,同样的结果.我可以得到调试消息但不是我正在寻找的导航.我看着实现方法Application_Launching 在这里以及对实施条件导航RootFrame.Navigating+= RootFrameOnNavigating; 在这里,但显然我失去了一些东西.
希望你聪明的人可以帮助我根据条件值让我的导航工作?
c# windows-phone windows-runtime windows-phone-8.1 win-universal-app