-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.axaml.cs
51 lines (44 loc) · 1.29 KB
/
MainWindow.axaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Avalonia.Controls;
using Avalonia.Interactivity;
using Plugin.InAppBilling;
using System.Diagnostics;
using System;
namespace AvanoliaInAppPluginBug
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public async void OnClick(object? sender, RoutedEventArgs e)
{
Debug.WriteLine("Getting product infos");
/* if (!CrossInAppBilling.IsSupported)
{
Debug.WriteLine("Not supported.");
return;
}*/
var billing = CrossInAppBilling.Current;
try
{
//You must connect
var connected = await billing.ConnectAsync(false);
}
catch (InAppBillingPurchaseException pEx)
{
//Handle IAP Billing Exception
Debug.Write(pEx.Message);
}
catch (Exception ex)
{
//Something has gone wrong
Debug.Write(ex.Message);
}
finally
{
await billing.DisconnectAsync();
}
}
}
}