mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Added donate button
This commit is contained in:
@@ -11,23 +11,13 @@ namespace ZuneModdingHelper
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
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 readonly Version VersionNum = new(2021, 5, 6, 0);
|
||||||
public static string VersionStatus => "alpha";
|
public static readonly string VersionStatus = "alpha";
|
||||||
public static string Version => VersionNum.ToString() + (VersionStatus != string.Empty ? "-" + VersionStatus : string.Empty);
|
public static readonly string Version = VersionNum.ToString() + (VersionStatus != string.Empty ? "-" + VersionStatus : string.Empty);
|
||||||
|
|
||||||
public static bool CheckIfNewerVersion(string otherStr)
|
public static readonly string DonateLink = "https://www.paypal.com/donate?business=38QWBDS9PJUAQ¤cy_code=USD";
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -42,5 +32,25 @@ namespace ZuneModdingHelper
|
|||||||
AppCenter.SetEnabledAsync(false);
|
AppCenter.SetEnabledAsync(false);
|
||||||
#endif
|
#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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,15 @@
|
|||||||
|
|
||||||
<mah:MetroWindow.Flyouts>
|
<mah:MetroWindow.Flyouts>
|
||||||
<mah:FlyoutsControl>
|
<mah:FlyoutsControl>
|
||||||
<mah:Flyout x:Name="AboutFlyout" Header="About" Position="Right" IsModal="True" Theme="Adapt">
|
<mah:Flyout x:Name="AboutFlyout" Position="Right" IsModal="True" Theme="Adapt">
|
||||||
|
<mah:Flyout.Header>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="About" FontSize="26" FontWeight="Bold"/>
|
||||||
|
<Button Content="Donate" Click="DonateButton_Click" ToolTip="Support development of this and other projects"
|
||||||
|
Grid.Row="1" Grid.Column="1" VerticalAlignment="Stretch" HorizontalAlignment="Right" Margin="4"
|
||||||
|
Style="{StaticResource MahApps.Styles.Button.MetroSquare.Accent}"/>
|
||||||
|
</Grid>
|
||||||
|
</mah:Flyout.Header>
|
||||||
<TextBlock FontSize="14" Padding="16" TextWrapping="Wrap">
|
<TextBlock FontSize="14" Padding="16" TextWrapping="Wrap">
|
||||||
<Run Text="{x:Static local:App.Title}" FontWeight="Bold" FontSize="16"/><LineBreak/>
|
<Run Text="{x:Static local:App.Title}" FontWeight="Bold" FontSize="16"/><LineBreak/>
|
||||||
<Run Text="{x:Static local:App.Version}"/><LineBreak/>
|
<Run Text="{x:Static local:App.Version}"/><LineBreak/>
|
||||||
|
|||||||
@@ -149,10 +149,7 @@ namespace ZuneModdingHelper
|
|||||||
|
|
||||||
private void Link_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
private void Link_RequestNavigate(object sender, RequestNavigateEventArgs e)
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri)
|
App.OpenInBrowser(e.Uri.AbsoluteUri);
|
||||||
{
|
|
||||||
UseShellExecute = true
|
|
||||||
});
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,5 +230,7 @@ namespace ZuneModdingHelper
|
|||||||
{ "Accepted", acceptedUpdate.ToString() },
|
{ "Accepted", acceptedUpdate.ToString() },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DonateButton_Click(object sender, RoutedEventArgs e) => App.OpenInBrowser(App.DonateLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user