This repository has been archived by the owner on Apr 13, 2024. It is now read-only.
/
MainPage.xaml.cs
60 lines (54 loc) · 1.95 KB
/
MainPage.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright (C) Microsoft Corporation. All Rights Reserved.
// This code released under the terms of the Microsoft Public License
// (Ms-PL, http://opensource.org/licenses/ms-pl.html).
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
namespace DataVisualizationOnWindowsPhone
{
public partial class MainPage : PhoneApplicationPage
{
public MainPage()
{
InitializeComponent();
}
protected override void OnOrientationChanged(OrientationChangedEventArgs e)
{
base.OnOrientationChanged(e);
// Set appropriate template for new orientation
ControlTemplate template;
switch (e.Orientation)
{
case PageOrientation.Portrait:
case PageOrientation.PortraitDown:
case PageOrientation.PortraitUp:
default:
template = Application.Current.Resources["PhoneChartPortraitTemplate"] as ControlTemplate;
break;
case PageOrientation.Landscape:
case PageOrientation.LandscapeLeft:
case PageOrientation.LandscapeRight:
template = Application.Current.Resources["PhoneChartLandscapeTemplate"] as ControlTemplate;
break;
}
myChart.Template = template;
}
}
// Class for storing information about an activity
public class ActivityInfo
{
public string Activity { get; set; }
public int Count { get; set; }
}
// Class for storing activities
public class Activities : List<ActivityInfo>
{
public Activities()
{
Add(new ActivityInfo { Activity = "SMS", Count = 30 });
Add(new ActivityInfo { Activity = "Email", Count = 20 });
Add(new ActivityInfo { Activity = "Calls", Count = 10 });
}
}
}