public Conf_NewProfile(Emulator emu, EmulatorProfile profile) { InitializeComponent(); if (profile == null) { EmulatorProfile = new EmulatorProfile(false); if (!emu.IsPc()) EmulatorProfile.EmulatorPath = emu.DefaultProfile.EmulatorPath; } else { EmulatorProfile = profile; this.Text = "Rename Profile"; } profileTitleTextBox.SelectedText = EmulatorProfile.Title; }
private void delProfileButton_Click(object sender, EventArgs e) { if (selectedEmulator == null) return; if (selectedProfile.IsDefault) { Logger.LogDebug("Default profile cannot be deleted"); return; } EmulatorProfile profile = selectedProfile; saveProfile = false; selectedProfile = null; int index = profileComboBox.SelectedIndex; profileComboBox.Items.Remove(profile); selectedEmulator.EmulatorProfiles.Remove(profile); saveSelectedEmulator = true; profile.Delete(); if (index > 0) profileComboBox.SelectedIndex = index - 1; else profileComboBox.SelectedIndex = 0; }
//Updates the panels with the selected Emulator's details. private void setEmulatorToPanel(ListViewItem listViewItem) { //reset status flags saveSelectedEmulator = false; saveThumbs = false; saveProfile = false; //get the selected Emulator Emulator dbEmu = listViewItem.Tag as Emulator; selectedEmulator = dbEmu; if (dbEmu == null) return; allowChangedEvents = false; int index = platformComboBox.FindStringExact(dbEmu.Platform); if (index < 0) index = 0; platformComboBox.SelectedIndex = index; //.SelectedItem = platformComboBox.Items[index]; txt_Title.Text = dbEmu.Title; romDirTextBox.Text = dbEmu.PathToRoms; filterTextBox.Text = dbEmu.Filter; txt_company.Text = dbEmu.Developer; txt_yearmade.Text = dbEmu.Year.ToString(); txt_description.Text = dbEmu.Description; gradeUpDown.Value = dbEmu.Grade; EmuAutoConfig.SetupAspectDropdown(thumbAspectComboBox, dbEmu.CaseAspect); videoTextBox.Text = dbEmu.VideoPreview; idLabel.Text = dbEmu.Id.ToString(); if (emuThumbs != null) emuThumbs.Dispose(); emuThumbs = new ThumbGroup(dbEmu); if (mainTabControl.SelectedTab == thumbsTabPage) { setGameArt(emuThumbs); thumbsLoaded = true; } else { setGameArt(null); thumbsLoaded = false; } txt_Manual.Text = emuThumbs.ManualPath; selectedProfile = null; profileComboBox.Items.Clear(); foreach (EmulatorProfile profile in selectedEmulator.EmulatorProfiles) { profileComboBox.Items.Add(profile); if (profile.IsDefault) { profileComboBox.SelectedItem = profile; selectedProfile = profile; } } allowChangedEvents = true; profileComboBox_SelectedIndexChanged(profileComboBox, new EventArgs()); }
//Fired when the user selectes an item in the listview void emulatorListView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { //This event is fired twice, once for the item losing selection //and once for the item being selected. Ensure we only process //one for performance. if (!e.IsSelected) return; updateEmulator(); updateProfile(); if (emulatorListView.SelectedItems.Count != 1) { //multiple items selected, shouldn't occur //with current setup but just in case. selectedListItem = null; selectedEmulator = null; selectedProfile = null; return; } selectedListItem = e.Item; //update panel with selected emu details setEmulatorToPanel(selectedListItem); //update panel enablings updatePanels(); updateButtons(); }
//Fired when a new profile is selected from the profile dropdown. //Save any changes to current profile and update panel with new //profile details. void profileComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (!allowChangedEvents) return; updateProfile(); selectedProfile = profileComboBox.SelectedItem as EmulatorProfile; if (selectedProfile == null) { clearProfileForm(); return; } allowChangedEvents = false; //don't fire changed event when we are updating emuPathTextBox.Text = selectedProfile.EmulatorPath; workingDirTextBox.Text = selectedProfile.WorkingDirectory; argumentsTextBox.Text = selectedProfile.Arguments; launchedFileTextBox.Text = selectedProfile.LaunchedExe; useQuotesCheckBox.Checked = selectedProfile.UseQuotes; //suspend suspendMPCheckBox.Checked = selectedProfile.SuspendMP; delayResumeCheckBox.Checked = selectedProfile.DelayResume; resumeDelayUpDown.Value = selectedProfile.ResumeDelay; bool enabled = suspendMPCheckBox.Checked; delayResumeCheckBox.Enabled = enabled; resumeDelayUpDown.Enabled = enabled; enableGoodCheckBox.Checked = selectedProfile.EnableGoodmerge; goodComboBox.Text = selectedProfile.GoodmergeTags; mountImagesCheckBox.Checked = selectedProfile.MountImages; escExitCheckBox.Checked = selectedProfile.EscapeToExit; checkControllerCheckBox.Checked = selectedProfile.CheckController; stopEmulationCheckBox.CheckState = selectedProfile.StopEmulationOnKey.HasValue ? selectedProfile.StopEmulationOnKey.Value ? CheckState.Checked : CheckState.Unchecked : CheckState.Indeterminate; preCommandText.Text = selectedProfile.PreCommand; preCommandWaitCheck.Checked = selectedProfile.PreCommandWaitForExit; preCommandWindowCheck.Checked = selectedProfile.PreCommandShowWindow; postCommandText.Text = selectedProfile.PostCommand; postCommandWaitCheck.Checked = selectedProfile.PostCommandWaitForExit; postCommandWindowCheck.Checked = selectedProfile.PostCommandShowWindow; allowChangedEvents = true; updateButtons(); }
void setProfileToPanel(EmulatorProfile selectedProfile) { currentPCProfile = selectedProfile; updatePCSettingsButtons(); if (selectedProfile == null) return; suspendMPCheckBox.Checked = selectedProfile.SuspendMP; argumentsTextBox.Text = selectedProfile.Arguments; launchedFileTextBox.Text = selectedProfile.LaunchedExe; preCommandText.Text = selectedProfile.PreCommand; preCommandWaitCheck.Checked = selectedProfile.PreCommandWaitForExit; preCommandWindowCheck.Checked = selectedProfile.PreCommandShowWindow; postCommandText.Text = selectedProfile.PostCommand; postCommandWaitCheck.Checked = selectedProfile.PostCommandWaitForExit; postCommandWindowCheck.Checked = selectedProfile.PostCommandShowWindow; }