<commit_before>﻿#region

using System.Collections.ObjectModel;
using System.Windows.Forms;
using Microsoft.VisualBasic.ApplicationServices;
using Tabster.Forms;

#endregion

namespace Tabster
{
    public class SingleInstanceController : WindowsFormsApplicationBase
    {
        private static TabFile _queuedTabfile;
        private static bool _isLibraryOpen;
        private static bool _noSplash;

        public SingleInstanceController()
        {
            IsSingleInstance = true;
            StartupNextInstance += this_StartupNextInstance;
        }

        private static void ProcessCommandLine(ReadOnlyCollection<string> commandLine)
        {
            if (commandLine.Count > 0)
            {
                if (commandLine.Contains("-nosplash"))
                {
                    _noSplash = true;
                }

                if (Common.IsFilePath(commandLine[0], true))
                {
                    TabFile t;
                    if (TabFile.TryParse(commandLine[0], out t))
                    {
                        _queuedTabfile = t;

                        if (_isLibraryOpen)
                            Program.TabHandler.LoadExternally(t, true);
                    }
                }
            }
        }

        private static void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs e)
        {
            ProcessCommandLine(e.CommandLine);
        }

        protected override bool OnStartup(StartupEventArgs e)
        {
            ProcessCommandLine(e.CommandLine);
            return base.OnStartup(e);
        }

        protected override void OnCreateSplashScreen()
        {
            base.OnCreateSplashScreen();

            if (!_noSplash)
            {
                MinimumSplashScreenDisplayTime = 3500; //seems to make MainForm show prematurely
                SplashScreen = new Splash {Cursor = Cursors.AppStarting};
            }
        }

        protected override void OnCreateMainForm()
        {
            base.OnCreateMainForm();

            MainForm = _queuedTabfile != null ? new Form1(_queuedTabfile) : new Form1();
            _isLibraryOpen = true;
        }
    }
}<commit_msg>Add MainForm and SplashScreen properties.<commit_after>﻿#region

using System.Collections.ObjectModel;
using System.Windows.Forms;
using Microsoft.VisualBasic.ApplicationServices;
using Tabster.Forms;

#endregion

namespace Tabster
{
    public class SingleInstanceController : WindowsFormsApplicationBase
    {
        private static TabFile _queuedTabfile;
        private static bool _isLibraryOpen;
        private static bool _noSplash;

        public SingleInstanceController()
        {
            IsSingleInstance = true;
            StartupNextInstance += this_StartupNextInstance;
        }

        public new Form MainForm
        {
            get { return base.MainForm;  }
        }

        public new Form SplashScreen
        {
            get { return base.SplashScreen; }
        }

        private static void ProcessCommandLine(ReadOnlyCollection<string> commandLine)
        {
            if (commandLine.Count > 0)
            {
                if (commandLine.Contains("-nosplash"))
                {
                    _noSplash = true;
                }

                if (Common.IsFilePath(commandLine[0], true))
                {
                    TabFile t;
                    if (TabFile.TryParse(commandLine[0], out t))
                    {
                        _queuedTabfile = t;

                        if (_isLibraryOpen)
                            Program.TabHandler.LoadExternally(t, true);
                    }
                }
            }
        }

        private static void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs e)
        {
            ProcessCommandLine(e.CommandLine);
        }

        protected override bool OnStartup(StartupEventArgs e)
        {
            ProcessCommandLine(e.CommandLine);
            return base.OnStartup(e);
        }

        protected override void OnCreateSplashScreen()
        {
            base.OnCreateSplashScreen();

            if (!_noSplash)
            {
                MinimumSplashScreenDisplayTime = 3500; //seems to make MainForm show prematurely
                base.SplashScreen = new Splash {Cursor = Cursors.AppStarting};
            }
        }

        protected override void OnCreateMainForm()
        {
            base.OnCreateMainForm();
            base.MainForm = _queuedTabfile != null ? new Form1(_queuedTabfile) : new Form1();
            _isLibraryOpen = true;
        }
    }
}
{'fraction_non_alphanumeric': 0.06921086675291074, 'fraction_numerical': 0.0038809831824062097, 'mean_word_length': 1.5715077605321508, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2868994', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1115, 'n_words': 240}