Exemple #1
0
        //public

        public void Format()
        {
            ArticleStock = ArticleBiz.ParseArticle(this.Text, Stocks);
            ArticleStock.ForEach(stock =>
            {
                var index = 0;
                do
                {
                    index = this.Text.IndexOf(stock.StockName, index + 1);
                    if (index > 0)
                    {
                        this.Select(index, stock.StockName.Length);
                        this.SelectionColor = Color.Red;
                        //ArticleStock.Add(stock);
                    }
                } while (index > 0);

                do
                {
                    index = this.Text.IndexOf(stock.StockCode, index + 1);
                    if (index > 0)
                    {
                        this.Select(index, stock.StockName.Length);
                        this.SelectionColor = Color.Red;
                        //ArticleStock.Add(stock);
                    }
                } while (index > 0);
            });
            if (ArticleStock.Count > 0)
            {
                ArticleStock = ArticleStock.Distinct().ToList();
                this.AppendText(Environment.NewLine);
                this.AppendText(Environment.NewLine);
                this.AppendText(ArticleStock.Select(stock => stock.StockName)
                                .Aggregate((a, b) => a + "," + b));
            }
        }