Skip to content

Commit 3eaa7a2

Browse files
committed
Reading Xml in Windows Phone Example by dev nokia.
1 parent df57e68 commit 3eaa7a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1304
-0
lines changed

Employees/Employees.sln

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 11.00
3+
# Visual Studio 2010
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Employees", "Employees\Employees.csproj", "{BB0D06DE-F277-4965-8CC3-4E23B73A2704}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|Any CPU = Debug|Any CPU
9+
Release|Any CPU = Release|Any CPU
10+
EndGlobalSection
11+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
12+
{BB0D06DE-F277-4965-8CC3-4E23B73A2704}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
13+
{BB0D06DE-F277-4965-8CC3-4E23B73A2704}.Debug|Any CPU.Build.0 = Debug|Any CPU
14+
{BB0D06DE-F277-4965-8CC3-4E23B73A2704}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
15+
{BB0D06DE-F277-4965-8CC3-4E23B73A2704}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{BB0D06DE-F277-4965-8CC3-4E23B73A2704}.Release|Any CPU.Build.0 = Release|Any CPU
17+
{BB0D06DE-F277-4965-8CC3-4E23B73A2704}.Release|Any CPU.Deploy.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

Employees/Employees.suo

29 KB
Binary file not shown.

Employees/Employees.v11.suo

53.5 KB
Binary file not shown.

Employees/Employees/App.xaml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Application
2+
x:Class="Employees.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
6+
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
7+
8+
<!--Application Resources-->
9+
<Application.Resources>
10+
</Application.Resources>
11+
12+
<Application.ApplicationLifetimeObjects>
13+
<!--Required object that handles lifetime events for the application-->
14+
<shell:PhoneApplicationService
15+
Launching="Application_Launching" Closing="Application_Closing"
16+
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
17+
</Application.ApplicationLifetimeObjects>
18+
19+
</Application>

Employees/Employees/App.xaml.cs

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Net;
5+
using System.Windows;
6+
using System.Windows.Controls;
7+
using System.Windows.Documents;
8+
using System.Windows.Input;
9+
using System.Windows.Media;
10+
using System.Windows.Media.Animation;
11+
using System.Windows.Navigation;
12+
using System.Windows.Shapes;
13+
using Microsoft.Phone.Controls;
14+
using Microsoft.Phone.Shell;
15+
16+
namespace Employees
17+
{
18+
public partial class App : Application
19+
{
20+
// selected employee from EmployeeList
21+
public Employee selectedEmployee { get; set; }
22+
23+
/// <summary>
24+
/// Provides easy access to the root frame of the Phone Application.
25+
/// </summary>
26+
/// <returns>The root frame of the Phone Application.</returns>
27+
public PhoneApplicationFrame RootFrame { get; private set; }
28+
29+
/// <summary>
30+
/// Constructor for the Application object.
31+
/// </summary>
32+
public App()
33+
{
34+
// Global handler for uncaught exceptions.
35+
UnhandledException += Application_UnhandledException;
36+
37+
// Standard Silverlight initialization
38+
InitializeComponent();
39+
40+
// Phone-specific initialization
41+
InitializePhoneApplication();
42+
43+
// Show graphics profiling information while debugging.
44+
if (System.Diagnostics.Debugger.IsAttached)
45+
{
46+
// Display the current frame rate counters.
47+
Application.Current.Host.Settings.EnableFrameRateCounter = true;
48+
49+
// Show the areas of the app that are being redrawn in each frame.
50+
//Application.Current.Host.Settings.EnableRedrawRegions = true;
51+
52+
// Enable non-production analysis visualization mode,
53+
// which shows areas of a page that are handed off to GPU with a colored overlay.
54+
//Application.Current.Host.Settings.EnableCacheVisualization = true;
55+
56+
// Disable the application idle detection by setting the UserIdleDetectionMode property of the
57+
// application's PhoneApplicationService object to Disabled.
58+
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
59+
// and consume battery power when the user is not using the phone.
60+
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
61+
}
62+
63+
}
64+
65+
// Code to execute when the application is launching (eg, from Start)
66+
// This code will not execute when the application is reactivated
67+
private void Application_Launching(object sender, LaunchingEventArgs e)
68+
{
69+
}
70+
71+
// Code to execute when the application is activated (brought to foreground)
72+
// This code will not execute when the application is first launched
73+
private void Application_Activated(object sender, ActivatedEventArgs e)
74+
{
75+
}
76+
77+
// Code to execute when the application is deactivated (sent to background)
78+
// This code will not execute when the application is closing
79+
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
80+
{
81+
}
82+
83+
// Code to execute when the application is closing (eg, user hit Back)
84+
// This code will not execute when the application is deactivated
85+
private void Application_Closing(object sender, ClosingEventArgs e)
86+
{
87+
}
88+
89+
// Code to execute if a navigation fails
90+
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
91+
{
92+
if (System.Diagnostics.Debugger.IsAttached)
93+
{
94+
// A navigation has failed; break into the debugger
95+
System.Diagnostics.Debugger.Break();
96+
}
97+
}
98+
99+
// Code to execute on Unhandled Exceptions
100+
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
101+
{
102+
if (System.Diagnostics.Debugger.IsAttached)
103+
{
104+
// An unhandled exception has occurred; break into the debugger
105+
System.Diagnostics.Debugger.Break();
106+
}
107+
}
108+
109+
#region Phone application initialization
110+
111+
// Avoid double-initialization
112+
private bool phoneApplicationInitialized = false;
113+
114+
// Do not add any additional code to this method
115+
private void InitializePhoneApplication()
116+
{
117+
if (phoneApplicationInitialized)
118+
return;
119+
120+
// Create the frame but don't set it as RootVisual yet; this allows the splash
121+
// screen to remain active until the application is ready to render.
122+
RootFrame = new PhoneApplicationFrame();
123+
RootFrame.Navigated += CompleteInitializePhoneApplication;
124+
125+
// Handle navigation failures
126+
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
127+
128+
// Ensure we don't initialize again
129+
phoneApplicationInitialized = true;
130+
}
131+
132+
// Do not add any additional code to this method
133+
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
134+
{
135+
// Set the root visual to allow the application to render
136+
if (RootVisual != RootFrame)
137+
RootVisual = RootFrame;
138+
139+
// Remove this handler since it is no longer needed
140+
RootFrame.Navigated -= CompleteInitializePhoneApplication;
141+
}
142+
143+
#endregion
144+
}
145+
}
1.84 KB
Loading

Employees/Employees/Background.png

3.44 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" EntryPointAssembly="Employees" EntryPointType="Employees.App" RuntimeVersion="4.7.50308.0">
2+
<Deployment.Parts>
3+
<AssemblyPart x:Name="Employees" Source="Employees.dll" />
4+
<AssemblyPart x:Name="PhonePerformance" Source="PhonePerformance.dll" />
5+
</Deployment.Parts>
6+
</Deployment>
Loading
3.44 KB
Loading
38 KB
Binary file not shown.
35.5 KB
Binary file not shown.
32.3 KB
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.1">
4+
<App xmlns="" ProductID="{ed22a5fd-be79-42c6-bf6a-6dceeccfd343}" Title="Employees" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="Employees author" Description="Sample description" Publisher="Employees">
5+
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
6+
<Capabilities>
7+
<Capability Name="ID_CAP_GAMERSERVICES"/>
8+
<Capability Name="ID_CAP_IDENTITY_DEVICE"/>
9+
<Capability Name="ID_CAP_IDENTITY_USER"/>
10+
<Capability Name="ID_CAP_LOCATION"/>
11+
<Capability Name="ID_CAP_MEDIALIB"/>
12+
<Capability Name="ID_CAP_MICROPHONE"/>
13+
<Capability Name="ID_CAP_NETWORKING"/>
14+
<Capability Name="ID_CAP_PHONEDIALER"/>
15+
<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
16+
<Capability Name="ID_CAP_SENSORS"/>
17+
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
18+
<Capability Name="ID_CAP_ISV_CAMERA"/>
19+
<Capability Name="ID_CAP_CONTACTS"/>
20+
<Capability Name="ID_CAP_APPOINTMENTS"/>
21+
</Capabilities>
22+
<Tasks>
23+
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
24+
</Tasks>
25+
<Tokens>
26+
<PrimaryToken TokenID="EmployeesToken" TaskName="_default">
27+
<TemplateType5>
28+
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
29+
<Count>0</Count>
30+
<Title>Employees</Title>
31+
</TemplateType5>
32+
</PrimaryToken>
33+
</Tokens>
34+
</App>
35+
</Deployment>
36+
37+
<!-- WPSDK Version 7.1.8773.0 -->

Employees/Employees/Employee.cs

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Xml.Serialization;
3+
4+
namespace Employees
5+
{
6+
public class Employee
7+
{
8+
[XmlElement("firstName")]
9+
public string firstName { get; set; }
10+
11+
[XmlElement("lastName")]
12+
public string lastName { get; set; }
13+
14+
[XmlElement("title")]
15+
public string title { get; set; }
16+
17+
[XmlElement("phone")]
18+
public string phone { get; set; }
19+
20+
[XmlElement("email")]
21+
public string email { get; set; }
22+
23+
[XmlElement("room")]
24+
public string room { get; set; }
25+
26+
[XmlElement("picture")]
27+
public string picture { get; set; }
28+
29+
[XmlElement("info")]
30+
public string info { get; set; }
31+
}
32+
}

Employees/Employees/EmployeePage.xaml

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<phone:PhoneApplicationPage
2+
x:Class="Employees.EmployeePage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
6+
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
9+
FontFamily="{StaticResource PhoneFontFamilyNormal}"
10+
FontSize="{StaticResource PhoneFontSizeNormal}"
11+
Foreground="{StaticResource PhoneForegroundBrush}"
12+
SupportedOrientations="Portrait" Orientation="Portrait"
13+
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
14+
shell:SystemTray.IsVisible="True">
15+
16+
<!--LayoutRoot is the root grid where all page content is placed-->
17+
<Grid x:Name="LayoutRoot" Background="Transparent">
18+
<Grid.RowDefinitions>
19+
<RowDefinition Height="Auto"/>
20+
<RowDefinition Height="*"/>
21+
</Grid.RowDefinitions>
22+
23+
<!--TitlePanel contains the name of the application and page title-->
24+
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
25+
<TextBlock x:Name="ApplicationTitle" Text="My Company" Style="{StaticResource PhoneTextNormalStyle}"/>
26+
<TextBlock x:Name="PageTitle" Text="Employees" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
27+
</StackPanel>
28+
29+
<!--ContentPanel - place additional content here-->
30+
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
31+
32+
<Grid Height="130" VerticalAlignment="Top">
33+
<Grid.ColumnDefinitions>
34+
<ColumnDefinition Width="100"/>
35+
<ColumnDefinition Width="*"/>
36+
</Grid.ColumnDefinitions>
37+
<Image x:Name="image"
38+
Grid.Column="0"
39+
Width="97"
40+
Height="125"
41+
VerticalAlignment="Center"
42+
HorizontalAlignment="Center"
43+
Margin="6"/>
44+
<StackPanel Margin="10,15,0,0"
45+
Grid.Column="1"
46+
Height="60"
47+
Orientation="Horizontal"
48+
VerticalAlignment="Top">
49+
<TextBlock x:Name="lastName" FontSize="30" />
50+
<TextBlock Text=" " />
51+
<TextBlock x:Name="firstName" FontSize="30"/>
52+
</StackPanel>
53+
<StackPanel Margin="0,50,0,0"
54+
Grid.Column="1"
55+
VerticalAlignment="Center">
56+
<TextBlock Grid.Column="1"
57+
x:Name="title"
58+
Style='{StaticResource PhoneTextSubtleStyle}'
59+
/>
60+
<TextBlock Grid.Column="1"
61+
x:Name="room"
62+
Style='{StaticResource PhoneTextSubtleStyle}'
63+
/>
64+
</StackPanel>
65+
</Grid>
66+
<Grid Height="50" VerticalAlignment="Top" Margin="0,150"
67+
ManipulationStarted="phone_ManipulationStarted">
68+
<Grid.ColumnDefinitions>
69+
<ColumnDefinition Width="*"/>
70+
</Grid.ColumnDefinitions>
71+
<TextBlock x:Name="phone" VerticalAlignment="Center" FontSize="24"/>
72+
<Image Source="Images/call.png" HorizontalAlignment="Right"/>
73+
</Grid>
74+
75+
<Grid Height="50" VerticalAlignment="Top" Margin="0,210"
76+
ManipulationStarted="sms_ManipulationStarted">
77+
<Grid.ColumnDefinitions>
78+
<ColumnDefinition Width="*"/>
79+
</Grid.ColumnDefinitions>
80+
<TextBlock x:Name="sms" VerticalAlignment="Center" FontSize="24"/>
81+
<Image Source="Images/msg.png" HorizontalAlignment="Right"/>
82+
</Grid>
83+
84+
<Grid Height="50" VerticalAlignment="Top" Margin="0,270"
85+
ManipulationStarted="mail_ManipulationStarted">
86+
<Grid.ColumnDefinitions>
87+
<ColumnDefinition Width="*"/>
88+
</Grid.ColumnDefinitions>
89+
<TextBlock x:Name="mail" VerticalAlignment="Center" FontSize="24"/>
90+
<Image Source="Images/mail.png" HorizontalAlignment="Right"/>
91+
</Grid>
92+
93+
<TextBlock x:Name="info" TextWrapping="Wrap"
94+
FontSize="16" FontStyle="Italic"
95+
VerticalAlignment="Bottom"
96+
Margin="20,20,20,20"/>
97+
98+
</Grid>
99+
</Grid>
100+
101+
<!--Sample code showing usage of ApplicationBar-->
102+
<!--<phone:PhoneApplicationPage.ApplicationBar>
103+
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
104+
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
105+
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
106+
<shell:ApplicationBar.MenuItems>
107+
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
108+
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
109+
</shell:ApplicationBar.MenuItems>
110+
</shell:ApplicationBar>
111+
</phone:PhoneApplicationPage.ApplicationBar>-->
112+
113+
</phone:PhoneApplicationPage>

0 commit comments

Comments
 (0)