From 9ae242e23518e299a24639b2292bb7ab4f3f211a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Sun, 18 Jul 2021 14:48:26 +0200 Subject: [PATCH] Added guilt-trip dialog --- DSHMC/MainWindow.xaml.cs | 44 ++++++++++++++++++++++ DSHMC/Util/App/ApplicationConfiguration.cs | 5 +++ 2 files changed, 49 insertions(+) diff --git a/DSHMC/MainWindow.xaml.cs b/DSHMC/MainWindow.xaml.cs index 3a942540..cf74f06b 100644 --- a/DSHMC/MainWindow.xaml.cs +++ b/DSHMC/MainWindow.xaml.cs @@ -1,11 +1,17 @@ using System; using System.ComponentModel; +using System.Diagnostics; +using System.Linq; using System.Windows; using System.Windows.Controls; using AdonisUI.Controls; using Nefarius.DsHidMini.Drivers; using Nefarius.DsHidMini.MVVM; using Nefarius.DsHidMini.Util; +using Nefarius.DsHidMini.Util.App; +using MessageBox = AdonisUI.Controls.MessageBox; +using MessageBoxImage = AdonisUI.Controls.MessageBoxImage; +using MessageBoxResult = AdonisUI.Controls.MessageBoxResult; namespace Nefarius.DsHidMini { @@ -28,6 +34,44 @@ public MainWindow() InitializeComponent(); DataContext = _vm; + + if (ApplicationConfiguration.Instance.HasAcknowledgedDonationDialog) return; + + var messageBox = new MessageBoxModel + { + Text = + "Hello, Gamer! \r\n\r\nDid you know this project was only possible with years of dedication and enthusiasm? " + + "You're receiving this work for absolutely free. If it brings you joy please consider giving back to the " + + "author's efforts and show your appreciation through a donation. \r\n\r\nThanks for your attention ❤️", + Caption = "May I have your attention", + Icon = MessageBoxImage.Question, + Buttons = new[] + { + MessageBoxButtons.Cancel("Acknowledged"), + MessageBoxButtons.Yes("Sure, show me how!") + }, + CheckBoxes = new[] + { + new MessageBoxCheckBoxModel("I've already donated or will consider it") + { + IsChecked = false, + Placement = MessageBoxCheckBoxPlacement.BelowText + } + }, + IsSoundEnabled = false + }; + + MessageBox.Show(messageBox); + + switch (messageBox.Result) + { + case MessageBoxResult.Yes: + Process.Start("https://vigem.org/Donations/"); + break; + } + + ApplicationConfiguration.Instance.HasAcknowledgedDonationDialog = + messageBox.CheckBoxes.First().IsChecked; } protected override void OnSourceInitialized(EventArgs e) diff --git a/DSHMC/Util/App/ApplicationConfiguration.cs b/DSHMC/Util/App/ApplicationConfiguration.cs index 29bc7f31..d037550c 100644 --- a/DSHMC/Util/App/ApplicationConfiguration.cs +++ b/DSHMC/Util/App/ApplicationConfiguration.cs @@ -37,6 +37,11 @@ public class ApplicationConfiguration /// public bool IsGenuineCheckEnabled { get; set; } = true; + /// + /// Whether user has acknowledged the donation dialog. + /// + public bool HasAcknowledgedDonationDialog { get; set; } = false; + /// /// Singleton instance of app configuration. ///