Ejemplo n.º 1
0
        private void ReadDeck()
        {
            var cards         = EfficiencyVoca.ReadCards(Resources.EfficiencyVoca);
            var keyGroupPairs = cards.GroupBy(
                keySelector: card => card.DAY_NO + "." + card.PREFIX_GRP,
                resultSelector: (key, group) => Tuple.Create(group.ElementAt(0).GetGroupTitle(), group));

            this.lbxCard.Items.Clear();
            this.lbxCard.Items.AddRange(keyGroupPairs.ToArray());
        }
Ejemplo n.º 2
0
        // 카드 리스트 선택시
        private void lbxCard_SelectedIndexChanged(object sender, EventArgs e)
        {
            var    item        = this.lbxCard.SelectedItem as Tuple <string, IEnumerable <EfficiencyVoca> >;
            var    group       = item.Item2;
            var    origin      = group.ElementAt(0);
            string color       = "black";
            string bgcolor     = "white";
            string derivecolor = "black";

            if (origin.VOCABULARY_TAG == "[접두사]")
            {
                color       = "red";
                bgcolor     = "#ffcccc";
                derivecolor = "darkblue";
            }
            else if (origin.VOCABULARY_TAG == "[접미사]")
            {
                color       = "blue";
                bgcolor     = "#ccccff";
                derivecolor = "darkgreen";
            }
            else if (origin.VOCABULARY_TAG == "[어근]")
            {
                color       = "green";
                bgcolor     = "#ccffcc";
                derivecolor = "darkred";
            }
            string dayTag = $"<tr><td align=center colspan=2>DAY{int.Parse(origin.DAY_NO):00}-{int.Parse(origin.PREFIX_GRP)+1}</td></tr>\r\n";
            var    html   =
                EfficiencyVoca.GetHtmlTop() +
                "<table>\r\n" +
                string.Join("", group.Select(voca => voca.GetHtmlTableRow(color, bgcolor, derivecolor)).ToArray()) +
                "</table>\r\n" +
                EfficiencyVoca.GetHtmlBottom();

            this.browser.DocumentText = html;
            this.Text = group.ElementAt(0).GetCaptionTitle();
            if (this.historyAdd == true)
            {
                HistoryAdd(this.lbxCard.SelectedIndex);
            }
        }