using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace barry
{
    /// <summary>
    /// Logique d'interaction pour App.xaml
    /// </summary>
    public partial class App : Application
    {
        void App_Startup(object sender, StartupEventArgs e)
        {
            // Application is running
            // Process command line args
            bool startMinimized = false;
            bool autorun = false;
            for (int i = 0; i != e.Args.Length; ++i)
            {
                if (e.Args[i] == "/minimized")
                {
                    startMinimized = true;
                }
                if (e.Args[i] == "/autorun")
                {
                    autorun = true;
                }
            }

            // Create main application window, starting minimized if specified
            MainWindow mainWindow = new MainWindow();
            if (startMinimized)
            {
                mainWindow.WindowState = WindowState.Minimized;
            }
            //if (autorun)
            //{
            //    mainWindow.autorun = true;
            //}
            mainWindow.Show();

            if (autorun)
            {
                mainWindow.run_backup();
            }
            
        }
    }
}
