Ejemplo n.º 1
0
        private void showWordStatisticsButton_Click(object sender, EventArgs e)
        {
            List <KeyValuePair <string, WordUsageStatistics.WordUsageData> > orderedWordsUsageData = WordUsageStatistics.GetWordUsageStatisticsOfPosts(m_LoggedInUser, startDatePicker.Value, endDatePicker.Value);

            wordUsageDataPanel.Controls.Clear();
            int wordPanelWidth = wordUsageDataPanel.ClientSize.Width - 25;

            foreach (KeyValuePair <string, WordUsageStatistics.WordUsageData> wordUsageData in orderedWordsUsageData)
            {
                WordUsageDataPanel wordPanel = new WordUsageDataPanel();
                Label wordLabel = new Label();
                Label infoLable = new Label();

                wordPanel.BackColor   = Color.FromArgb(230, 230, 250);
                wordPanel.Size        = new Size(wordPanelWidth, 65);
                wordPanel.BorderStyle = BorderStyle.FixedSingle;
                wordPanel.Posts       = wordUsageData.Value.posts;

                wordLabel.Text = wordUsageData.Key;
                wordLabel.Font = new Font(wordLabel.Font, FontStyle.Bold);
                wordLabel.Top  = 5;
                wordLabel.Left = 15;
                wordPanel.Controls.Add(wordLabel);

                infoLable.Text   = string.Format("used {0} times{1}in {2} posts", wordUsageData.Value.occurrencesCount, Environment.NewLine, wordUsageData.Value.posts.Count);
                infoLable.Top    = 25;
                infoLable.Left   = 15;
                infoLable.Height = 30;
                wordPanel.Controls.Add(infoLable);
                wordUsageDataPanel.Controls.Add(wordPanel);

                wordPanel.Click += showPostsWithSelectedWord;
            }
        }
Ejemplo n.º 2
0
        private void showPostsWithSelectedWord(object sender, EventArgs e)
        {
            WordUsageDataPanel wordPanel = sender as WordUsageDataPanel;

            wordUsagePostsPanel.Controls.Clear();
            int postPanelWidth = wordUsagePostsPanel.ClientSize.Width - 25;

            foreach (string post in wordPanel.Posts)
            {
                Panel panel    = new Panel();
                Label postText = new Label();
                postText.Text        = post;
                postText.AutoSize    = true;
                postText.MaximumSize = new Size(postPanelWidth, int.MaxValue);

                panel.BackColor   = Color.FromArgb(230, 230, 250);
                panel.Size        = new Size(postPanelWidth, 65);
                panel.MaximumSize = new Size(postPanelWidth, int.MaxValue);
                panel.BorderStyle = BorderStyle.FixedSingle;
                panel.Controls.Add(postText);

                wordUsagePostsPanel.Controls.Add(panel);
            }
        }