Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
fixes and cleaning up stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Dyvinia committed Jun 28, 2022
1 parent a3334ef commit 586c1a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ public async void CheckVersion() {
Version local = Assembly.GetExecutingAssembly().GetName().Version;

if (local.CompareTo(latest) < 0) {
string message = "You are using an outdated version of FrostyFix. \nWould you like to download the latest version?";
string message = $"You are using FrostyFix v{local.ToString()[..5]}. \nWould you like to download the latest version? (v{latest})";
MessageBoxResult Result = MessageBoxDialog.Show(message, "FrostyFix", MessageBoxButton.YesNo, DialogSound.Notify);
if (Result == MessageBoxResult.Yes) {
Process.Start("https://github.com/Dyvinia/FrostyFix/releases/latest");
Process.Start(new ProcessStartInfo("https://github.com/Dyvinia/FrostyFix/releases/latest") { UseShellExecute = true });
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions Dialogs/ExceptionDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ public ExceptionDialog(Exception ex, string title, bool isCrash, string messageP
InitializeComponent();

Title = title;
Window mainWindow = Application.Current.MainWindow;
Icon = mainWindow.Icon;

// Show or hide Header & Play according sounds
int headerHeight = 30;
Expand Down
8 changes: 3 additions & 5 deletions Dialogs/MessageBoxDialog.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ public partial class MessageBoxDialog : Window {

public MessageBoxDialog(string message, string title, MessageBoxButton buttons, DialogSound sound) {
InitializeComponent();
SetVisibilityOfButtons(buttons);
ButtonVisibility(buttons);
PlaySound(sound);

Title = title;
MessageText.Text = message;
Window mainWindow = Application.Current.MainWindow;
Icon = mainWindow.Icon;

OKButton.Click += OnClose;
YesButton.Click += OnClose;
Expand All @@ -45,7 +43,7 @@ public MessageBoxDialog(string message, string title, MessageBoxButton buttons,
public static MessageBoxResult Show(string message, string title, MessageBoxButton buttons, DialogSound sound = DialogSound.None) {
MessageBoxResult msgBoxResult = MessageBoxResult.None;
Application.Current.Dispatcher.Invoke(() => {
MessageBoxDialog window = new MessageBoxDialog(message, title, buttons, sound);
MessageBoxDialog window = new(message, title, buttons, sound);
window.ShowDialog();
msgBoxResult = window.result;
});
Expand All @@ -66,7 +64,7 @@ private void OnClose(object sender, RoutedEventArgs e) {
Close();
}

private void SetVisibilityOfButtons(MessageBoxButton button) {
private void ButtonVisibility(MessageBoxButton button) {
switch (button) {
case MessageBoxButton.OK:
CancelButton.Visibility = Visibility.Collapsed;
Expand Down

0 comments on commit 586c1a0

Please sign in to comment.