Beispiel #1
0
        public void UseData(MainScreenComponentArgs args)
        {
            ucChart1.UseData(args);

            args.StatisticsType = StatisticsType.Urls;
            ucChart2.UseData(args);
        }
Beispiel #2
0
        private void GetMessages(MainScreenComponentArgs args)
        {
            if (args.Conversation == null)
                return;

            Cursor = Cursors.WaitCursor;

            ClearMessages();

            _messages = _manger.GetMessages(args.Conversation, args.DtFrom, args.DtTo).OrderByDescending(x => x.Date).ToList();

            FilterMessages(args);

            _dgv.DataSource = _filteredMessages;

            _dgv.Columns["Content"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            _dgv.Columns["Timestamp"].Visible = false;
            _dgv.Columns["ConversationId"].Visible = false;
            _dgv.Columns["Id"].Visible = false;
            _dgv.Columns["MessengerType"].Visible = false;
            _dgv.Columns["Username"].Visible = false;
            _dgv.Columns["Identity"].Visible = false;

            Cursor = Cursors.Default;
        }
Beispiel #3
0
        private void FilterMessages(MainScreenComponentArgs args)
        {
            _filteredMessages.Clear();

            foreach (var item in _messages)
            {
                if (args.FilterUrls)
                {
                    string url = Helper.GetUrl(item.Content);
                    if (!string.IsNullOrEmpty(url))
                    {
                        //we want to extract url from content, and show only url

                        _filteredMessages.Add(new ViewModels.Message()
                        {
                            Author = item.Author,
                            ConversationId = item.ConversationId,
                            Id = item.Id,
                            MessengerType = item.MessengerType,
                            Timestamp = item.Timestamp,
                            Username = item.Username,
                            Content = url
                        });
                    }
                }
                else
                    _filteredMessages.Add(item);
            }
        }
Beispiel #4
0
        public void UseData(MainScreenComponentArgs args)
        {
            var conversation = args.Conversation != null ? args.Conversation : new Conversation() { Id = -1};
            List<ConversationStatistics> statistics = _manager.GetStatistics(conversation, args.DtFrom, args.DtTo, args.StatisticsType);

            ChartInfo chartInfo = ChartInfo.Create(statistics, args);

            CreateChart(chartInfo);
        }
Beispiel #5
0
        internal static ChartInfo Create(List<ConversationStatistics> statistics, MainScreenComponentArgs args)
        {
            ChartInfo info = new ChartInfo();
            info.Title = string.Format("{0} [{1}]", args.Conversation.Title, args.StatisticsType);

            foreach (ConversationStatistics item in statistics)
            {
                ChartItem chartItem = new ChartItem(item.Identity);
                chartItem.Count = item.TotalMessages;
                info.Items.Add(chartItem);
            }

            return info;
        }
Beispiel #6
0
 public void UseData(MainScreenComponentArgs args)
 {
     GetMessages(args);
 }