DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Determining license mode in Windows Phone 7 apps

Determining license mode in Windows Phone 7 apps

Jevgeni Tšaikin user avatar by
Jevgeni Tšaikin
·
Nov. 22, 11 · Mobile Zone · Interview
Like (0)
Save
Tweet
3.57K Views

Join the DZone community and get the full member experience.

Join For Free

In this post I will show how to separate trial license functionality from full license functionality in Windows Phone 7 applications. Application submitted to a marketplace could be provided with a trial version, so any user can try it before buying.

Additional


  • Creating Trial Applications for Windows Phone (MSDN)
  • LicenseInformation Class
  • Managing Trial Applications for Windows Phone 7


Adding a marketplace namespace

Next you need to add a marketplace namespace within MainPage.xaml (or any other xaml file).

using Microsoft.Phone.Marketplace;

Determining a type of license

Now you can determine a type of license (application mode) using the following code:

if (new LicenseInformation().IsTrial())
{
    // trial mode (trial license)
}
else
{
    // full mode
}

Property

Next I would like to share the property I use in my Windows Phone application to determine if application is in trial mode and to simulate the trial mode for emulator. You can modify the boolean value of _emulatorIsTrial variable to switch emulator between trial and full version.

private const bool _emulatorIsTrial = false;
 
public bool IsTrialMode
{
    get
    {
        if (Microsoft.Devices.Environment.DeviceType
               == Microsoft.Devices.DeviceType.Emulator)
        {
            return _emulatorIsTrial;
        }
        return (new LicenseInformation().IsTrial());
    }
}

Source: http://www.eugenedotnet.com/2010/09/w10-determining-license-mode-in-windows-phone-7-apps/


Windows Phone

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How To Use Cluster Mesh for Multi-Region Kubernetes Pod Communication
  • Top 20 Git Commands With Examples
  • 6 Best Books to Learn Multithreading and Concurrency in Java
  • Types of UI Design Patterns Depending on Your Idea

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo