Exemplo n.º 1
0
 public ViewState(frmSuperPuTTY mainForm)
 {
     this.MainForm = mainForm;
     this.ConnectionBarLocation = this.MainForm.tsConnect.Location;
     this.CommandBarLocation = this.MainForm.tsConnect.Location;
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // send log to console
            log4net.Config.BasicConfigurator.Configure();

            bool onlyInstance = false;
            Mutex mutex = new Mutex(true, "SuperPuTTY", out onlyInstance);

            Log.InfoFormat(
                "IsFirstRun={0}, SingleInstanceMode={1}, onlyInstance={2}",
                SuperPuTTY.IsFirstRun, SuperPuTTY.Settings.SingleInstanceMode, onlyInstance);
            if ((EnforceSingleInstance  || SuperPuTTY.Settings.SingleInstanceMode) && !SuperPuTTY.IsFirstRun && !onlyInstance)
            {
                SingleInstanceHelper.LaunchInExistingInstance(args);
                Log.InfoFormat("Sent Command to Existing Instance: [{0}]", String.Join(" ", args));
                Environment.Exit(0);
            }

            // open full file
            log4net.Config.XmlConfigurator.Configure();

            #if DEBUG
            Logger.OnLog += delegate(string logMessage)
            {
                //Console.WriteLine(logMessage);
                Log.Info(logMessage);
            };
            #endif

            try
            {

                Log.Info("Starting");
                SuperPuTTY.Initialize(args);

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
                Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                frmSuperPuTTY mainForm = new frmSuperPuTTY();
                SetDefaultIcon(mainForm);
                Application.Run(SuperPuTTY.MainForm = mainForm);
                SuperPuTTY.Shutdown();
            }
            catch (Exception ex)
            {
                Log.Error("Error in Main", ex);
            }
            finally
            {
                Log.Info("Shutdown");
            }
        }