コード例 #1
0
        private void OnGetClickStatsRPCCompleted(object sender, XMLRPCCompletedEventArgs <ClickDataPoint> args)
        {
            GetClickStatsRPC rpc = sender as GetClickStatsRPC;

            rpc.Completed -= OnGetClickStatsRPCCompleted;

            if (args.Cancelled)
            {
            }
            else if (null == args.Error)
            {
                HideStatControls();

                clicksGrid.Visibility = Visibility.Visible;

                ObservableObjectCollection dataSource = Resources["clickStatsDataSource"] as ObservableObjectCollection;
                dataSource.Clear();
                args.Items.ForEach(item => dataSource.Add(item));
            }
            else
            {
                this.HandleException(args.Error);
            }

            loadingStatsProgressBar.Opacity = 0.0;
        }
コード例 #2
0
        private void OnGetViewStatsRPCCompleted(object sender, XMLRPCCompletedEventArgs <ViewDataPoint> args)
        {
            //DEV NOTE: this link was really helpful getting things going:
            //http://silverlighthack.com/post/2010/10/08/Windows-Phone-7-RTM-Charting-using-the-Silverlight-Control-Toolkit.aspx

            GetViewStatsRPC rpc = sender as GetViewStatsRPC;

            rpc.Completed -= OnGetViewStatsRPCCompleted;

            if (args.Cancelled)
            {
            }
            else if (null == args.Error)
            {
                if (null == args.Items)
                {
                    return;
                }

                if (0 == args.Items.Count)
                {
                    MessageBox.Show(_localizedStrings.Messages.NoStatsAvailable);
                }
                else
                {
                    if (0 != viewsStatsChart.Series.Count)
                    {
                        HideStatControls();

                        viewsStatsScrollViewer.Visibility = Visibility.Visible;

                        ColumnSeries series = viewsStatsChart.Series[0] as ColumnSeries;

                        DateTimeAxis axis = series.IndependentAxis as DateTimeAxis;
                        axis.Interval     = ConvertStatisticPeriodToInterval();
                        axis.IntervalType = ConvertStatisticPeriodToIntervalType();
                    }

                    ObservableObjectCollection viewStatsDataSource = Resources["viewStatsDataSource"] as ObservableObjectCollection;
                    viewStatsDataSource.Clear();
                    args.Items.ForEach(item => viewStatsDataSource.Add(item));
                }
            }
            else
            {
                this.HandleException(args.Error);
            }

            loadingStatsProgressBar.Opacity = 0;
        }