public List <Emulator> GetEmulators(bool forcePC = false) { List <Emulator> emus = new List <Emulator>(); SQLiteResultSet result = Execute("SELECT * FROM {0} ORDER BY position ASC", Emulator.TABLE_NAME); foreach (SQLiteResultSet.Row row in result.Rows) { emus.Add(Emulator.CreateEmulator(row)); } Emulator pc = Emulator.GetPC(); if (forcePC || GetGames(pc).Count > 0) { //sanitise position just in case if (pc.Position < 0) { pc.Position = 0; } else if (pc.Position > emus.Count) { pc.Position = emus.Count; } emus.Insert(pc.Position, pc); //Insert PC into correct position in list } return(emus); }
void updateArgsVisibilty() { ComboBoxItem item = emuComboBox.SelectedItem as ComboBoxItem; bool visible = item != null && item.ID == Emulator.GetPC().UID; argsInfoText.Visible = visible; argsLabel.Visible = visible; argsTextBox.Visible = visible; }
public void SwitchView() { bool showPC = DB.Instance.GetGames(Emulator.GetPC()).Count > 0; StartupState newState = MenuPresenter.ShowViewsDialog(startupState, showPC); if (startupItem != null || newState != startupState) { startupState = newState; startupItem = null; toggleDetails(null, true); loadStartupItems(0); } }
bool loadStartupItems(int index) { lastItem = null; lastitemIndex = 0; if (startupItem != null) { return(handleStartupItem(index)); } List <DBItem> items = new List <DBItem>(); int layout; if (startupState == StartupState.FAVOURITES) { items.AddRange(DB.Instance.GetGames("WHERE favourite='True' ORDER BY title ASC", false)); layout = Options.Instance.GetIntOption("viewfavourites"); } else if (startupState == StartupState.PCGAMES) { items.AddRange(DB.Instance.GetGames(Emulator.GetPC())); layout = Options.Instance.GetIntOption("viewpcgames"); } else if (startupState == StartupState.GROUPS) { foreach (RomGroup group in GroupHandler.Instance.Groups) { group.RefreshThumbs(); items.Add(group); } layout = groupsLayout; } else { foreach (Emulator emu in DB.Instance.GetEmulators()) { items.Add(emu); } layout = Options.Instance.GetIntOption("viewemus"); } if (!setItemsToFacade(items.ToArray(), null, 0, index)) { return(false); } setLayout(layout); return(true); }
public Emulator GetEmulator(int uid) { if (uid == -1) { return(Emulator.GetPC()); } SQLiteResultSet result = Execute("SELECT * FROM {0} WHERE uid={1}", Emulator.TABLE_NAME, uid); if (result.Rows.Count < 1) { Logger.LogError("Unable to locate Emulator with uid {0}", uid); return(null); } return(Emulator.CreateEmulator(result.Rows[0])); }
void initEmuBox() { bool selected = false; emuComboBox.Items.Clear(); foreach (ComboBoxItem item in Dropdowns.GetNewRomComboBoxItems()) { emuComboBox.Items.Add(item); if (!selected && item.ID == Emulator.GetPC().UID) { emuComboBox.SelectedItem = item; selected = true; } } if (!selected && emuComboBox.Items.Count > 0) { emuComboBox.SelectedItem = emuComboBox.Items[0]; } emuComboBox.SelectedIndexChanged += new EventHandler(emuComboBox_SelectedIndexChanged); updateArgsVisibilty(); }