示例#1
0
        private void Print(DataSet data, string url, int count)
        {
            List <Review> reviews = new List <Review>();
            ParsingWeb    parser = new ParsingWeb();
            int           it = 0, hund = 0;

            try
            {
                parser.Parse(count, ref url, ref it, ref hund, ref reviews);
            }
            catch (Exception)
            {
                MessageBox.Show("ошибка mail.ru");
                return;
            }

            this.Dispatcher.Invoke(new Action(() =>
            {
                listReviews.Items.Clear();
                foreach (var rev in reviews)
                {
                    StackPanel panel  = new StackPanel();
                    panel.Orientation = Orientation.Horizontal;
                    TextBox label1    = new TextBox();
                    label1.Text       = rev.Text;
                    TextBox label2    = new TextBox();

                    Classifier.Classify(rev, data);

                    if (rev.MyTonality)
                    {
                        label2.Text = "положительный";
                    }
                    else
                    {
                        label2.Text = "отрицательный ";
                    }

                    label1.Width        = 375;
                    label1.TextWrapping = TextWrapping.Wrap;
                    panel.Children.Add(label1);
                    panel.Children.Add(label2);
                    listReviews.Items.Add(panel);
                }

                statisticValue.Content = Statistics.Calculate(reviews);
            }));
        }
        private void Print(DataSet data, string url, int count)
        {
            List<Review> reviews = new List<Review>();
            ParsingWeb parser = new ParsingWeb();
            int it = 0, hund = 0;

            try
            {
                parser.Parse(count, ref url, ref it, ref hund, ref reviews);
            }
            catch (Exception)
            {
                MessageBox.Show("ошибка mail.ru");
                return;
            }

            this.Dispatcher.Invoke(new Action(() =>
            {
                listReviews.Items.Clear();
                foreach (var rev in reviews)
                {
                    StackPanel panel = new StackPanel();
                    panel.Orientation = Orientation.Horizontal;
                    TextBox label1 = new TextBox();
                    label1.Text = rev.Text;
                    TextBox label2 = new TextBox();

                    Classifier.Classify(rev, data);

                    if (rev.MyTonality)
                        label2.Text = "положительный";
                    else
                        label2.Text = "отрицательный ";

                    label1.Width = 375;
                    label1.TextWrapping = TextWrapping.Wrap;
                    panel.Children.Add(label1);
                    panel.Children.Add(label2);
                    listReviews.Items.Add(panel);
                }

                statisticValue.Content = Statistics.Calculate(reviews);
            }));
        }