private void NavigateTo(Game game, string label, out MatchedGroup group, out MatchedGroupCollection collection) { foreach (var eachGame in validGames) { currentIndex[eachGame] = -1; textboxLookup[eachGame].Text = ""; } string labelDef = "^" + label + "^"; int index; textboxLookup[game].Text = GetString(game, label, out index); currentIndex[game] = index; if (game == Game.M12 || game == Game.M12English) { if (game == Game.M12) { textboxLookup[Game.M12English].Text = GetString(Game.M12English, label, out index); currentIndex[Game.M12English] = index; } else if (game == Game.M12English) { textboxLookup[Game.M12].Text = GetString(Game.M12, label, out index); currentIndex[Game.M12] = index; } string m12 = textboxLookup[Game.M12].Text; if (m12 != null && m12 == m12Compiler.StripText(m12)) { m12String.BackColor = Color.Orange; } else { m12String.BackColor = Color.White; } } else { m12String.BackColor = Color.White; } previousNavigationState = new ReferenceNavigationEntry(game, label); FindGroup(game, label, out group, out collection); // Check if any other games have this matched ref if (group != null) { foreach (var otherGame in group.Refs.Where(kv => kv.Key != game)) { labelDef = "^" + otherGame.Value.Label + "^"; textboxLookup[otherGame.Key].Text = GetString(otherGame.Key, otherGame.Value.Label, out index); currentIndex[otherGame.Key] = index; } } PopulateCodeList(); PopulateReferenceList(); previewButton_Click(null, null); }
private void collectionSelector_SelectionChangeCommitted(object sender, EventArgs e) { if (collectionSelector.SelectedIndex == -1) { groupSelector.Items.Clear(); previewer.DisplayedString = null; } else { var collection = (MatchedGroupCollection)collectionSelector.SelectedItem; // Set the previewer width before we do navigation stuff if (collection == psiHelpGroups) { previewer.MaxWidth = 224; } else if (collection == battleActionGroups) { previewer.MaxWidth = 176; } else { previewer.MaxWidth = 144; } // Take no action if we haven't actually changed the collection // (otherwise, the group selector would jump to 0, probably unwanted) if (collection == currentCollection) return; currentCollection = collection; PopulateGroupSelector(collection); groupSelector.SelectedIndex = 0; groupSelector_SelectionChangeCommitted(null, null); } }
private void FindGroup(Game game, string label, out MatchedGroup group, out MatchedGroupCollection collection) { // Attempt to find the label string labelDef = "^" + label + "^"; string str = stringsLookup[game].First(s => s.Contains(labelDef)); foreach (var coll in matchedCollections.Where(c => c.Games.Contains(game))) { var match = coll.Groups.FirstOrDefault(g => str.Contains("^" + g.Refs[game].Label + "^")); if (match != null) { group = match; collection = coll; return; } } group = null; collection = null; }
private void SelectGroup(MatchedGroup group, MatchedGroupCollection collection) { if (collection != null) { if ((MatchedGroupCollection)collectionSelector.SelectedItem != collection) { collectionSelector.SelectedItem = collection; PopulateGroupSelector(collection); } if (group != null) { groupSelector.SelectedItem = group; } else { groupSelector.SelectedIndex = -1; } } else { collectionSelector.SelectedIndex = -1; groupSelector.SelectedIndex = -1; } currentCollection = collection; }
private void NavigateTo(MatchedGroup group, MatchedGroupCollection collection) { if (group == null) { ebString.Text = ""; m12String.Text = ""; m12StringEnglish.Text = ""; } else { int index; string eb = GetString(Game.Eb, group, out index); currentIndex[Game.Eb] = index; string m12 = GetString(Game.M12, group, out index); currentIndex[Game.M12] = index; string m12English = GetString(Game.M12English, group, out index); currentIndex[Game.M12English] = index; ebString.Text = eb; m12String.Text = m12; m12StringEnglish.Text = m12English; previousNavigationState = new MatchedGroupNavigationEntry(group, collection); if (m12 != null && m12 == m12Compiler.StripText(m12)) { m12String.BackColor = Color.Orange; } else { m12String.BackColor = Color.White; } } PopulateCodeList(); PopulateReferenceList(); previewButton_Click(null, null); }
private void PopulateGroupSelector(MatchedGroupCollection collection) { groupSelector.Items.Clear(); if (collection != null) { groupSelector.Items.AddRange(collection.Groups.ToArray()); } }
public MatchedGroupNavigationEntry(MatchedGroup group, MatchedGroupCollection collection) { Group = group; Collection = collection; }