diff --git a/ENI2/App.config b/ENI2/App.config index 4c7c4bc1..19aba5a3 100644 --- a/ENI2/App.config +++ b/ENI2/App.config @@ -1,18 +1,18 @@ - + -
+
-
+
- + @@ -36,18 +36,38 @@ - + - + - + + + + + + + + + + + + + + + + + + + + + diff --git a/ENI2/App.xaml.cs b/ENI2/App.xaml.cs index d2304b61..d1335ca9 100644 --- a/ENI2/App.xaml.cs +++ b/ENI2/App.xaml.cs @@ -6,6 +6,8 @@ using System.Windows; using System.Windows.Markup; using bsmd.database; +using log4net; + using System.Windows.Controls; using System.Windows.Input; using System; @@ -13,13 +15,16 @@ using System.Net; using ENI2.LockingServiceReference; using ENI2.Util; using System.Threading; +using System.Threading.Tasks; +using Microsoft.Office.Interop.Excel; +using System.Drawing.Drawing2D; namespace ENI2 { /// /// Interaction logic for App.xaml /// - public partial class App : Application + public partial class App : System.Windows.Application { // "global" statics, da gibt es sicher noch einen eleganteren Weg.. private static ServiceClient _lockingServiceClient = null; @@ -30,6 +35,8 @@ namespace ENI2 private ManualResetEvent ResetSplashCreated; private Thread _splashThread; + private ILog _log = LogManager.GetLogger(typeof(App).Name); + public App() : base() { this.Dispatcher.UnhandledException += Dispatcher_UnhandledException; @@ -68,12 +75,10 @@ namespace ENI2 // initialize static / localized lookups from sqlite database string langKey = CultureInfo.CurrentCulture.TwoLetterISOLanguageName; - Dictionary cargoHandlingDict = LocalizedLookup.getLADGCargoHandlingStrings(langKey); foreach (int key in cargoHandlingDict.Keys) LADG.CargoHandlingDict.Add(key, cargoHandlingDict[key]); LADG.MVSHLocodes.AddRange(LocalizedLookup.getMVSHLocodes()); - EventManager.RegisterClassHandler(typeof(DatePicker), DatePicker.PreviewKeyDownEvent, new KeyEventHandler(this.DatePicker_PreviewKeyDown)); CREW.NationalityDict = LocalizedLookup.getNationalities(); STAT.VesselTypeDict = LocalizedLookup.getVesselTypes(); @@ -83,8 +88,8 @@ namespace ENI2 LADG.CargoCodesNST = LocalizedLookup.getCargoCodesNST(); LADG.CargoCodesNST3 = LocalizedLookup.getCargoCodesNST3(); - // Load import value mappings - ValueMapping.LoadDicts(); + // Load import value mappings + Task.Run(async () => await ValueMapping.LoadDicts()); // Preload validation fields List vFields = bsmd.database.ValidationRule.ValidationFields; @@ -154,9 +159,9 @@ namespace ENI2 private void Dispatcher_UnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { string errorMessage = string.Format("An unhandled exception occurred: {0}\r\n{1}", e.Exception.Message, e.Exception.StackTrace); - MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); - // TODO: Dieser Fehler muss irgendwohin gesendet / gespeichert werden + Xceed.Wpf.Toolkit.MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); e.Handled = true; + _log.Error(errorMessage); } private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) diff --git a/ENI2/ControlTemplates.xaml b/ENI2/ControlTemplates.xaml index 70eaa254..519c417a 100644 --- a/ENI2/ControlTemplates.xaml +++ b/ENI2/ControlTemplates.xaml @@ -56,6 +56,33 @@ + + + + + + + + +