From fd8ea7ccb78d6f44e6c62ae59822637de641ef7e Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 15 Aug 2013 12:58:58 +0200 Subject: [PATCH] add errormessgesboxes --- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 1 + .../Pages/Mensa/MensaPage.xaml.cs | 7 ++- .../CampusAppWP8/Pages/StartPage.xaml.cs | 3 +- .../Resources/AppResources.Designer.cs | 63 +++++++++++++------ .../CampusAppWP8/Resources/AppResources.resx | 13 +++- .../Utility/Lui/MessageBoxes/MessageBoxes.cs | 37 +++++++++++ 6 files changed, 101 insertions(+), 23 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index dec8a31a..f97f2dec 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -241,6 +241,7 @@ + Code diff --git a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs index cd4fecb5..7c7f31d0 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Mensa/MensaPage.xaml.cs @@ -13,6 +13,8 @@ namespace CampusAppWP8.Pages.Mensa using CampusAppWP8.Feed.Mensa; using Microsoft.Phone.Controls; using System.Windows; + using CampusAppWP8.Utility.Lui.MessageBoxes; + using CampusAppWP8.Resources; /// /// Class for the MensaPage @@ -94,6 +96,7 @@ namespace CampusAppWP8.Pages.Mensa /// /// Method will be execute if the SPSAPI is ready + /// /// private void SpsApiIsReady() { @@ -105,7 +108,7 @@ namespace CampusAppWP8.Pages.Mensa /// private void SpsApiIsFail() { - MessageBoxResult result = MessageBox.Show("LoadModel Failed", "Fehler", MessageBoxButton.OK); + MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorCampusLoc); this.InitializeFeed(Settings.UserProfil.DefaultCampus); } @@ -179,7 +182,7 @@ namespace CampusAppWP8.Pages.Mensa /// private void FeedIsFail() { - MessageBoxResult result = MessageBox.Show("LoadModel Failed", "Fehler", MessageBoxButton.OK); + MessageBoxResult result = MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad); } /// diff --git a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs index 40156ef7..2bf7d94b 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/StartPage.xaml.cs @@ -16,6 +16,7 @@ namespace CampusAppWP8.Pages using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using System.Threading; + using CampusAppWP8.Utility.Lui.MessageBoxes; /// /// Class for the StartPage @@ -155,7 +156,7 @@ namespace CampusAppWP8.Pages /// private void GeoWatchOptIN() { - MessageBoxResult result = MessageBox.Show(AppResources.GeoWatch_OptInText, AppResources.GeoWatch_OptInHeader, MessageBoxButton.OKCancel); + MessageBoxResult result = MessageBoxes.ShowGoeWatchOptInBox(); if (result == MessageBoxResult.OK) { diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs index 2bfddef8..59cc81c8 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.Designer.cs @@ -240,24 +240,6 @@ namespace CampusAppWP8.Resources { } } - /// - /// Sucht eine lokalisierte Zeichenfolge, die Ortung ähnelt. - /// - public static string GeoWatch_OptInHeader { - get { - return ResourceManager.GetString("GeoWatch_OptInHeader", resourceCulture); - } - } - - /// - /// Sucht eine lokalisierte Zeichenfolge, die Dürfen Positionsdaten enhoben und verwendet werden? ähnelt. - /// - public static string GeoWatch_OptInText { - get { - return ResourceManager.GetString("GeoWatch_OptInText", resourceCulture); - } - } - /// /// Sucht eine lokalisierte Zeichenfolge, die Hinweis ähnelt. /// @@ -582,6 +564,51 @@ namespace CampusAppWP8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Der aktuelle Campus konnte nicht ermittelt werden ähnelt. + /// + public static string MsgBox_ErrorCampusLoc { + get { + return ResourceManager.GetString("MsgBox_ErrorCampusLoc", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Fehler ähnelt. + /// + public static string MsgBox_ErrorHeader { + get { + return ResourceManager.GetString("MsgBox_ErrorHeader", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Beim Laden des Inhaltes ist ein Fehler aufgetreten ähnelt. + /// + public static string MsgBox_ErrorMainModelLoad { + get { + return ResourceManager.GetString("MsgBox_ErrorMainModelLoad", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Ortung ähnelt. + /// + public static string MsgBox_GeoWatchOptInHeader { + get { + return ResourceManager.GetString("MsgBox_GeoWatchOptInHeader", resourceCulture); + } + } + + /// + /// Sucht eine lokalisierte Zeichenfolge, die Dürfen Positionsdaten enhoben und verwendet werden? ähnelt. + /// + public static string MsgBox_GeoWatchOptInText { + get { + return ResourceManager.GetString("MsgBox_GeoWatchOptInText", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die News ähnelt. /// diff --git a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx index 9a4b865f..303fdbe2 100644 --- a/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx +++ b/CampusAppWP8/CampusAppWP8/Resources/AppResources.resx @@ -359,10 +359,10 @@ Suppe - + Ortung - + Dürfen Positionsdaten enhoben und verwendet werden? @@ -392,4 +392,13 @@ Appeinstellungen + + Der aktuelle Campus konnte nicht ermittelt werden + + + Fehler + + + Beim Laden des Inhaltes ist ein Fehler aufgetreten + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs b/CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs new file mode 100644 index 00000000..f444fc12 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Utility/Lui/MessageBoxes/MessageBoxes.cs @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------- +// +// Company copyright tag. +// +// stubbfel +// 15.08.2013 +//---------------------------------------------------------------------- +namespace CampusAppWP8.Utility.Lui.MessageBoxes +{ + using System.Windows; + using CampusAppWP8.Resources; + + /// + /// Class creates some MessageBoxes + /// + public class MessageBoxes + { + /// + /// Method show the MessageBox for the GeoWatch-OptIn + /// + /// result of the UserInteraction + public static MessageBoxResult ShowGoeWatchOptInBox() + { + return MessageBox.Show(AppResources.MsgBox_GeoWatchOptInText, AppResources.MsgBox_GeoWatchOptInHeader, MessageBoxButton.OKCancel); + } + + /// + /// Method show the MessageBox for the ErrorMessageBox + /// + /// custom text for the box + /// result of the UserInteraction + public static MessageBoxResult ShowMainModelErrorMessageBox(string text) + { + return MessageBox.Show(text, AppResources.MsgBox_ErrorHeader, MessageBoxButton.OK); + } + } +}