using log4net;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using TSManagementApp.Utils;
using TSManagementApp.Views;

[assembly: log4net.Config.XmlConfigurator(Watch = false)]

namespace TSManagementApp
{
    /// <summary>
    /// Interakční logika pro App.xaml
    /// </summary>
    public partial class App : Application
    {
        #region Logger
        private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        #endregion

        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {

                string path = SystemUtils.UserLocalAppDirectory;
                log.InfoFormat("Start application {0} version {1}", Assembly.GetExecutingAssembly().GetName().Name, Assembly.GetExecutingAssembly().GetName().Version);

                base.OnStartup(e);

                MainWindowView mainWin = new MainWindowView();
                mainWin.Show();
            }
            catch (Exception ex)
            {
                log.Error($"Error while starting app - {ex.ToString()}");
                this.Shutdown(1);
            }
        }
    }
}
