none
WINDOWS应用商店应用,试用期问题 RRS feed

  • 问题

  • 我的WINDOWS 8.1应用商店,7天试用版软件,上传到应用商店,让朋友下载试用后,发现关键代码还是没有执行。
    现将部分代码贴在下面,请高明看看,指导一下:

            protected override async void OnNavigatedTo(NavigationEventArgs e)
            {
                await LoadTrialModeProxyFileAsync();
            }
     
            private async Task LoadTrialModeProxyFileAsync()
            {
                licenseChangeHandler = new LicenseChangedEventHandler(TrialModeRefreshScenario);
                CurrentApp.LicenseInformation.LicenseChanged += licenseChangeHandler;
            }


            private void TrialModeRefreshScenario()
            {
                LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
               
                if (licenseInformation.IsActive)
                {
                    if (licenseInformation.IsTrial)
                    {
                        txtblkTryDays.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        var remainingTrialTime = (licenseInformation.ExpirationDate - DateTime.Now).Days;
                        txtblkTryDays.Text = "试用期还剩 " + remainingTrialTime + " 天。";
                    }
                    else
                    {
                        //所有功能都可用
                        btnOk.IsEnabled = true;                             //程序主要按钮功能正常
                        //......
                    }
                }
                else
                {
                    txtblkTryDays.Text = "本程序试用期已过。";
                    btnOk.IsEnabled = false;                             //程序主要按钮无功能
                }
            }


            protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
            {
                if (licenseChangeHandler != null)
                {
                    CurrentApp.LicenseInformation.LicenseChanged -= licenseChangeHandler;
                }
                base.OnNavigatingFrom(e);
            }


    以上是主要代码。从试用情况看,以下代码就没执行:
            if (licenseInformation.IsTrial)
                    {
                        txtblkTryDays.Visibility = Windows.UI.Xaml.Visibility.Visible;
                        var remainingTrialTime = (licenseInformation.ExpirationDate - DateTime.Now).Days;
                        txtblkTryDays.Text = "试用期还剩 " + remainingTrialTime + " 天。";
                    }
                    else
                    {
                        //所有功能都可用
                        btnOk.IsEnabled = true;                             //程序主要按钮功能正常
                        //......
                    }

    不知问题出在哪里?

    2014年3月18日 2:49

答案

全部回复