Skip to content

Instantly share code, notes, and snippets.

@wtuts
Created June 21, 2014 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtuts/896c8f5a9e03e695a48b to your computer and use it in GitHub Desktop.
Save wtuts/896c8f5a9e03e695a48b to your computer and use it in GitHub Desktop.
Trial version implementation
//This function is called whenever we navigate to this page.
//In this function we check whether the appliaction is in trial mode or is running in full license.
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if ((Application.Current as App).IsTrial)
{
//show the status
statusblock.Text = "Trial version";
//add the buy button
buybutton.Visibility = Visibility.Visible;
//disable the second button as it is not available in trial state
secondbutton.IsEnabled = false;
}
else
{
//show the status
statusblock.Text = "Full version";
//remove the buy button
buybutton.Visibility = Visibility.Collapsed;
//enable the second button as it is available in full version
secondbutton.IsEnabled = true;
}
}
//Event handler for first button
private void Firstbuttonclick(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Firstpage.xaml", UriKind.Relative));
}
//Event handler for second button
private void Secondbuttonclick(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/Secondpage.xaml", UriKind.Relative));
}
//Event handler for buy button
private void buybuttonclick(object sender, RoutedEventArgs e)
{
//Task to launch the market place so that user can buy full version of this app
MarketplaceDetailTask marketdetailtask = new MarketplaceDetailTask();
marketdetailtask.Show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment