private void SetGraphTitle(IGraphWindowModel graphWindowModel)
        {
            string title;

            switch (graphWindowModel.SelectedGraphType)
            {
            case GraphType.AggregateHourOfDay:
                title = "Texts Per Hour of Day";
                break;

            case GraphType.AggregateDayOfWeek:
                title = "Texts Per Day of Week";
                break;

            case GraphType.PerMonth:
                title = "Texts by Month";
                break;

            default:
                throw new ArgumentException();
            }

            IConversation selectedConversation = graphWindowModel.SelectedConversation;

            if (selectedConversation != null)
            {
                string contactNames = FormatAssociatedContactNamesForGraph(selectedConversation);
                textGraph.Title = string.Format("{0} - {1}", title, contactNames);
            }
            else
            {
                textGraph.Title = title;
            }
        }
 private void PopulateGraph(IGraphWindowModel graphWindowModel)
 {
     if (graphWindowModel.CurrentGraphDataCollection != null)
     {
         messagesTotalSeries.ItemsSource = graphWindowModel.CurrentGraphDataCollection;
     }
 }
        private void UpdateModels()
        {
            _conversationWindowModel = new ConversationWindowModel(_displayOptions, _phoneSelectOptions);
            _conversationWindowModel.ConversationManager = _conversationManager;
            _conversationWindowModel.DeviceInfo          = _deviceInfo;

            _graphWindowModel = new GraphWindowModel(_displayOptions, _phoneSelectOptions);
            _graphWindowModel.ConversationManager = _conversationManager;
            _graphWindowModel.DeviceInfo          = _deviceInfo;

            SetApplicationView(_currentView);
        }
        private void FormatAxes(IGraphWindowModel graphWindowModel)
        {
            textGraphXAxis.Minimum      = null;
            textGraphXAxis.Maximum      = null;
            textGraphXAxis.IntervalType = DateTimeIntervalType.Auto;
            textGraphXAxis.Interval     = null;

            switch (graphWindowModel.SelectedGraphType)
            {
            case GraphType.AggregateDayOfWeek:
                TimeSpan dayPadding = TimeSpan.FromHours(12);
                textGraphXAxis.Minimum        = GraphDataGenerator.NormalizedSunday.Subtract(dayPadding);
                textGraphXAxis.Maximum        = GraphDataGenerator.NormalizedSunday.AddDays(7).Subtract(dayPadding);
                textGraphXAxis.IntervalType   = DateTimeIntervalType.Days;
                textGraphXAxis.Title          = "Day";
                textGraphXAxis.Interval       = 1.0;
                textGraphXAxis.AxisLabelStyle = (Style)textGraph.FindResource("AggregatePerDayOfWeekAxisStyle");
                break;

            case GraphType.AggregateHourOfDay:
                TimeSpan hourPadding = TimeSpan.FromMinutes(30);
                textGraphXAxis.Minimum        = GraphDataGenerator.NormalizedSunday.Subtract(hourPadding);
                textGraphXAxis.Maximum        = GraphDataGenerator.NormalizedSunday.AddDays(1).Subtract(hourPadding);
                textGraphXAxis.IntervalType   = DateTimeIntervalType.Hours;
                textGraphXAxis.Title          = "Hour";
                textGraphXAxis.Interval       = 1.0;
                textGraphXAxis.AxisLabelStyle = (Style)textGraph.FindResource("AggregatePerHourAxisStyle");
                break;

            case GraphType.PerMonth:
                DateTime minDate;
                DateTime maxDate;
                CalculateMonthAxisMinMax(graphWindowModel.CurrentGraphDataCollection, out minDate, out maxDate);
                textGraphXAxis.IntervalType   = DateTimeIntervalType.Months;
                textGraphXAxis.Title          = "Date";
                textGraphXAxis.Interval       = 1.0;
                textGraphXAxis.Minimum        = minDate;
                textGraphXAxis.Maximum        = maxDate;
                textGraphXAxis.AxisLabelStyle = (Style)textGraph.FindResource("PerMonthAxisStyle");
                break;

            default:
                throw new ArgumentException();
            }
        }
        private void UpdateModels()
        {
            _conversationWindowModel = new ConversationWindowModel(_displayOptions, _phoneSelectOptions);
            _conversationWindowModel.ConversationManager = _conversationManager;
            _conversationWindowModel.DeviceInfo = _deviceInfo;

            _graphWindowModel = new GraphWindowModel(_displayOptions, _phoneSelectOptions);
            _graphWindowModel.ConversationManager = _conversationManager;
            _graphWindowModel.DeviceInfo = _deviceInfo;

            SetApplicationView(_currentView);
        }
 public void UpdateToModel(IGraphWindowModel graphWindowModel)
 {
     SetGraphTitle(graphWindowModel);
     PopulateGraph(graphWindowModel);
     FormatAxes(graphWindowModel);
 }
        private void SetGraphTitle(IGraphWindowModel graphWindowModel)
        {
            string title;

            switch (graphWindowModel.SelectedGraphType)
            {
                case GraphType.AggregateHourOfDay:
                    title = "Texts Per Hour of Day";
                    break;
                case GraphType.AggregateDayOfWeek:
                    title = "Texts Per Day of Week";
                    break;
                case GraphType.PerMonth:
                    title = "Texts by Month";
                    break;
                default:
                    throw new ArgumentException();
            }

            IConversation selectedConversation = graphWindowModel.SelectedConversation;

            if (selectedConversation != null)
            {
                string contactNames = FormatAssociatedContactNamesForGraph(selectedConversation);
                textGraph.Title = string.Format("{0} - {1}", title, contactNames);
            }
            else
            {
                textGraph.Title = title;
            }
        }
 private void PopulateGraph(IGraphWindowModel graphWindowModel)
 {
     if (graphWindowModel.CurrentGraphDataCollection != null)
     {
         messagesTotalSeries.ItemsSource = graphWindowModel.CurrentGraphDataCollection;
     }
 }
        private void FormatAxes(IGraphWindowModel graphWindowModel)
        {
            textGraphXAxis.Minimum = null;
            textGraphXAxis.Maximum = null;
            textGraphXAxis.IntervalType = DateTimeIntervalType.Auto;
            textGraphXAxis.Interval = null;

            switch (graphWindowModel.SelectedGraphType)
            {
                case GraphType.AggregateDayOfWeek:
                    TimeSpan dayPadding = TimeSpan.FromHours(12);
                    textGraphXAxis.Minimum = GraphDataGenerator.NormalizedSunday.Subtract(dayPadding);
                    textGraphXAxis.Maximum = GraphDataGenerator.NormalizedSunday.AddDays(7).Subtract(dayPadding);
                    textGraphXAxis.IntervalType = DateTimeIntervalType.Days;
                    textGraphXAxis.Title = "Day";
                    textGraphXAxis.Interval = 1.0;
                    textGraphXAxis.AxisLabelStyle = (Style)textGraph.FindResource("AggregatePerDayOfWeekAxisStyle");
                    break;
                case GraphType.AggregateHourOfDay:
                    TimeSpan hourPadding = TimeSpan.FromMinutes(30);
                    textGraphXAxis.Minimum = GraphDataGenerator.NormalizedSunday.Subtract(hourPadding);
                    textGraphXAxis.Maximum = GraphDataGenerator.NormalizedSunday.AddDays(1).Subtract(hourPadding);
                    textGraphXAxis.IntervalType = DateTimeIntervalType.Hours;
                    textGraphXAxis.Title = "Hour";
                    textGraphXAxis.Interval = 1.0;
                    textGraphXAxis.AxisLabelStyle = (Style)textGraph.FindResource("AggregatePerHourAxisStyle");
                    break;
                case GraphType.PerMonth:
                    DateTime minDate;
                    DateTime maxDate;
                    CalculateMonthAxisMinMax(graphWindowModel.CurrentGraphDataCollection, out minDate, out maxDate);
                    textGraphXAxis.IntervalType = DateTimeIntervalType.Months;
                    textGraphXAxis.Title = "Date";
                    textGraphXAxis.Interval = 1.0;
                    textGraphXAxis.Minimum = minDate;
                    textGraphXAxis.Maximum = maxDate;
                    textGraphXAxis.AxisLabelStyle = (Style)textGraph.FindResource("PerMonthAxisStyle");
                    break;
                default:
                    throw new ArgumentException();
            }
        }
 public void UpdateToModel(IGraphWindowModel graphWindowModel)
 {
     SetGraphTitle(graphWindowModel);
     PopulateGraph(graphWindowModel);
     FormatAxes(graphWindowModel);
 }