コード例 #1
0
        void UpdateStats(object sender, EventArgs e)
        {
            var statItem = Stats.FirstOrDefault(si => si.Name == activeDocument.Title);

            if (statItem == null)
            {
                statItem = new StatsItem();
                Stats.Add(statItem);
            }

            statItem.Name       = activeDocument.Title;
            statItem.LinesCount = Regex.Matches(activeDocument.TextContent, @"\n", RegexOptions.Multiline).Count;
            statItem.WordsCount = Regex.Matches(activeDocument.TextContent, @"[\S]+").Count;
        }
コード例 #2
0
        void UpdateStats(object sender, EventArgs e)
        {
            var statItem = Stats.FirstOrDefault(si => si.Name == activeDocument.Title);

            if (statItem == null)
            { 
                statItem = new StatsItem();
                Stats.Add(statItem);
            }

            statItem.Name = activeDocument.Title;
            statItem.LinesCount = Regex.Matches(activeDocument.TextContent, @"\n", RegexOptions.Multiline).Count;
            statItem.WordsCount = Regex.Matches(activeDocument.TextContent, @"[\S]+").Count;

        }