Skip to content

Commit

Permalink
Added guilt-trip dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
nefarius committed Jul 18, 2021
1 parent a31dede commit 9ae242e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
44 changes: 44 additions & 0 deletions DSHMC/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions DSHMC/Util/App/ApplicationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public class ApplicationConfiguration
/// </summary>
public bool IsGenuineCheckEnabled { get; set; } = true;

/// <summary>
/// Whether user has acknowledged the donation dialog.
/// </summary>
public bool HasAcknowledgedDonationDialog { get; set; } = false;

/// <summary>
/// Singleton instance of app configuration.
/// </summary>
Expand Down

0 comments on commit 9ae242e

Please sign in to comment.