Beispiel #1
0
        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;
        }
Beispiel #2
0
        private string GetString(Game game, MatchedGroup group, out int index)
        {
            if (!group.Refs.ContainsKey(game))
            {
                index = -1;
                return(null);
            }

            return(GetString(game, group.Refs[game].Label, out index));
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        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 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 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 string GetString(Game game, MatchedGroup group, out int index)
        {
            if (!group.Refs.ContainsKey(game))
            {
                index = -1;
                return null;
            }

            return GetString(game, group.Refs[game].Label, out index);
        }
 private string GetString(Game game, MatchedGroup group)
 {
     int index;
     return GetString(game, group, out index);
 }
Beispiel #11
0
        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);
        }
Beispiel #12
0
        private string GetString(Game game, MatchedGroup group)
        {
            int index;

            return(GetString(game, group, out index));
        }
 public MatchedGroupNavigationEntry(MatchedGroup group, MatchedGroupCollection collection)
 {
     Group = group;
     Collection = collection;
 }
 public MatchedGroupNavigationEntry(MatchedGroup group, MatchedGroupCollection collection)
 {
     Group      = group;
     Collection = collection;
 }