From f5fc215b8fc5006222c6284ae1edc8217bc3781b Mon Sep 17 00:00:00 2001 From: Joshua Askharoun Date: Thu, 6 May 2021 04:34:46 -0500 Subject: [PATCH] Added donate button --- ZuneModdingHelper/App.xaml.cs | 40 +++++++++++++++++----------- ZuneModdingHelper/MainWindow.xaml | 10 ++++++- ZuneModdingHelper/MainWindow.xaml.cs | 7 +++-- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/ZuneModdingHelper/App.xaml.cs b/ZuneModdingHelper/App.xaml.cs index e0ca176..61897a5 100644 --- a/ZuneModdingHelper/App.xaml.cs +++ b/ZuneModdingHelper/App.xaml.cs @@ -11,23 +11,13 @@ namespace ZuneModdingHelper /// public partial class App : Application { - public static string Title => "Zune Modding Helper"; + public static readonly string Title = "Zune Modding Helper"; - public static Version VersionNum => new(2021, 5, 6, 0); - public static string VersionStatus => "alpha"; - public static string Version => VersionNum.ToString() + (VersionStatus != string.Empty ? "-" + VersionStatus : string.Empty); + public static readonly Version VersionNum = new(2021, 5, 6, 0); + public static readonly string VersionStatus = "alpha"; + public static readonly string Version = VersionNum.ToString() + (VersionStatus != string.Empty ? "-" + VersionStatus : string.Empty); - public static bool CheckIfNewerVersion(string otherStr) - { - int idxSplit = otherStr.IndexOf('-'); - Version otherNum = new(otherStr[..idxSplit]); - string otherStatus = otherStr[(idxSplit + 1)..]; - - // TODO: This assumes that the VersionStatus is "alpha" - bool isNotAlpha = otherStatus != VersionStatus; - bool isNewer = otherNum > VersionNum; - return isNotAlpha || isNewer; - } + public static readonly string DonateLink = "https://www.paypal.com/donate?business=38QWBDS9PJUAQ¤cy_code=USD"; protected override void OnStartup(StartupEventArgs e) { @@ -42,5 +32,25 @@ namespace ZuneModdingHelper AppCenter.SetEnabledAsync(false); #endif } + + public static void OpenInBrowser(string url) + { + System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(url) + { + UseShellExecute = true + }); + } + + public static bool CheckIfNewerVersion(string otherStr) + { + int idxSplit = otherStr.IndexOf('-'); + Version otherNum = new(otherStr[..idxSplit]); + string otherStatus = otherStr[(idxSplit + 1)..]; + + // TODO: This assumes that the VersionStatus is "alpha" + bool isNotAlpha = otherStatus != VersionStatus; + bool isNewer = otherNum > VersionNum; + return isNotAlpha || isNewer; + } } } diff --git a/ZuneModdingHelper/MainWindow.xaml b/ZuneModdingHelper/MainWindow.xaml index b7ebec6..1aa0784 100644 --- a/ZuneModdingHelper/MainWindow.xaml +++ b/ZuneModdingHelper/MainWindow.xaml @@ -23,7 +23,15 @@ - + + + + +