diff --git a/XIVChat Desktop/App.xaml.cs b/XIVChat Desktop/App.xaml.cs index 895ced4..1b9f8e4 100644 --- a/XIVChat Desktop/App.xaml.cs +++ b/XIVChat Desktop/App.xaml.cs @@ -31,7 +31,7 @@ namespace XIVChat_Desktop { public event PropertyChangedEventHandler? PropertyChanged; - private void Application_Startup(object sender, StartupEventArgs e) { + private async void Application_Startup(object sender, StartupEventArgs e) { try { this.Config = Configuration.Load() ?? new Configuration(); } catch (Exception ex) { @@ -62,12 +62,24 @@ namespace XIVChat_Desktop { ) ); - var wnd = new MainWindow(); - this.Window = wnd; - // I guess this gets initialised where you call it the first time, so initialise it on the UI thread this.Dispatcher.Invoke(() => { }); + #if RELEASE + if (string.IsNullOrWhiteSpace(this.Config.LicenceKey) || !(await LicenceWindow.LicenceInfo(this.Config.LicenceKey)).Valid()) { + var lic = new LicenceWindow(null, true); + lic.Show(); + return; + } + #endif + + this.InitialiseWindow(); + } + + public void InitialiseWindow() { + var wnd = new MainWindow(); + this.Window = wnd; + wnd.Show(); // initialise a config window to apply all our settings diff --git a/XIVChat Desktop/Configuration.cs b/XIVChat Desktop/Configuration.cs index 240c97f..24af0e7 100644 --- a/XIVChat Desktop/Configuration.cs +++ b/XIVChat Desktop/Configuration.cs @@ -16,6 +16,8 @@ namespace XIVChat_Desktop { public class Configuration : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; + public string? LicenceKey { get; set; } + public KeyPair KeyPair { get; set; } = PublicKeyBox.GenerateKeyPair(); public ObservableCollection Servers { get; set; } = new ObservableCollection(); diff --git a/XIVChat Desktop/LicenceWindow.xaml b/XIVChat Desktop/LicenceWindow.xaml new file mode 100644 index 0000000..998d838 --- /dev/null +++ b/XIVChat Desktop/LicenceWindow.xaml @@ -0,0 +1,32 @@ + + + + + + +