private void SetupPlayForm(IGameFile gameFile)
        {
            m_currentPlayForm = new PlayForm(AppConfiguration, DataSourceAdapter);
            m_currentPlayForm.SaveSettings += m_currentPlayForm_SaveSettings;
            m_currentPlayForm.OnPreviewLaunchParameters += m_currentPlayForm_OnPreviewLaunchParameters;
            m_currentPlayForm.StartPosition              = FormStartPosition.CenterParent;

            List <ITabView> views = GetAdditionalTabViews();

            if (gameFile != null)
            {
                gameFile = DataSourceAdapter.GetGameFile(gameFile.FileName); //this file came from the grid, which does not have all info populated to save perfomance
            }
            m_currentPlayForm.Initialize(views, gameFile);

            SetDefaultSelections();

            if (gameFile != null)
            {
                IIWadData iwad = DataSourceAdapter.GetIWad(gameFile.GameFileID.Value);

                if (iwad != null)
                {
                    m_currentPlayForm.SelectedIWad = gameFile;
                }

                if (gameFile.SourcePortID.HasValue)
                {
                    m_currentPlayForm.SelectedSourcePort = DataSourceAdapter.GetSourcePort(gameFile.SourcePortID.Value);
                }

                if (gameFile.IWadID.HasValue)
                {
                    m_currentPlayForm.SelectedIWad = gameFile;
                    m_currentPlayForm.SelectedIWad = DataSourceAdapter.GetGameFileIWads().FirstOrDefault(x => x.IWadID == gameFile.IWadID);
                }

                if (!string.IsNullOrEmpty(gameFile.SettingsMap))
                {
                    m_currentPlayForm.SelectedMap = gameFile.SettingsMap;
                }
                if (!string.IsNullOrEmpty(gameFile.SettingsSkill))
                {
                    m_currentPlayForm.SelectedSkill = gameFile.SettingsSkill;
                }
                if (!string.IsNullOrEmpty(gameFile.SettingsExtraParams))
                {
                    m_currentPlayForm.ExtraParameters = gameFile.SettingsExtraParams;
                }
                if (!string.IsNullOrEmpty(gameFile.SettingsSpecificFiles))
                {
                    m_currentPlayForm.SpecificFiles = gameFile.SettingsSpecificFiles.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                }
            }

            m_currentPlayForm.InitializeComplete();
        }
Exemple #2
0
        private void SetupPlayForm(IGameFile gameFile)
        {
            m_currentPlayForm = new PlayForm(AppConfiguration, DataSourceAdapter);
            m_currentPlayForm.SaveSettings += m_currentPlayForm_SaveSettings;
            m_currentPlayForm.OnPreviewLaunchParameters += m_currentPlayForm_OnPreviewLaunchParameters;
            m_currentPlayForm.StartPosition              = FormStartPosition.CenterParent;

            m_currentPlayForm.Initialize(GetAdditionalTabViews(), gameFile);
            m_currentPlayForm.SetGameProfile(GetGameProfile(gameFile));
        }