Skip to content

Commit

Permalink
Ask user when closing in a non IDLE state #130
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Feb 3, 2023
1 parent 88783e7 commit 7c99df6
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NotEnoughAV1Encodes/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
lex:LocalizeDictionary.DesignCulture="en"
lex:ResxLocalizationProvider.DefaultAssembly="NotEnoughAV1Encodes"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
Title="NEAV1E" Height="650" Width="1085" Icon="/resources/img/neav1e.ico" AllowDrop="True" DragDrop.Drop="MetroWindow_Drop" MinWidth="780" MinHeight="550">
Title="NEAV1E" Height="650" Width="1085" Icon="/resources/img/neav1e.ico" AllowDrop="True" DragDrop.Drop="MetroWindow_Drop" MinWidth="780" MinHeight="550" Closing="MetroWindow_Closing">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="b2v" />
</Window.Resources>
Expand Down
12 changes: 12 additions & 0 deletions NotEnoughAV1Encodes/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ public MainWindow()
}
}

private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (ProgramState == 0) return;

// Ask User if ProgramState is not IDLE (0)
MessageBoxResult result = MessageBox.Show(LocalizedStrings.Instance["CloseQuestion"], "", MessageBoxButton.YesNo, MessageBoxImage.Question);
if (result == MessageBoxResult.No)
{
e.Cancel = true;
}
}

#region Startup
private void Initialize()
{
Expand Down
9 changes: 9 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -542,4 +542,7 @@ Please download and extract 7-zip to the following path:
<data name="ButtonClearQueue" xml:space="preserve">
<value>Warteschlange leeren</value>
</data>
<data name="CloseQuestion" xml:space="preserve">
<value>Programm befindet sich nicht im IDLE! Sind Sie sicher, dass Sie das Programm beenden wollen?</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -542,4 +542,7 @@ Please download and extract 7-zip to the following path:
<data name="ButtonClearQueue" xml:space="preserve">
<value>Effacer la file d'attente</value>
</data>
<data name="CloseQuestion" xml:space="preserve">
<value>Le programme n'est pas dans l'IDLE ! Êtes-vous sûr de vouloir quitter le programme?</value>
</data>
</root>
3 changes: 3 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -548,4 +548,7 @@ Please download and extract 7-zip to the following path:
<data name="ButtonClearQueue" xml:space="preserve">
<value>Clear Queue</value>
</data>
<data name="CloseQuestion" xml:space="preserve">
<value>Program state is not IDLE! Are you sure you want to exit?</value>
</data>
</root>

0 comments on commit 7c99df6

Please sign in to comment.