51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using BeWoLauncher.Logic;
|
|
using BeWoLauncher.Logic.Controller;
|
|
using System;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
|
|
namespace BeWoLauncher.Components
|
|
{
|
|
public partial class ExceptionMessageBox : UserControl
|
|
{
|
|
public ExceptionMessageBox(string message, Exception ex, bool showDetails) : this(message, ex?.ToString(), showDetails) { }
|
|
|
|
public ExceptionMessageBox(string message, string submessage, bool showDetails)
|
|
{
|
|
InitializeComponent();
|
|
|
|
if (!String.IsNullOrEmpty(message) && !showDetails)
|
|
tb_message.Text = message;
|
|
else
|
|
{
|
|
tb_message.Text =
|
|
"Es ist leider ein unbekannter Fehler aufgetreten. Prüfen Sie Ihre Internetverbindung oder versuchen Sie es später erneut. Wir sind stets bemüht das Programm zu verbessern, daher freuen wir uns auch, wenn Sie die Fehlerdetails unten in einer Mail an support@bewoplaner.de senden.";
|
|
}
|
|
|
|
if (!showDetails)
|
|
{
|
|
lblError.Visibility = Visibility.Collapsed;
|
|
contentError.Visibility = Visibility.Collapsed;
|
|
}
|
|
else
|
|
{
|
|
tb_stack.Text = String.Empty;
|
|
if (!String.IsNullOrEmpty(message))
|
|
{
|
|
tb_stack.Text = message + System.Environment.NewLine + System.Environment.NewLine + tb_stack.Text;
|
|
}
|
|
tb_stack.Text += submessage ?? string.Empty;
|
|
lblError.Visibility = Visibility.Visible;
|
|
contentError.Visibility = Visibility.Visible;
|
|
}
|
|
}
|
|
|
|
private void Button_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if(ViewController.LauncherWindow != null)
|
|
{
|
|
ViewController.LauncherWindow.CloseCurrentPopUp();
|
|
}
|
|
}
|
|
}
|
|
} |