Skip to content

Commit

Permalink
change purchase message
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Mar 27, 2016
1 parent 810e067 commit d062117
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 70 deletions.
2 changes: 2 additions & 0 deletions App.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ void App::CheckProductLicense()
HasAds = true;
IsPremium = false;

#ifdef NDEBUG
//bool IsActive = CurrentApp::LicenseInformation->IsActive;
bool IsTrial = CurrentApp::LicenseInformation->IsTrial;
//auto expiredate = CurrentApp::LicenseInformation->ExpirationDate.UniversalTime;
Expand All @@ -76,6 +77,7 @@ void App::CheckProductLicense()

if (CurrentApp::LicenseInformation->ProductLicenses->Lookup("premiumfeatures")->IsActive)
IsPremium = true;
#endif

//revert pixel filter if not premium
if (!App::IsPremium)
Expand Down
3 changes: 3 additions & 0 deletions Assets/vba-over.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
# (Int) International / MultiLingual
# -------------------

# Zelda - A Link to the Past
#[A3AE]
#saveType=0

# Dragon Ball Z - The Legacy of Goku II (Europe)(En,Fr,De,Es,It)
[ALFP]
Expand Down
6 changes: 3 additions & 3 deletions PurchasePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
<LineBreak/>
<LineBreak/>
<Run Text="If you want to take risk**"
x:Uid="PurchaseWarning2"/>
x:Uid="PurchaseWarning3"/>
</TextBlock>

<Button x:Name="loadProductsBtn"
<!--<Button x:Name="loadProductsBtn"
Content="**Load products"
Margin="0,4,0,12"
Click="loadProductsBtn_Click"
x:Uid="LoadProductBtn"
/>
/>-->
<TextBlock Text="**Loading production"
TextWrapping="Wrap"
Margin="0,48,0,12"
Expand Down
130 changes: 65 additions & 65 deletions PurchasePage.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,71 +40,6 @@ PurchasePage::PurchasePage()
}

void PurchasePage::OnNavigatedTo(NavigationEventArgs^ /* e */)
{


}




void PurchasePage::ButtonBuyNow_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
Button^ btn = (Button^)sender;

String^ key = (String^)btn->Tag;


if (!CurrentApp::LicenseInformation->ProductLicenses->Lookup(key)->IsActive)
{

create_task(CurrentApp::RequestProductPurchaseAsync(key))
.then([key, this](task<PurchaseResults^> tresult)
{
try
{
PurchaseResults^ result = tresult.get();
//int test = result->Status;
//reread license
App::CheckProductLicense();

if (CurrentApp::LicenseInformation->ProductLicenses->Lookup(key)->IsActive)
{
auto loader = Windows::ApplicationModel::Resources::ResourceLoader::GetForViewIndependentUse();

//prompt user to restart app if it's ad removal
if (key == "removeads" || key == "noads_premium")
{
MessageDialog ^dialog = ref new MessageDialog(loader->GetString("PurchaseSuccessNoAdsText"));
dialog->ShowAsync();
}

if (key == "premiumfeatures")
{
MessageDialog ^dialog = ref new MessageDialog(loader->GetString("PurchaseSuccessText"));
dialog->ShowAsync();
}

this->OnNavigatedTo(nullptr);
}

}
catch (Exception^)
{ }

}, task_continuation_context::use_current());







}
}


void PurchasePage::loadProductsBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
this->txtLoading->Visibility = Windows::UI::Xaml::Visibility::Visible;

Expand Down Expand Up @@ -214,4 +149,69 @@ void PurchasePage::loadProductsBtn_Click(Platform::Object^ sender, Windows::UI::
txtLoading->Visibility = Windows::UI::Xaml::Visibility::Collapsed;

}, task_continuation_context::use_current());

}




void PurchasePage::ButtonBuyNow_Clicked(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
Button^ btn = (Button^)sender;

String^ key = (String^)btn->Tag;


if (!CurrentApp::LicenseInformation->ProductLicenses->Lookup(key)->IsActive)
{

create_task(CurrentApp::RequestProductPurchaseAsync(key))
.then([key, this](task<PurchaseResults^> tresult)
{
try
{
PurchaseResults^ result = tresult.get();
//int test = result->Status;
//reread license
App::CheckProductLicense();

if (CurrentApp::LicenseInformation->ProductLicenses->Lookup(key)->IsActive)
{
auto loader = Windows::ApplicationModel::Resources::ResourceLoader::GetForViewIndependentUse();

//prompt user to restart app if it's ad removal
if (key == "removeads" || key == "noads_premium")
{
MessageDialog ^dialog = ref new MessageDialog(loader->GetString("PurchaseSuccessNoAdsText"));
dialog->ShowAsync();
}

if (key == "premiumfeatures")
{
MessageDialog ^dialog = ref new MessageDialog(loader->GetString("PurchaseSuccessText"));
dialog->ShowAsync();
}

this->OnNavigatedTo(nullptr);
}

}
catch (Exception^)
{ }

}, task_continuation_context::use_current());







}
}


void PurchasePage::loadProductsBtn_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{

}
3 changes: 3 additions & 0 deletions Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -699,4 +699,7 @@
<data name="WatchVideoPrompt" xml:space="preserve">
<value>To use it, please go to Settings to watch a video.</value>
</data>
<data name="PurchaseWarning3.Text" xml:space="preserve">
<value>If you want to take risk, go ahead but keep in mind that Microsoft handles all the purchases, so I cannot refund you anything should your purchase does not work.</value>
</data>
</root>
2 changes: 1 addition & 1 deletion Strings/es/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@
<value>Sostener para activar</value>
</data>
<data name="HomeText" xml:space="preserve">
<value>Home</value>
<value>Início</value>
</data>
<data name="HowTo.Header" xml:space="preserve">
<value>Como hago</value>
Expand Down
Loading

0 comments on commit d062117

Please sign in to comment.