DZone
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
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations

Determining license mode in Windows Phone 7 apps

Jevgeni Tšaikin user avatar by
Jevgeni Tšaikin
·
Nov. 22, 11 · Interview
Like (0)
Save
Tweet
Share
3.75K 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

  • Steel Threads Are a Technique That Will Make You a Better Engineer
  • Spring Boot, Quarkus, or Micronaut?
  • Real-Time Analytics for IoT
  • 5 Software Developer Competencies: How To Recognize a Good Programmer

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • 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: