コード例 #1
0
        private void addRomPackInDirectoryStructureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                FolderBrowserDialog open = new FolderBrowserDialog();
                open.SelectedPath = Environment.CurrentDirectory;

                if (open.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                if (open.SelectedPath.Length == 0)
                {
                    return;
                }

                Platform selected = null;

                if (FormChoose.ChoosePlatform(out selected))
                {
                    RomFunctions.AddRomPacksFromDirectory(selected, open.SelectedPath);
                    FilterRoms();
                }
            }
            catch (Exception ex)
            {
                FormCustomMessage.ShowError(ex.Message);
            }
        }
コード例 #2
0
        public static bool ChooseGenre(out Genre selectedGenre)
        {
            instance = new FormChoose(typeof(Genre));
            var result = instance.ShowDialogUpdated();

            selectedGenre = instance.SelectedGenre;
            return(result);
        }
コード例 #3
0
        public static bool ChoosePlatform(out Platform selectedPlatform)
        {
            instance = new FormChoose(typeof(Platform));
            var result = instance.ShowDialogUpdated();

            selectedPlatform = instance.SelectedPlatform;
            return(result);
        }
コード例 #4
0
        public static bool ChooseStatus(string oldStatus, out string selectedStatus)
        {
            instance = new FormChoose(typeof(string));
            instance.comboBox.SelectedItem = oldStatus;
            var result = instance.ShowDialogUpdated();

            selectedStatus = instance.SelectedStatus;
            return(result);
        }
コード例 #5
0
        private void changeStatusToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView.SelectedRows.Count == 0)
                {
                    return;
                }

                RomStatus status      = ((Rom)dataGridView.SelectedRows[0].Tag).Status;
                var       statusvalue = status == null ? "" : status.Status;
                string    newstatus   = "";

                if (!FormChoose.ChooseStatus(statusvalue, out newstatus))
                {
                    return;
                }

                List <Rom> romList = new List <Rom>();

                foreach (DataGridViewRow row in dataGridView.SelectedRows)
                {
                    var rom = (Rom)row.Tag;
                    romList.Add(rom);
                }

                RomStatusBusiness.SetRomStatus(romList, newstatus);

                foreach (DataGridViewRow row in dataGridView.SelectedRows)
                {
                    Rom rom = (Rom)row.Tag;

                    if (rom.Status != null && !string.IsNullOrEmpty(rom.Status.Status))
                    {
                        row.Cells[columnStatus.Index].Value           = rom.Status.Status;
                        row.Cells[columnStatus.Index].Style.BackColor = Color.Navy;
                        row.Cells[columnStatus.Index].Style.ForeColor = Color.White;
                    }
                    else
                    {
                        row.Cells[columnStatus.Index].Value           = "";
                        row.Cells[columnStatus.Index].Style.ForeColor = dataGridView.RowTemplate.DefaultCellStyle.ForeColor;
                        row.Cells[columnStatus.Index].Style.BackColor = dataGridView.RowTemplate.DefaultCellStyle.BackColor;
                    }
                }

                dataGridView.Refresh();
            }
            catch (Exception ex)
            {
                FormCustomMessage.ShowError(ex.Message);
            }
        }
コード例 #6
0
        private void toolStripButtonAddRom_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog open = new OpenFileDialog();
                open.InitialDirectory = Environment.CurrentDirectory;

                open.Filter = "Roms | *.zip;*.smc;*.fig;*.gba;*.gbc;*.gb;*.pce;*.n64;*.smd;*.sms;*.ccd;*.cue;*.bin;*.iso;*.gdi;*.cdi|" +
                              "Zip | *.zip|" +
                              "CD | *.cue|" +
                              "CD | *.ccd|" +
                              "CD ISO | *.iso|" +
                              "CD Image | *.bin|" +
                              "Dreamcast Image | *.cdi;*.gdi|" +
                              "Snes | *.smc|" +
                              "Snes | *.fig|" +
                              "GBA | *.gba|" +
                              "GBC | *.gbc|" +
                              "GB | *.gb|" +
                              "PC Engine | *.pce|" +
                              "N64 | *.n64|" +
                              "Mega Drive | *.smd|" +
                              "Master System | *.sms|" +
                              "All | *.*";
                open.Multiselect = true;

                if (open.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                if (open.FileNames.Length == 0)
                {
                    return;
                }

                Platform platform = null;
                FormChoose.ChoosePlatform(out platform);
                RomFunctions.AddRomsFiles(platform, open.FileNames);

                FilterRoms();
            }
            catch (Exception ex)
            {
                FormCustomMessage.ShowError(ex.Message);
            }
        }
コード例 #7
0
        private void changeGenreToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Genre selected = null;

                if (!FormChoose.ChooseGenre(out selected))
                {
                    return;
                }

                List <Rom> romList = new List <Rom>();

                foreach (DataGridViewRow row in dataGridView.SelectedRows)
                {
                    romList.Add((Rom)row.Tag);
                }

                GenreBusiness.ChangeRomsGenre(romList, selected);

                foreach (DataGridViewRow row in dataGridView.SelectedRows)
                {
                    Rom rom = (Rom)row.Tag;

                    if (rom.Genre != null)
                    {
                        row.Cells[columnGenre.Index].Value           = rom.Genre.Name;
                        row.Cells[columnGenre.Index].Style.BackColor = rom.Genre.Color;
                        row.Cells[columnGenre.Index].Style.ForeColor = Functions.SetFontContrast(rom.Genre.Color);
                    }
                    else
                    {
                        row.Cells[columnGenre.Index].Value           = "";
                        row.Cells[columnGenre.Index].Style.BackColor = Color.White;
                        row.Cells[columnGenre.Index].Style.ForeColor = Color.Black;
                    }
                }

                dataGridView.Refresh();
            }
            catch (Exception ex)
            {
                FormCustomMessage.ShowError(ex.Message);
            }
        }