Skip to content

Instantly share code, notes, and snippets.

View wtuts's full-sized avatar

Windows App Tutorials wtuts

View GitHub Profile
@wtuts
wtuts / trial2.cs
Last active August 29, 2015 14:02
Trial version experience
//This function is for changing the license of app from full version to trial while the app is in debug state.
//Debug state means that app has not been launched in the marketplace and is still under construction
private void Changelicense()
{
#if DEBUG
//Change the variable accordingly
//if you want to implement trial functionality
_isTrial = true;
//else change it to false if you want to test this app in full version
@wtuts
wtuts / trial4.cs
Created June 21, 2014 20:40
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
@wtuts
wtuts / trial5.cs
Created June 21, 2014 20:46
Trail version implementation
//Variable used to indicate whether app is in trial state or not.
private static bool _isTrial = true;
public bool IsTrial
{
get
{
return _isTrial;
}
}
public class AppSettings
{
private static bool displayAds = true;
private static bool isAdBlockerActive = false;
public static bool ISADBLOCKERACTIVE
{
get
{
return isAdBlockerActive;
}
@wtuts
wtuts / App.xaml.cs
Created June 22, 2014 07:42
code for app lauching event handler
AppSettings.ISADBLOCKERACTIVE = Windows.ApplicationModel.Store.CurrentApp.LicenseInformation.ProductLicenses["AdBlocker"].IsActive;
AppSettings.DISPLAYADS = !AppSettings.ISADBLOCKERACTIVE;
@wtuts
wtuts / trial.xaml
Last active August 29, 2015 14:02
Trial version implementation
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="Trial app" Style="{StaticResource PhoneTextNormalStyle}" Margin="12,0"/>
@wtuts
wtuts / adview.xaml
Created June 22, 2014 08:07
block ads using xaml
<GoogleAds:AdView Visibility="{Binding DISPLAYADS, Converter={StaticResource BoolToVisibilityConverter}, Source={StaticResource ApplicationSettings}}" AdUnitID="ca-app-pub-0623406534268990/5403604500" HorizontalAlignment="Left" Margin="-10,0,-14,0" Height="80" Width="480" VerticalAlignment="Top"/>
@wtuts
wtuts / mainpage.xaml.cs
Created June 22, 2014 08:08
block ads using c#
if(AppSettings.DISPLAYADS)
admob(AdGrid);
@wtuts
wtuts / booleantovisibilityconverter.cs
Created June 22, 2014 10:39
boolean to visibility converter class
public class BooleanToVisibilityConverter : IValueConverter
{
//Set to true if you want to show control when boolean value is true
//Set to false if you want to hide/collapse control when value is true
private bool triggerValue = false;
public bool TriggerValue
{
get { return triggerValue; }
set { triggerValue = value; }
}
@wtuts
wtuts / hubtile1.cs
Created June 23, 2014 13:29
Hub tile
public void addhubtile()
{
//Creating a new instance of hub tile
HubTile hub = new HubTile();
hub.Title = "Hubtile";
hub.Message = "Hello everyone";
hub.Notification = "Notify";
hub.DisplayNotification = true;
//adding the hub tile into the grid named contentpannel