Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Part 31: Detecting Trial Versions

15 minutes, 54 seconds


Right click “Save as…”

In this final Hands On Lab, we use the CurrentAppSimulator class to simulate interaction with the Windows Store API.  Here we simply use the configuration file to declaratively modify the user interface.  This simulates the data retrieved from the Windows Store.


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • salemsalem

    thank you rly it interested

  • Hello,

    Great videos!!


  • Hey Bob, Did you forget to add the code from Task 2 step 4? ("an override for OnWindowCreated in your App class, so we can catch the window's dispatcher")

    You paste in step 3 at 10:36 in the video, but then proceed to step 5.

  • Also when I have <IsTrial>true</IsTrial> in the license.xml file and I run my app, I don't see the price on the about page unless I drag my mouse over the field (i.e. select it).

  • It looks like you caught your mistake in the next video (part 32).

  • @JohnMarsing: Yes, nice catch ... sorry for the confusion.  I did in fact miss a step, then fixed it in the next lesson.

  • AndersonAnderson

    In Video It seems to Examples in this link http://code.msdn.microsoft.com/windowsapps/Licensing-API-Sample-19712f1a

    If I tried to include this in my project It doesn't works
    Here is my code:

    private async Task LoadTrialModeProxyFileAsync()
    licenseChangeHandler = new LicenseChangedEventHandler(ReloadLicense);

    StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("Data"); //REMOVE FOR RELEASE
    StorageFile proxyFile = await proxyDataFolder.GetFileAsync("trial-mode.xml"); //REMOVE FOR RELEASE
    CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler; //REMOVE FOR RELEASE
    await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); //REMOVE FOR RELEASE

    private void ReloadLicense()
    if (CurrentAppSimulator.LicenseInformation.IsActive)
    if (CurrentAppSimulator.LicenseInformation.IsTrial)
    // Show the features that are available during trial only.
    CONTROLLER.Time = 3;
    // Show the features that are available only with a full license.
    // A license is inactive only when there's an error.

    On the above code Normal mode it will give 5 min. But for trail mode it should complete in 3 min. But, after compiling in debug mode it opening project will goes in 5 min only.
    How could i solve this?

  • @Anderson: Well, from what I can decipher about your code, it looks like this part isn't your problem.  I don't know what the CONTROLLER is, and I don't see where it is observed ... but if you set a break point on that line and run the app in the debugger, I don't doubt that value is being set.  So, I guess, the question is ... is there somewhere else it is being overridden?  Or is it being ignored when you actually use that .Time property elsewhere in your app?  Carefully debug and I'm betting you'll find that something else is at play here.  I would need to see more before I could comment further.  Good luck!

  • Vance Lee MeurerVanceLee​Meurer as of 1999

    Did you notice JohnMarsing's comment about the <IsTrial> issue.  In our screens only the ABOUT has a darker background.  The wording for "Contso Cookbook" and "Trial Version" are black text on white background.  The button is not shown but if I click where the button is, the button text turns black while I depress the button and disappears again when I release.  I reviewed the video several times and never did see where you code was different than mine that would cause this, but this will not stop me from moving forward.  Maybe you also address this in later.  Thanks

  • @VanceLeeMeurer: Yes, actually I do talk about this because it caused quite a bit of confusion for me (and for the creators of the hands on labs) as I was researching all this.  It has to do with the DEFAULT background color of the flyout page.


    The change is subtle ... perhaps I didn't call out enough attention to it and where it diverges from the textual instructions of the HOL ... I believe I solved it using a different property to set the color for the background of the flyout.  Unfortunately, it's been about 6+ months since I had to figure it out and I can't remember the exact solution.  Hopefully that will point you in the right direction.  Sorry for the confusion!

  • BenBen

    Hi Bob.

    Great series. Thanks!
    In response to the background color issue (which I experienced as well), the solution for me was to make the same background color change to app.xaml for the About command that you made in an earlier lab for the Preferences command. So the About command code in OnCommandsRequested becomes:

    // Add an About command
    var about = new SettingsCommand("about", "About", (handler) =>
    var settings = new SettingsFlyout();
    settings.Content = new AboutUserControl();
    settings.HeaderBrush = new SolidColorBrush(_background);
    //settings.Background = new SolidColorBrush(_background);
    settings.ContentBackgroundBrush = new SolidColorBrush(_background);
    settings.HeaderText = "About";
    settings.IsOpen = true;


  • @Ben: Thanks Ben, good solution!  Thanks for writing - bt

  • Najeeb AnwerNajeeb Anwer

    Hi Bob,
    Actually, the easiest solution to the problem of the background color in the flyouts being the same as the text is to change the default theme. In App.xaml, just add RequestedTheme="Light" after the xmlns declarations at the top of the page. This changes the theme from the default of "Dark" to "Light" - the pages in the cookbook will have a white background, but at least everything else will work as it should.

    Thanks for the great training.


  • @Najeeb Anwer: Thank you for posting this solution.

  • Opening comments

Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.