public static FormFactions Instance(SaveGameEditor sge, string standardErrorText, CatDatExtractor cde)
        {
            lock (LockInstance)
            {
                if (instance == null)
                {
                    instance = new FormFactions(sge, standardErrorText, cde);
                }

                return(instance);
            }
        }
        void ChangeFormState()
        {
            try
            {
                #region Save game related
                if (sge != null &&
                    sge.XMLLoaded()
                    )
                {
                    // Bind Save Game Screens to tabs is not already done
                    if (SaveGameInfoForm == null)
                    {
                        SaveGameInfoForm          = FormSaveGameInfo.Instance(sge, StandardErrorText);
                        SaveGameInfoForm.TopLevel = false;
                        tabPageGameInfo.Controls.Add(SaveGameInfoForm);
                        SaveGameInfoForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                        SaveGameInfoForm.Dock            = DockStyle.Fill;
                        SaveGameInfoForm.Show();
                    }

                    if (PlayerSkunkForm == null)
                    {
                        PlayerSkunkForm          = FormPlayerSkunk.Instance(sge, cde, StandardErrorText);
                        PlayerSkunkForm.TopLevel = false;
                        tabPageSkunk.Controls.Add(PlayerSkunkForm);
                        PlayerSkunkForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                        PlayerSkunkForm.Dock            = DockStyle.Fill;
                        PlayerSkunkForm.Show();
                    }

                    if (FactionsForm == null)
                    {
                        FactionsForm          = FormFactions.Instance(sge, StandardErrorText, cde);
                        FactionsForm.TopLevel = false;
                        tabPageFactions.Controls.Add(FactionsForm);
                        FactionsForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                        FactionsForm.Dock            = DockStyle.Fill;
                        FactionsForm.Show();
                    }

                    if (NPCsForm == null)
                    {
                        NPCsForm          = FormNPCs.Instance(sge, cde, StandardErrorText);
                        NPCsForm.TopLevel = false;
                        tabPageNPCs.Controls.Add(NPCsForm);
                        NPCsForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                        NPCsForm.Dock            = DockStyle.Fill;
                        NPCsForm.Show();
                    }

                    if (UniverseEditorForm == null)
                    {
                        UniverseEditorForm          = FormUniverseEditor.Instance(sge, StandardErrorText, cde);
                        UniverseEditorForm.TopLevel = false;
                        tabPageUniverseEditor.Controls.Add(UniverseEditorForm);
                        UniverseEditorForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                        UniverseEditorForm.Dock            = DockStyle.Fill;
                        UniverseEditorForm.Show();
                    }

                    if (KnownTypesForm == null)
                    {
                        KnownTypesForm          = FormKnownTypes.Instance(sge, cde, StandardErrorText);
                        KnownTypesForm.TopLevel = false;
                        tabPageKnownTypes.Controls.Add(KnownTypesForm);
                        KnownTypesForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
                        KnownTypesForm.Dock            = DockStyle.Fill;
                        KnownTypesForm.Show();
                    }

                    // Enable buttons
                    buttonSave.Enabled   = true;
                    buttonUnload.Enabled = true;

                    // Enable and display tabs
                    if (!tabControlMain.TabPages.Contains(tabPageGameInfo))
                    {
                        tabControlMain.TabPages.Insert(0, tabPageGameInfo);
                        tabControlMain.TabPages.Insert(1, tabPageKnownTypes);
                        tabControlMain.TabPages.Insert(2, tabPageSkunk);
                        tabControlMain.TabPages.Insert(3, tabPageFactions);
                        tabControlMain.TabPages.Insert(4, tabPageNPCs);
                        tabControlMain.TabPages.Insert(5, tabPageUniverseEditor);
                        tabControlMain.SelectedIndex = 0;
                    }

                    // Change children form states
                    SaveGameInfoForm.ChangeFormState();
                    KnownTypesForm.ChangeFormState();
                    PlayerSkunkForm.ChangeFormState();
                    FactionsForm.ChangeFormState();
                    NPCsForm.ChangeFormState();
                    UniverseEditorForm.ChangeFormState();
                }
                else
                {
                    buttonSave.Enabled   = false;
                    buttonUnload.Enabled = false;
                    if (tabControlMain.TabPages.Contains(tabPageGameInfo))
                    {
                        tabControlMain.TabPages.Remove(tabPageGameInfo);
                        tabControlMain.TabPages.Remove(tabPageKnownTypes);
                        tabControlMain.TabPages.Remove(tabPageSkunk);
                        tabControlMain.TabPages.Remove(tabPageNPCs);
                        tabControlMain.TabPages.Remove(tabPageFactions);
                        tabControlMain.TabPages.Remove(tabPageUniverseEditor);
                    }
                }
                #endregion

                #region Cat Dat Extractor related
                if (cde != null)
                {
                    buttonBrowseXR.Enabled = false;
                }
                else
                {
                    buttonBrowseXR.Enabled = true;
                }
                #endregion
            }
            catch (Exception ex)
            {
                throw new Exception("Error occurred while changing the form state.", ex);
            }
        }