using System;
using System.Windows.Forms;

namespace AdvertsingProfitControl
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();            
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += GlobalClasses.LogError;
            AppDomain.CurrentDomain.UnhandledException += GlobalClasses.LogError;
            //LogConsole console = LogConsole.GetStaticInstance;
            //var errorConsoleThread = new Thread(console.Show);
            //errorConsoleThread.IsBackground = true;
            //errorConsoleThread.Start();
            var form = new FrmLoginForm();
            form.ShowDialog();
            //Check to see if there was a successful connection, otherwise simply quite.
            if (!form.ConnectionSuccessful) return;
            if (args.Length == 1 && args[0] == "/debug")
            {
                Application.Run(new FrmMain(true));
            }
            else
            {
                Application.Run(new FrmMain(false));
            }
        }
    }
}
