Example #1
0
        private void newDiscButton_Click(object sender, EventArgs e)
        {
            if (selectedGame == null)
            {
                return;
            }

            string filter    = selectedGame.ParentEmulator.Filter;
            string filterStr = string.Format("{0} rom ({1}) | {2}|All files (*.*) | *.*", selectedGame.ParentEmulator.Title, filter.Replace(";", ", "), filter);

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select file", filterStr, System.IO.Path.GetDirectoryName(selectedGame.Path)))
            {
                dlg.Multiselect = true;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    foreach (string filename in dlg.FileNames)
                    {
                        GameDisc newDisc = new GameDisc(selectedGame);
                        newDisc.Path = filename;
                        int index = discBindingSource.Add(newDisc);
                        newDisc.Number = index + 1;
                    }
                    saveDiscs = true;
                }
            }
        }
Example #2
0
        private void btnNewManual_Click(object sender, EventArgs e)
        {
            if (selectedGame == null)
            {
                return;
            }

            string filter = "PDF | *.pdf";

            string initialDirectory;

            if (txt_Manual.Text != "" && txt_Manual.Text.LastIndexOf("\\") > -1)
            {
                initialDirectory = txt_Manual.Text.Remove(txt_Manual.Text.LastIndexOf("\\"));
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select manual", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    txt_Manual.Text = dlg.FileName;
                }
            }
        }
Example #3
0
        private void videoButton_Click(object sender, EventArgs e)
        {
            if (selectedGame == null)
            {
                return;
            }

            string filter = "All files (*.*) | *.*";
            string initialDirectory;

            if (System.IO.File.Exists(videoTextBox.Text))
            {
                initialDirectory = System.IO.Directory.GetParent(videoTextBox.Text).FullName;
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select path to preview video", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    videoTextBox.Text = dlg.FileName;
                }
            }
        }
Example #4
0
        //show dialog allowing user to select path to backup
        private void restorePathButton_Click(object sender, EventArgs e)
        {
            string title            = "Select backup file...";
            string filter           = "XML (*.xml)|*.xml";
            string initialDirectory = null;
            string path             = restorePathTextBox.Text;

            if (!string.IsNullOrEmpty(path))
            {
                int index = path.LastIndexOf("\\");
                if (index > -1)
                {
                    path = path.Remove(index);
                }
                if (System.IO.Directory.Exists(path))
                {
                    initialDirectory = path;
                }
            }
            if (initialDirectory == null)
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog(title, filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    restorePathTextBox.Text = dlg.FileName;
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string title = "Select working directory";
            string initialDir;

            if (System.IO.Directory.Exists(workingDirTextBox.Text))
            {
                initialDir = workingDirTextBox.Text;
            }
            else if (Emulator.DefaultProfile.EmulatorPath.LastIndexOf("\\") > -1)
            {
                initialDir = Emulator.DefaultProfile.EmulatorPath.Substring(0, Emulator.DefaultProfile.EmulatorPath.LastIndexOf("\\"));
            }
            else
            {
                initialDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (FolderBrowserDialog dlg = Emulators2Settings.OpenFolderDialog(title, initialDir))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    workingDirTextBox.Text = dlg.SelectedPath;
                }
            }
        }
Example #6
0
        private void workingDirBrowseButton_Click(object sender, EventArgs e)
        {
            string title = "Select working directory";
            string initialDir;

            if (System.IO.Directory.Exists(workingDirTextBox.Text))
            {
                initialDir = workingDirTextBox.Text;
            }
            else if (emuPathTextBox.Text != "" && emuPathTextBox.Text.LastIndexOf("\\") > -1)
            {
                initialDir = emuPathTextBox.Text.Remove(emuPathTextBox.Text.LastIndexOf("\\"));
            }
            else
            {
                initialDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            FolderBrowserDialog dlg = Emulators2Settings.OpenFolderDialog(title, initialDir);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                workingDirTextBox.Text = dlg.SelectedPath;
            }
        }
Example #7
0
        void importGridView_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
        {
            if (importGridView.CurrentCell == null || importGridView.CurrentCell.ColumnIndex != columnTitle.Index)
            {
                return;
            }

            currentComboBox = e.Control as ComboBox;
            if (currentComboBox != null)
            {
                currentComboBox.SelectedIndexChanged += comboBoxChangedHandler;
                currentComboBox.Tag = importGridView.Rows[importGridView.CurrentCell.RowIndex].DataBoundItem;
                int maxWidth = Emulators2Settings.GetComboBoxDropDownWidth(currentComboBox);
                columnTitle.DropDownWidth = maxWidth > columnTitle.Width ? maxWidth : columnTitle.Width;
            }
        }
Example #8
0
        private void thumbDirButton_Click(object sender, EventArgs e)
        {
            string initialDir = thumbDirTextBox.Text;

            if (!System.IO.Directory.Exists(initialDir))
            {
                initialDir = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Thumbs);
            }

            using (FolderBrowserDialog dlg = Emulators2Settings.OpenFolderDialog("Select thumb directory", initialDir))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    thumbDirTextBox.Text = dlg.SelectedPath;
                }
            }
        }
Example #9
0
        private void romDirButton_Click(object sender, EventArgs e)
        {
            string title = "Select directory containing Roms";
            string initialDir;

            if (System.IO.Directory.Exists(romDirTextBox.Text))
            {
                initialDir = romDirTextBox.Text;
            }
            else
            {
                initialDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (FolderBrowserDialog dlg = Emulators2Settings.OpenFolderDialog(title, initialDir))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    romDirTextBox.Text = dlg.SelectedPath;
                }
            }
        }
Example #10
0
        private void pathBrowseButton_Click(object sender, EventArgs e)
        {
            string filter = "All files (*.*) | *.*";
            string initialDirectory;
            int    index = pathTextBox.Text.LastIndexOf("\\");

            if (index > -1)
            {
                initialDirectory = pathTextBox.Text.Remove(index);
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Path to game", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    pathTextBox.Text = dlg.FileName;
                }
            }
        }
Example #11
0
        private void emuPathBrowseButton_Click(object sender, EventArgs e)
        {
            string filter = "Executables (*.bat, *.exe) | *.bat;*.exe";

            string initialDirectory;
            int    index = emuPathTextBox.Text.LastIndexOf("\\");

            if (index > -1)
            {
                initialDirectory = emuPathTextBox.Text.Remove(index);
            }
            else
            {
                initialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            }

            using (OpenFileDialog dlg = Emulators2Settings.OpenFileDialog("Select path to emulator", filter, initialDirectory))
            {
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    emuPathTextBox.Text = dlg.FileName;
                }
            }
        }
        void resultsComboBox_DropDown(object sender, EventArgs e)
        {
            int maxWidth = Emulators2Settings.GetComboBoxDropDownWidth(resultsComboBox);

            resultsComboBox.DropDownWidth = maxWidth > resultsComboBox.Width ? maxWidth : resultsComboBox.Width;
        }