Пример #1
0
        public MainForm()
        {
            Reference            = this;
            Share.MainFormHandle = Handle;             //Immediatly set the handle for form operations, tray issues, etc..
            Visible = false;

            // Should the splash screen be shown?
            bool showSplash = !Environment.GetCommandLineArgs().Contains("-nosplash");
            bool showUi     = !Environment.GetCommandLineArgs().Contains("-minimized");

            if (!showUi)
            {
                showSplash = false;
            }

            if (showSplash)
            {
                new Thread(() => new SplashScreen().ShowDialog())
                {
                    Name = "Splashscreen_show"
                }.Start();
            }


            // ____________ initializations here ____________ //
            //

            Share.Initialize();

            Logger.Log(LogLevel.Info, "mainform", "starting to load mainform UI");
            // Start loading everything to the UI
            InitializeComponent();
            Logger.Log(LogLevel.Info, "mainform", "loaded mainform UI");

            Logger.Log(LogLevel.Info, "mainform", "loading application");
            Initialize();

            // ____________ end  initializations ____________ //


            // Do this after InitializeComponent() because we need access to the controls
            // TODO: fix plugin manager locking up the UI
            LoadTabs();

            if (showSplash)
            {
                SplashScreen.Reference.SafeFormClose();
            }

            if (showUi)
            {
                // Visible and to front
                Visible  = true;
                TopLevel = true;
                BringToFront();
                FocusMe();
            }
            else
            {
                // If we're starting minimized, we have to make sure the tray is enabled
                Config.WriteBool("notifications", "enabled", false);
                Config.WriteBool("notifications", "always", false);
            }
            Logger.Log(LogLevel.Info, "mainform", "Finished loading");
        }