示例#1
0
        private void PopulateDefaultSettings(IDataSourceAdapter adapter)
        {
            cmbSourcePorts.DataSource = adapter.GetSourcePorts();
            cmbIwad.DataSource        = Util.GetIWadsDataSource(adapter);
            cmbSkill.DataSource       = Util.GetSkills();

            cmbSourcePorts.SelectedValue = m_appConfig.GetTypedConfigValue(ConfigType.DefaultSourcePort, typeof(int));
            cmbIwad.SelectedValue        = m_appConfig.GetTypedConfigValue(ConfigType.DefaultIWad, typeof(int));
            cmbSkill.SelectedItem        = m_appConfig.GetTypedConfigValue(ConfigType.DefaultSkill, typeof(string));
        }
示例#2
0
        private void PopulateDefaultSettings(IDataSourceAdapter adapter)
        {
            cmbSourcePorts.DataSource    = adapter.GetSourcePorts();
            cmbIwad.DataSource           = Util.GetIWadsDataSource(adapter);
            cmbSkill.DataSource          = Util.GetSkills();
            cmbFileManagement.DataSource = Enum.GetValues(typeof(FileManagement));
            cmbViewType.DataSource       = new string[] { "Grid", "Tile Large", "Tile Small" };

            cmbSourcePorts.SelectedValue    = m_appConfig.GetTypedConfigValue(ConfigType.DefaultSourcePort, typeof(int));
            cmbIwad.SelectedValue           = m_appConfig.GetTypedConfigValue(ConfigType.DefaultIWad, typeof(int));
            cmbSkill.SelectedItem           = m_appConfig.GetTypedConfigValue(ConfigType.DefaultSkill, typeof(string));
            cmbFileManagement.SelectedIndex = (int)Enum.Parse(typeof(FileManagement), (string)m_appConfig.GetTypedConfigValue(ConfigType.FileManagement, typeof(string)));
            cmbViewType.SelectedIndex       = (int)Enum.Parse(typeof(GameFileViewType), (string)m_appConfig.GetTypedConfigValue(ConfigType.GameFileViewType, typeof(string)));
        }
示例#3
0
        private void SetupSearchFilters()
        {
            chkAutoSearch.Checked = (bool)AppConfiguration.GetTypedConfigValue(ConfigType.AutoSearch, typeof(bool));

            ctrlSearch.SearchTextChanged += ctrlSearch_SearchTextChanged;
            Util.SetDefaultSearchFields(ctrlSearch);
        }
示例#4
0
        private void SetDefaultSelections()
        {
            int    port  = (int)AppConfiguration.GetTypedConfigValue(ConfigType.DefaultSourcePort, typeof(int));
            int    iwad  = (int)AppConfiguration.GetTypedConfigValue(ConfigType.DefaultIWad, typeof(int));
            string skill = (string)AppConfiguration.GetTypedConfigValue(ConfigType.DefaultSkill, typeof(string));

            ISourcePort sourcePort = DataSourceAdapter.GetSourcePorts().FirstOrDefault(x => x.SourcePortID == port);

            if (sourcePort != null)
            {
                m_currentPlayForm.SelectedSourcePort = sourcePort;
            }

            IIWadData iwadSource = DataSourceAdapter.GetIWads().FirstOrDefault(x => x.IWadID == Convert.ToInt32(iwad));

            if (iwadSource != null)
            {
                GameFileGetOptions      options      = new GameFileGetOptions(new GameFileSearchField(GameFileFieldType.GameFileID, iwadSource.GameFileID.Value.ToString()));
                IEnumerable <IGameFile> gameFileIwad = DataSourceAdapter.GetGameFiles(options);
                if (gameFileIwad.Any())
                {
                    m_currentPlayForm.SelectedIWad = gameFileIwad.First();
                }
            }

            if (skill != null)
            {
                m_currentPlayForm.SelectedSkill = skill;
            }
        }
示例#5
0
        private void HandlePlay(IEnumerable <IGameFile> gameFiles, ISourcePortData sourcePort)
        {
            LaunchData launchData = GetLaunchFiles(gameFiles);

            if (launchData.Success)
            {
                if (launchData.GameFile == null)
                {
                    var iwad = DataSourceAdapter.GetIWad((int)AppConfiguration.GetTypedConfigValue(ConfigType.DefaultIWad, typeof(int)));
                    if (iwad != null)
                    {
                        GameFileGetOptions options = new GameFileGetOptions(new GameFileSearchField(GameFileFieldType.GameFileID, iwad.GameFileID.Value.ToString()));
                        launchData.GameFile = DataSourceAdapter.GetGameFiles(options).FirstOrDefault();
                    }
                }

                if (launchData.GameFile != null)
                {
                    SetupPlayForm(launchData.GameFile);
                    if (sourcePort != null)
                    {
                        m_currentPlayForm.SelectedSourcePort = sourcePort;
                    }

                    if (m_currentPlayForm.ShowDialog(this) == DialogResult.OK)
                    {
                        try
                        {
                            HandlePlaySettings(m_currentPlayForm, m_currentPlayForm.SelectedGameProfile);
                            if (m_currentPlayForm.SelectedSourcePort != null)
                            {
                                m_playInProgress = StartPlay(launchData.GameFile, m_currentPlayForm.SelectedSourcePort, m_currentPlayForm.ScreenFilter);
                            }
                            ctrlSummary.PauseSlideshow();
                        }
                        catch (IOException)
                        {
                            MessageBox.Show(this, "The file is in use and cannot be launched. Please close any programs that may be using the file and try again.", "File In Use",
                                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        HandleSelectionChange(GetCurrentViewControl(), true);
                    }
                }
            }
            else if (!string.IsNullOrEmpty(launchData.ErrorTitle))
            {
                MessageBox.Show(this, launchData.ErrorTitle, launchData.ErrorDescription, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }