diff --git a/README.md b/README.md index 6f1ecdf..b09c4d0 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ The interface is in German. This section names the controls as they appear on sc News, ads and moderator talk are placeholders: the app shows them in the timeline and keeps silent for their duration, so the speaker can talk live. +Errors, such as invalid input or a failed save, search or import, open a popup with the message. Hints and warnings stay in the bar at the top of the page. + ## How the schedule is built `ScheduleGenerator` plans in half-hour slots: diff --git a/src/Radiosender/Services/Localization/Strings.en.resx b/src/Radiosender/Services/Localization/Strings.en.resx index 2a43344..b19a599 100644 --- a/src/Radiosender/Services/Localization/Strings.en.resx +++ b/src/Radiosender/Services/Localization/Strings.en.resx @@ -8,6 +8,7 @@ Audio file cannot be read: {0} The microphone could not be turned on: {0} No microphone was found. + Invalid input All licenses Choose files... Creator diff --git a/src/Radiosender/Services/Localization/Strings.resx b/src/Radiosender/Services/Localization/Strings.resx index b7e3780..1a771ae 100644 --- a/src/Radiosender/Services/Localization/Strings.resx +++ b/src/Radiosender/Services/Localization/Strings.resx @@ -8,6 +8,7 @@ Audiodatei kann nicht gelesen werden: {0} Das Mikrofon konnte nicht eingeschaltet werden: {0} Es wurde kein Mikrofon gefunden. + Ungültige Eingabe Alle Lizenzen Dateien auswählen... Urheber diff --git a/src/Radiosender/Views/ErrorPopup.cs b/src/Radiosender/Views/ErrorPopup.cs new file mode 100644 index 0000000..e14bf6a --- /dev/null +++ b/src/Radiosender/Views/ErrorPopup.cs @@ -0,0 +1,19 @@ +using System.Windows; +using Radiosender.Services.Localization; +using MessageBox = Wpf.Ui.Controls.MessageBox; + +namespace Radiosender.Views; + +// Errors as a modal popup, so they cannot be missed like an InfoBar at the top of a long page. +public static class ErrorPopup +{ + public static void Show(DependencyObject source, string title, string message) => + _ = new MessageBox + { + Title = title, + Content = message, + CloseButtonText = Loc.T("Main_Ok"), + Owner = Window.GetWindow(source) is { IsLoaded: true } owner ? owner : null, + WindowStartupLocation = WindowStartupLocation.CenterScreen, + }.ShowDialogAsync(); +} diff --git a/src/Radiosender/Views/Pages/ImportPage.xaml.cs b/src/Radiosender/Views/Pages/ImportPage.xaml.cs index 6aca2ed..04eac1f 100644 --- a/src/Radiosender/Views/Pages/ImportPage.xaml.cs +++ b/src/Radiosender/Views/Pages/ImportPage.xaml.cs @@ -322,6 +322,12 @@ public partial class ImportPage : Page private void Show(InfoBarSeverity severity, string title, string message) { + if (severity == InfoBarSeverity.Error) + { + Message.IsOpen = false; + ErrorPopup.Show(this, title, message); + return; + } Message.Severity = severity; Message.Title = title; Message.Message = message; diff --git a/src/Radiosender/Views/Pages/SchedulePage.xaml.cs b/src/Radiosender/Views/Pages/SchedulePage.xaml.cs index 80fc1dc..cfbe457 100644 --- a/src/Radiosender/Views/Pages/SchedulePage.xaml.cs +++ b/src/Radiosender/Views/Pages/SchedulePage.xaml.cs @@ -667,6 +667,12 @@ public partial class SchedulePage : Page private void ShowMessage(InfoBarSeverity severity, string title, string text) { + if (severity == InfoBarSeverity.Error) + { + Message.IsOpen = false; + ErrorPopup.Show(this, title, text); + return; + } Message.Severity = severity; Message.Title = title; Message.Message = text; diff --git a/src/Radiosender/Views/Pages/SettingsPage.xaml.cs b/src/Radiosender/Views/Pages/SettingsPage.xaml.cs index ce6c0ee..7b81ba1 100644 --- a/src/Radiosender/Views/Pages/SettingsPage.xaml.cs +++ b/src/Radiosender/Views/Pages/SettingsPage.xaml.cs @@ -132,6 +132,12 @@ public partial class SettingsPage : Page private void ShowMessage(InfoBarSeverity severity, string title, string text) { + if (severity == InfoBarSeverity.Error) + { + Message.IsOpen = false; + ErrorPopup.Show(this, title, text); + return; + } Message.Severity = severity; Message.Title = title; Message.Message = text; diff --git a/src/Radiosender/Views/ScheduleItemEditWindow.xaml b/src/Radiosender/Views/ScheduleItemEditWindow.xaml index b2dbb58..342aed2 100644 --- a/src/Radiosender/Views/ScheduleItemEditWindow.xaml +++ b/src/Radiosender/Views/ScheduleItemEditWindow.xaml @@ -21,12 +21,6 @@