Files
BeWoPlaner/BeWoLauncher/LauncherApp.xaml.cs
rene 4fbfdbaf2c Unit Tests erstellt
Informationen ausgelagert
Kleines Spy/Test Programm erstellt
Mehr Exceptions/InvalidUpdateFileRequestException.cs
Launcher Host in Download Server geändert
Download Server macht zusätzlich Abfrage an den Hauptserver
Download geht jetzt stückweise von statten
2022-12-28 16:36:59 +01:00

98 lines
3.0 KiB
C#

using BeWoLauncher.Components;
using BeWoLauncher.Logic;
using BeWoLauncher.Logic.Controller;
using BeWoLauncher.ServiceProxy;
using BeWoLauncher.WindowImp;
using BS.SharedLauncher;
using BS.SharedLauncher.Information;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Reflection;
using System.Security.Policy;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Threading;
using System.Xml;
namespace BeWoLauncher
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class LauncherApp : Application
{
public static string ShortVersion => "3";
public static string Version => "Version 3.0";
public LauncherApp()
{
}
protected override void OnStartup(StartupEventArgs e)
{
MainWindow = new LauncherWindow();
MainWindow.Show();
base.OnStartup(e);
ProcessController.StartLauncher();
Dispatcher.UnhandledException += (s, ex)
=>
{
if (ex.Exception == null || String.IsNullOrEmpty(ex.Exception.Message) ||
(!ex.Exception.ToString().Contains("DevExpress.Xpf.Bars.Customization.CustomizationControl.OnLoaded")
&& !ex.Exception.ToString().Contains("DevExpress.Xpf.Grid.Native.SelectionStrategyCellBase.IsCellSelected")))
{
ShowError("Unbehandelter Fehler", ex.Exception, true);
}
ex.Handled = true;
};
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
}
private void Application_Exit(object sender, ExitEventArgs e)
{
ProcessController.KillPlanerProcess();
}
#region ShowError
public static void ShowError(Exception ex) => ShowError(null, ex, true);
public static void ShowError(string message, Exception ex, bool showDetails)
{
ShowError(message, ex.ToString(), showDetails);
}
public static void ShowError(string message, string ex, bool showDetails)
{
if (ViewController.CurrentWindow is null)
{
MessageBox.Show(ex, message);
}
else
{
ViewController.CurrentWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
ViewController.CurrentWindow.ShowControlAsModalPopUp(new ExceptionMessageBox(message, ex, showDetails))));
}
}
#endregion
}
}