示例#1
0
        private async void GetFMExtensionsBtn_ClickAsync(object sender, RoutedEventArgs e)
        {
            var context = StoreContext.GetDefault();
            var result  = await WindowsStoreHelpers.PurchaseAddOnAsync(context, "9mzf5cp1mf83");

            if (result == PurchasAddOnReturn.Successful)
            {
                GetFMExtensionsBtn.SetVisibility(false);
                FM_Extensions_Status.Text       = GetUIString("Extensions_Status_Get");
                FM_Extensions_Status.Foreground = Application.Current.Resources["DoubanForeground"] as SolidColorBrush;
                HasFMExtensions = true;
            }
            else if (result == PurchasAddOnReturn.Unknown)
            {
                ReportHelper.ReportAttentionAsync(GetUIString("MS_Server_Boom"));
            }
        }
        private async void Submit_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            if (!HasFMExtensions)
            {
                var context = StoreContext.GetDefault();
                var result  = await WindowsStoreHelpers.PurchaseAddOnAsync(context, "9mzf5cp1mf83");

                if (result == PurchasAddOnReturn.Unknown)
                {
                    ReportHelper.ReportAttentionAsync(GetUIString("MS_Server_Boom"));
                }
                HasFMExtensions = result == PurchasAddOnReturn.Successful ? true : false;
                if (!HasFMExtensions)
                {
                    return;
                }
            }
            NavigateToBase?.Invoke(
                sender,
                null,
                GetFrameInstance(FrameType.LeftPart),
                GetPageType(NavigateType.FM_Extensions));
        }