private void SelectSound_Click(object sender, RoutedEventArgs e) { var button = (Button)sender; var torchPack = TorchPacks.GetPack(CurrentPack); if (IsOwned()) { var torches = torchPack.Torches; var selectedTorch = torches.SingleOrDefault(s => s.Title == (string)button.Tag); if (selectedTorch != null) { AppSettings.SoundOnSetting = selectedTorch.OnSoundLocation; AppSettings.SoundOffSetting = selectedTorch.OffSoundLocation; AppSettings.ImageOnSetting = selectedTorch.OnImageLocation; AppSettings.ImageOffSetting = selectedTorch.OffImageLocation; NavigationService.Navigate(new Uri("/Pages/MainPage.xaml", UriKind.Relative)); } } else { MessageBox.Show("You do not own this torch pack. Hit the 'buy' button to purchase it"); } }
private void SetSource() { var currentPack = TorchPacks.GetPack(CurrentPack); if (IsOwned()) { AvailablePacks.Height = 420; ApplicationBar.IsVisible = false; BuyBlocker.Visibility = Visibility.Collapsed; } else { AvailablePacks.Height = 360; ApplicationBar.IsVisible = true; BuyBlocker.Visibility = Visibility.Visible; } this.AvailablePacks.ItemsSource = currentPack.Torches; AppSettings.CurrentTorchSetSetting = CurrentPack; }
private bool IsOwned() { var isOwned = false; var currentPack = TorchPacks.GetPack(CurrentPack); if (currentPack.IsOwned || AppSettings.LicensesSetting.Contains(currentPack.ProductId)) { isOwned = true; } else { var license = CurrentApp.LicenseInformation.ProductLicenses[currentPack.ProductId]; if (license.IsActive) { // User owns this pack isOwned = true; } } return(isOwned); }
private void BuyPack_Click(object sender, EventArgs e) { PurchaseProduct(TorchPacks.GetPack(CurrentPack).ProductId); }