map improvement
user picture image crop
@@ -0,0 +1,38 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkAwarenessTest", "NetworkAwarenessTest\NetworkAwarenessTest.csproj", "{27C10B97-20D1-46F7-92BF-FC07037F900E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkDetection", "NetworkDetection\NetworkDetection.csproj", "{794D79F0-E898-460D-BDB5-49FED553E0D5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NetworkNamespaces", "NetworkNamespaces\NetworkNamespaces.csproj", "{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{27C10B97-20D1-46F7-92BF-FC07037F900E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{27C10B97-20D1-46F7-92BF-FC07037F900E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{27C10B97-20D1-46F7-92BF-FC07037F900E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{27C10B97-20D1-46F7-92BF-FC07037F900E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{27C10B97-20D1-46F7-92BF-FC07037F900E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{27C10B97-20D1-46F7-92BF-FC07037F900E}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{794D79F0-E898-460D-BDB5-49FED553E0D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{794D79F0-E898-460D-BDB5-49FED553E0D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{794D79F0-E898-460D-BDB5-49FED553E0D5}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{794D79F0-E898-460D-BDB5-49FED553E0D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{794D79F0-E898-460D-BDB5-49FED553E0D5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{794D79F0-E898-460D-BDB5-49FED553E0D5}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,19 @@
|
||||
<Application
|
||||
x:Class="NetworkAwarenessTest.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
|
||||
|
||||
<!--Application Resources-->
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
|
||||
<Application.ApplicationLifetimeObjects>
|
||||
<!--Required object that handles lifetime events for the application-->
|
||||
<shell:PhoneApplicationService
|
||||
Launching="Application_Launching" Closing="Application_Closing"
|
||||
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
|
||||
</Application.ApplicationLifetimeObjects>
|
||||
|
||||
</Application>
|
||||
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace NetworkAwarenessTest
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides easy access to the root frame of the Phone Application.
|
||||
/// </summary>
|
||||
/// <returns>The root frame of the Phone Application.</returns>
|
||||
public PhoneApplicationFrame RootFrame { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for the Application object.
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
// Global handler for uncaught exceptions.
|
||||
UnhandledException += Application_UnhandledException;
|
||||
|
||||
// Show graphics profiling information while debugging.
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// Display the current frame rate counters.
|
||||
Application.Current.Host.Settings.EnableFrameRateCounter = true;
|
||||
|
||||
// Show the areas of the app that are being redrawn in each frame.
|
||||
//Application.Current.Host.Settings.EnableRedrawRegions = true;
|
||||
|
||||
// Enable non-production analysis visualization mode,
|
||||
// which shows areas of a page that are being GPU accelerated with a colored overlay.
|
||||
//Application.Current.Host.Settings.EnableCacheVisualization = true;
|
||||
}
|
||||
|
||||
// Standard Silverlight initialization
|
||||
InitializeComponent();
|
||||
|
||||
// Phone-specific initialization
|
||||
InitializePhoneApplication();
|
||||
}
|
||||
|
||||
|
||||
// Code to execute when the application is launching (eg, from Start)
|
||||
// This code will not execute when the application is reactivated
|
||||
private void Application_Launching(object sender, LaunchingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is activated (brought to foreground)
|
||||
// This code will not execute when the application is first launched
|
||||
private void Application_Activated(object sender, ActivatedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is deactivated (sent to background)
|
||||
// This code will not execute when the application is closing
|
||||
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is closing (eg, user hit Back)
|
||||
// This code will not execute when the application is deactivated
|
||||
private void Application_Closing(object sender, ClosingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute if a navigation fails
|
||||
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// A navigation has failed; break into the debugger
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
// Code to execute on Unhandled Exceptions
|
||||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// An unhandled exception has occurred; break into the debugger
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
#region Phone application initialization
|
||||
|
||||
// Avoid double-initialization
|
||||
private bool phoneApplicationInitialized = false;
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void InitializePhoneApplication()
|
||||
{
|
||||
if (phoneApplicationInitialized)
|
||||
return;
|
||||
|
||||
// Create the frame but don't set it as RootVisual yet; this allows the splash
|
||||
// screen to remain active until the application is ready to render.
|
||||
RootFrame = new PhoneApplicationFrame();
|
||||
RootFrame.Navigated += CompleteInitializePhoneApplication;
|
||||
|
||||
// Handle navigation failures
|
||||
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
|
||||
|
||||
// Ensure we don't initialize again
|
||||
phoneApplicationInitialized = true;
|
||||
}
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
|
||||
{
|
||||
// Set the root visual to allow the application to render
|
||||
if (RootVisual != RootFrame)
|
||||
RootVisual = RootFrame;
|
||||
|
||||
// Remove this handler since it is no longer needed
|
||||
RootFrame.Navigated -= CompleteInitializePhoneApplication;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,50 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="NetworkAwarenessTest.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot is the root grid where all page content is placed-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel contains the name of the application and page title-->
|
||||
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock x:Name="ApplicationTitle" Text="NETWORK AWARENESS AND ZUNE DETECTION" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - place additional content here-->
|
||||
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<ListBox Height="556" HorizontalAlignment="Left" Margin="6,134,0,0" Name="listBox1" VerticalAlignment="Top" Width="444" />
|
||||
<Button Content="Refresh" Height="72" HorizontalAlignment="Left" Name="buttonRefresh" VerticalAlignment="Top" Width="220" Click="buttonRefresh_Click" />
|
||||
<TextBlock Height="30" HorizontalAlignment="Left" Margin="6,78,0,0" Name="textBlock1" Text="UI Responsiveness Progressbar" VerticalAlignment="Top" />
|
||||
<Button Content="Add Time" Height="72" HorizontalAlignment="Left" Margin="226,0,0,0" Name="buttonTime" VerticalAlignment="Top" Width="230" Click="buttonTime_Click" />
|
||||
</Grid>
|
||||
<ProgressBar IsIndeterminate="True" Height="27" HorizontalAlignment="Left" Margin="18,101,0,0" Name="progressBar1" VerticalAlignment="Top" Width="444" Grid.Row="1" />
|
||||
</Grid>
|
||||
|
||||
<!--Sample code showing usage of ApplicationBar-->
|
||||
<!--<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
|
||||
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
|
||||
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
|
||||
<shell:ApplicationBar.MenuItems>
|
||||
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
|
||||
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
|
||||
</shell:ApplicationBar.MenuItems>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>-->
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
namespace NetworkAwarenessTest
|
||||
{
|
||||
public partial class MainPage : PhoneApplicationPage
|
||||
{
|
||||
string NetType = "";
|
||||
bool online = false;
|
||||
|
||||
|
||||
|
||||
// Constructor
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += new RoutedEventHandler(MainPage_Loaded);
|
||||
Unloaded += new RoutedEventHandler(MainPage_Unloaded);
|
||||
}
|
||||
|
||||
void MainPage_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged -= new System.Net.NetworkInformation.NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
|
||||
}
|
||||
|
||||
void MainPage_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, ">>> Refresh Started " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType net = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType;
|
||||
NetType = net.ToString();
|
||||
listBox1.Items.Insert(1," Refresh Ended " + System.DateTime.Now.ToString("T"));
|
||||
listBox1.Items.Insert(2, " stored at Changed event: " + NetType);
|
||||
listBox1.Items.Insert(3, " Current status: " + net.ToString());
|
||||
if (net == Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ethernet) listBox1.Items.Insert(4, "!!!!! Zune is Connected");
|
||||
SetupNetworkChange();
|
||||
}
|
||||
|
||||
void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "+++++ Changed started " + System.DateTime.Now.ToString("T") + " +++++");
|
||||
if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
|
||||
{
|
||||
if (!online)
|
||||
{
|
||||
online = true;
|
||||
// do what is needed to GoOnline();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (online)
|
||||
{
|
||||
online = false;
|
||||
listBox1.Items.Insert(0, "----- No network available. -----");
|
||||
// do what is needed to GoOffline();
|
||||
}
|
||||
}
|
||||
listBox1.Items.Insert(1, " Changed GetNetType " + System.DateTime.Now.ToString("T"));
|
||||
Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType net = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType;
|
||||
NetType = net.ToString();
|
||||
listBox1.Items.Insert(2, " Changed Ended " + System.DateTime.Now.ToString("T"));
|
||||
listBox1.Items.Insert(3, " IsOnline : " + online.ToString());
|
||||
listBox1.Items.Insert(4, " Current status: " + net.ToString());
|
||||
if (net == Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ethernet) listBox1.Items.Insert(5,"!!!!! Zune is Connected");
|
||||
}
|
||||
|
||||
private void SetupNetworkChange()
|
||||
{
|
||||
// Get current network availalability and store the
|
||||
// initial value of the online variable
|
||||
if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
|
||||
{
|
||||
online = true;
|
||||
// do what is needed to GoOnline();
|
||||
}
|
||||
else
|
||||
{
|
||||
online = false;
|
||||
// do what is needed to GoOffline();
|
||||
}
|
||||
|
||||
// Now add a network change event handler to indicate
|
||||
// network availability
|
||||
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += new System.Net.NetworkInformation.NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, ">>> Refresh Started " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType net = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType;
|
||||
//MessageBox.Show("Current status: "+net.ToString(), "stored nettype:" + App.NetType, MessageBoxButton.OK);
|
||||
listBox1.Items.Insert(1, " Refresh Ended " + System.DateTime.Now.ToString("T"));
|
||||
listBox1.Items.Insert(2," stored at Changed event: " + NetType);
|
||||
listBox1.Items.Insert(3, " Current status: " + net.ToString());
|
||||
}
|
||||
|
||||
private void buttonTime_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "<<<<< Current Time " + System.DateTime.Now.ToString("T") + " <<<<<<<<<");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.20506</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{27C10B97-20D1-46F7-92BF-FC07037F900E}</ProjectGuid>
|
||||
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NetworkAwarenessTest</RootNamespace>
|
||||
<AssemblyName>NetworkAwarenessTest</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
|
||||
<TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
|
||||
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
|
||||
<SilverlightApplication>true</SilverlightApplication>
|
||||
<SupportedCultures>
|
||||
</SupportedCultures>
|
||||
<XapOutputs>true</XapOutputs>
|
||||
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
|
||||
<XapFilename>NetworkAwarenessTest.xap</XapFilename>
|
||||
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
|
||||
<SilverlightAppEntry>NetworkAwarenessTest.App</SilverlightAppEntry>
|
||||
<ValidateXaml>true</ValidateXaml>
|
||||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Phone" />
|
||||
<Reference Include="Microsoft.Phone.Interop" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="system" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
<None Include="Properties\WMAppManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ApplicationIcon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Background.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="SplashScreenImage.jpg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions />
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Deployment.Parts>
|
||||
</Deployment.Parts>
|
||||
</Deployment>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NetworkAwarenessTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("NetworkAwarenessTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("59705a9b-da65-482a-8c30-552b5622a972")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.0">
|
||||
<App xmlns="" ProductID="{357f9fb2-82b9-4758-a63a-af9dcda19dc0}" Title="NetworkAwarenessTest" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="NetworkAwarenessTest author" Description="Sample description" Publisher="NetworkAwarenessTest">
|
||||
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
|
||||
<Capabilities>
|
||||
<Capability Name="ID_CAP_GAMERSERVICES"/>
|
||||
<Capability Name="ID_CAP_IDENTITY_DEVICE"/>
|
||||
<Capability Name="ID_CAP_IDENTITY_USER"/>
|
||||
<Capability Name="ID_CAP_LOCATION"/>
|
||||
<Capability Name="ID_CAP_MEDIALIB"/>
|
||||
<Capability Name="ID_CAP_MICROPHONE"/>
|
||||
<Capability Name="ID_CAP_NETWORKING"/>
|
||||
<Capability Name="ID_CAP_PHONEDIALER"/>
|
||||
<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
|
||||
<Capability Name="ID_CAP_SENSORS"/>
|
||||
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="NetworkAwarenessTestToken" TaskName="_default">
|
||||
<TemplateType5>
|
||||
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
|
||||
<Count>0</Count>
|
||||
<Title>NetworkAwarenessTest</Title>
|
||||
</TemplateType5>
|
||||
</PrimaryToken>
|
||||
</Tokens>
|
||||
</App>
|
||||
</Deployment>
|
||||
|
After Width: | Height: | Size: 9.2 KiB |
@@ -0,0 +1,19 @@
|
||||
<Application
|
||||
x:Class="NetworkDetection.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
|
||||
|
||||
<!--Application Resources-->
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
|
||||
<Application.ApplicationLifetimeObjects>
|
||||
<!--Required object that handles lifetime events for the application-->
|
||||
<shell:PhoneApplicationService
|
||||
Launching="Application_Launching" Closing="Application_Closing"
|
||||
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
|
||||
</Application.ApplicationLifetimeObjects>
|
||||
|
||||
</Application>
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace NetworkDetection
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides easy access to the root frame of the Phone Application.
|
||||
/// </summary>
|
||||
/// <returns>The root frame of the Phone Application.</returns>
|
||||
public PhoneApplicationFrame RootFrame { get; private set; }
|
||||
//NetworkDetector nd;
|
||||
/// <summary>
|
||||
/// Constructor for the Application object.
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
// Global handler for uncaught exceptions.
|
||||
UnhandledException += Application_UnhandledException;
|
||||
|
||||
// Show graphics profiling information while debugging.
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// Display the current frame rate counters.
|
||||
Application.Current.Host.Settings.EnableFrameRateCounter = true;
|
||||
|
||||
// Show the areas of the app that are being redrawn in each frame.
|
||||
//Application.Current.Host.Settings.EnableRedrawRegions = true;
|
||||
|
||||
// Enable non-production analysis visualization mode,
|
||||
// which shows areas of a page that are being GPU accelerated with a colored overlay.
|
||||
//Application.Current.Host.Settings.EnableCacheVisualization = true;
|
||||
}
|
||||
|
||||
// Standard Silverlight initialization
|
||||
InitializeComponent();
|
||||
|
||||
// Phone-specific initialization
|
||||
InitializePhoneApplication();
|
||||
|
||||
}
|
||||
|
||||
NetworkDetector nd;
|
||||
// Code to execute when the application is launching (eg, from Start)
|
||||
// This code will not execute when the application is reactivated
|
||||
private void Application_Launching(object sender, LaunchingEventArgs e)
|
||||
{
|
||||
nd = NetworkDetector.Instance;
|
||||
}
|
||||
|
||||
// Code to execute when the application is activated (brought to foreground)
|
||||
// This code will not execute when the application is first launched
|
||||
private void Application_Activated(object sender, ActivatedEventArgs e)
|
||||
{
|
||||
nd = NetworkDetector.Instance;
|
||||
}
|
||||
|
||||
// Code to execute when the application is deactivated (sent to background)
|
||||
// This code will not execute when the application is closing
|
||||
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is closing (eg, user hit Back)
|
||||
// This code will not execute when the application is deactivated
|
||||
private void Application_Closing(object sender, ClosingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute if a navigation fails
|
||||
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// A navigation has failed; break into the debugger
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
// Code to execute on Unhandled Exceptions
|
||||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// An unhandled exception has occurred; break into the debugger
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
#region Phone application initialization
|
||||
|
||||
// Avoid double-initialization
|
||||
private bool phoneApplicationInitialized = false;
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void InitializePhoneApplication()
|
||||
{
|
||||
if (phoneApplicationInitialized)
|
||||
return;
|
||||
|
||||
// Create the frame but don't set it as RootVisual yet; this allows the splash
|
||||
// screen to remain active until the application is ready to render.
|
||||
RootFrame = new PhoneApplicationFrame();
|
||||
RootFrame.Navigated += CompleteInitializePhoneApplication;
|
||||
|
||||
// Handle navigation failures
|
||||
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
|
||||
|
||||
// Ensure we don't initialize again
|
||||
phoneApplicationInitialized = true;
|
||||
}
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
|
||||
{
|
||||
// Set the root visual to allow the application to render
|
||||
if (RootVisual != RootFrame)
|
||||
RootVisual = RootFrame;
|
||||
|
||||
// Remove this handler since it is no longer needed
|
||||
RootFrame.Navigated -= CompleteInitializePhoneApplication;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,56 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="NetworkDetection.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot is the root grid where all page content is placed-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="44"/>
|
||||
<RowDefinition Height="724*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel contains the name of the application and page title-->
|
||||
<StackPanel x:Name="TitlePanel" Margin="12,17,0,0">
|
||||
<TextBlock x:Name="ApplicationTitle" Text="NETWORK AWARENESS AND ZUNE DETECTION" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - place additional content here-->
|
||||
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<ListBox Height="532" HorizontalAlignment="Left" Margin="6,186,0,0" Name="listBox1" VerticalAlignment="Top" Width="444" />
|
||||
<Button Content="DF" Height="72" HorizontalAlignment="Left" Name="buttonMode" VerticalAlignment="Top" Width="102" Margin="290,64,0,0" Click="buttonMode_Click" />
|
||||
<TextBlock Height="30" HorizontalAlignment="Left" Margin="6,130,0,0" Name="textBlock1" Text="UI Responsiveness Progressbar" VerticalAlignment="Top" />
|
||||
<Button Content="T" Height="72" HorizontalAlignment="Left" Margin="374,0,0,0" Name="buttonTime" VerticalAlignment="Top" Width="82" Click="buttonTime_Click" />
|
||||
<Button Content="Stop Poll" Height="72" HorizontalAlignment="Left" Margin="142,0,0,0" Name="buttonStoppPoll" VerticalAlignment="Top" Width="163" Click="buttonStoppPoll_Click" />
|
||||
<Button Content="Start Poll" Height="72" HorizontalAlignment="Left" Name="buttonStartPoll" VerticalAlignment="Top" Width="161" Click="buttonStartPoll_Click" />
|
||||
<Button Content="Clr" Height="72" HorizontalAlignment="Left" Margin="290,0,0,0" Name="buttonClear" VerticalAlignment="Top" Width="102" Click="buttonClear_Click" />
|
||||
<Button Content="+ 100 mS" Height="72" HorizontalAlignment="Left" Margin="0,64,0,0" Name="buttonIncrease" VerticalAlignment="Top" Width="161" Click="buttonIncrease_Click" />
|
||||
<Button Content="- 100 mS" Height="72" HorizontalAlignment="Left" Margin="142,64,0,0" Name="buttonDecrease" VerticalAlignment="Top" Width="163" Click="buttonDecrease_Click" />
|
||||
<ProgressBar IsIndeterminate="True" Height="27" HorizontalAlignment="Left" Margin="6,153,0,0" Name="progressBar1" VerticalAlignment="Top" Width="444" />
|
||||
<Button Content="R" Height="72" HorizontalAlignment="Left" Margin="374,64,0,0" Name="buttonRefresh" VerticalAlignment="Top" Width="81" Click="buttonRefresh_Click" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!--Sample code showing usage of ApplicationBar-->
|
||||
<!--<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
|
||||
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
|
||||
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
|
||||
<shell:ApplicationBar.MenuItems>
|
||||
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
|
||||
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
|
||||
</shell:ApplicationBar.MenuItems>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>-->
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,165 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
namespace NetworkDetection
|
||||
{
|
||||
public partial class MainPage : PhoneApplicationPage
|
||||
{
|
||||
// Constructor
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += new RoutedEventHandler(MainPage_Loaded);
|
||||
}
|
||||
|
||||
NetworkDetector nd = NetworkDetector.Instance;
|
||||
int interval = 500;
|
||||
|
||||
void MainPage_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
nd.OnAsyncGetNetworkTypeCompleted += new EventHandler<NetworkDetectorEventArgs>(nd_OnAsyncGetNetworkTypeCompleted);
|
||||
nd.OnConnectedBroadbandCdma += new EventHandler<NetworkDetectorEventArgs>(nd_OnConnectedBroadbandCdma);
|
||||
nd.OnConnectedBroadbandGsm += new EventHandler<NetworkDetectorEventArgs>(nd_OnConnectedBroadbandGsm);
|
||||
nd.OnConnectedEthernet += new EventHandler<NetworkDetectorEventArgs>(nd_OnConnectedEthernet);
|
||||
nd.OnConnectedNone += new EventHandler<NetworkDetectorEventArgs>(nd_OnConnectedNone);
|
||||
nd.OnConnectedOther += new EventHandler<NetworkDetectorEventArgs>(nd_OnConnectedOther);
|
||||
nd.OnConnectedWifi += new EventHandler<NetworkDetectorEventArgs>(nd_OnConnectedWifi);
|
||||
nd.OnNetworkChanged += new EventHandler<NetworkAvailableEventArgs>(nd_OnNetworkChanged);
|
||||
nd.OnNetworkOFF += new EventHandler<NetworkAvailableEventArgs>(nd_OnNetworkOFF);
|
||||
nd.OnNetworkON += new EventHandler<NetworkAvailableEventArgs>(nd_OnNetworkON);
|
||||
nd.OnZuneConnected += new EventHandler<NetworkDetectorEventArgs>(nd_OnZuneConnected);
|
||||
nd.OnZuneDisconnected += new EventHandler<NetworkDetectorEventArgs>(nd_OnZuneDisconnected);
|
||||
nd.OnLostNetworkType += new EventHandler<NetworkDetectorEventArgs>(nd_OnLostNetworkType);
|
||||
|
||||
nd.SetNetworkPolling(0,0,interval);
|
||||
}
|
||||
|
||||
void nd_OnLostNetworkType(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnLostNetworkType ->previous Nettype:" + e.NetType.ToString());
|
||||
}
|
||||
|
||||
void nd_OnZuneDisconnected(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnZuneDisconnected ->Nettype:" + e.NetType.ToString());
|
||||
}
|
||||
|
||||
void nd_OnZuneConnected(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnZuneConnected ->Nettype:" + e.NetType.ToString());
|
||||
}
|
||||
|
||||
void nd_OnNetworkON(object sender, NetworkAvailableEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnNetworkON ->Online:" + e.IsOnline.ToString());
|
||||
}
|
||||
|
||||
void nd_OnNetworkOFF(object sender, NetworkAvailableEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnNetworkOFF ->Online:" + e.IsOnline.ToString());
|
||||
}
|
||||
|
||||
void nd_OnNetworkChanged(object sender, NetworkAvailableEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnNetworkChanged ->Online:" + e.IsOnline.ToString());
|
||||
}
|
||||
|
||||
void nd_OnConnectedWifi(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnConnectedWifi " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
}
|
||||
|
||||
void nd_OnConnectedOther(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnConnectedOther " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
}
|
||||
|
||||
void nd_OnConnectedNone(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnConnectedNone " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
}
|
||||
|
||||
void nd_OnConnectedEthernet(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnConnectedEthernet " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
}
|
||||
|
||||
void nd_OnConnectedBroadbandGsm(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnConnectedBroadbandGsm " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
}
|
||||
|
||||
void nd_OnConnectedBroadbandCdma(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnConnectedBroadbandCdma " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
}
|
||||
|
||||
void nd_OnAsyncGetNetworkTypeCompleted(object sender, NetworkDetectorEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "OnAsyncGetNetworkTypeCompleted " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
}
|
||||
|
||||
private void buttonMode_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
nd.DetailedMode = !nd.DetailedMode;
|
||||
if (nd.DetailedMode) buttonMode.Content = "DT";
|
||||
else buttonMode.Content = "DF";
|
||||
listBox1.Items.Insert(0, " DetailedMode : " + nd.DetailedMode.ToString() + " <<<<<<<<<");
|
||||
}
|
||||
|
||||
private void buttonTime_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, "<<<<< Current Time " + System.DateTime.Now.ToString("T") + " <<<<<<<<<");
|
||||
}
|
||||
|
||||
private void buttonStoppPoll_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
nd.DisableNetworkPolling();
|
||||
}
|
||||
|
||||
private void buttonStartPoll_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
nd.SetNetworkPolling(0, 0, interval);
|
||||
}
|
||||
|
||||
private void buttonIncrease_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
interval += 100;
|
||||
//if (interval > 1000) interval = 1000;
|
||||
nd.SetNetworkPolling(0, 0, interval);
|
||||
listBox1.Items.Insert(0, " Current polling Time " + interval.ToString() + " <<<<<<<<<");
|
||||
}
|
||||
|
||||
private void buttonClear_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBox1.Items.Clear();
|
||||
}
|
||||
|
||||
private void buttonDecrease_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
interval -= 100;
|
||||
if (interval < 100) interval = 100;
|
||||
nd.SetNetworkPolling(0, 0, interval);
|
||||
listBox1.Items.Insert(0, " Current polling Time " + interval.ToString() + " <<<<<<<<<");
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBox1.Items.Insert(0, ">>> Refresh Started " + System.DateTime.Now.ToString("T") + " >>>>>>>>");
|
||||
listBox1.Items.Insert(1, " Current status: " + nd.GetCurrentNetworkType().ToString());
|
||||
nd.AsyncGetNetworkType();
|
||||
listBox1.Items.Insert(2, " Refresh Ended " + System.DateTime.Now.ToString("T"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.20506</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{794D79F0-E898-460D-BDB5-49FED553E0D5}</ProjectGuid>
|
||||
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NetworkDetection</RootNamespace>
|
||||
<AssemblyName>NetworkDetection</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
|
||||
<TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
|
||||
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
|
||||
<SilverlightApplication>true</SilverlightApplication>
|
||||
<SupportedCultures>
|
||||
</SupportedCultures>
|
||||
<XapOutputs>true</XapOutputs>
|
||||
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
|
||||
<XapFilename>NetworkDetection.xap</XapFilename>
|
||||
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
|
||||
<SilverlightAppEntry>NetworkDetection.App</SilverlightAppEntry>
|
||||
<ValidateXaml>true</ValidateXaml>
|
||||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Phone" />
|
||||
<Reference Include="Microsoft.Phone.Interop" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="system" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NetworkDetector.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
<None Include="Properties\WMAppManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ApplicationIcon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Background.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="SplashScreenImage.jpg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions />
|
||||
</Project>
|
||||
@@ -0,0 +1,387 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Ink;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
||||
|
||||
|
||||
/**********************************************/
|
||||
/* Copyright of Gabor Dolhai @ 2010 */
|
||||
/* under MS-Pl license */
|
||||
/* can be used freely for anybody */
|
||||
/* If you use this code please send me an */
|
||||
/*email about your project to dolhaig at gmail*/
|
||||
/*******************Thanks*********************/
|
||||
namespace NetworkDetection
|
||||
{
|
||||
#region Custom Enums and EventArgs
|
||||
public enum NetworkTypeRequestStatus
|
||||
{
|
||||
Default = 0,
|
||||
Started,//represents BackgroundWorker started
|
||||
Ended//BackgroundWorker Finished
|
||||
}
|
||||
|
||||
public class NetworkAvailableEventArgs : System.EventArgs
|
||||
{
|
||||
|
||||
public NetworkAvailableEventArgs(bool isOnline)
|
||||
{
|
||||
IsOnline = isOnline;
|
||||
}
|
||||
|
||||
public bool IsOnline { get; private set; }
|
||||
}
|
||||
|
||||
public class NetworkDetectorEventArgs : System.EventArgs
|
||||
{
|
||||
|
||||
public NetworkDetectorEventArgs(bool isOnline, Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType netType)
|
||||
{
|
||||
IsOnline = isOnline;
|
||||
NetType = netType;
|
||||
}
|
||||
|
||||
public bool IsOnline { get; private set; }
|
||||
public Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType NetType { get; private set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public class NetworkDetector
|
||||
{
|
||||
private static readonly NetworkDetector _instance = new NetworkDetector();
|
||||
|
||||
#region Events
|
||||
public event EventHandler<NetworkAvailableEventArgs> OnNetworkON;
|
||||
public event EventHandler<NetworkAvailableEventArgs> OnNetworkOFF;
|
||||
public event EventHandler<NetworkAvailableEventArgs> OnNetworkChanged;
|
||||
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnZuneConnected;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnZuneDisconnected;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnConnectedEthernet;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnConnectedWifi;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnConnectedNone;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnConnectedBroadbandGsm;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnConnectedBroadbandCdma;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnConnectedOther;
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnLostNetworkType;
|
||||
|
||||
public event EventHandler<NetworkDetectorEventArgs> OnAsyncGetNetworkTypeCompleted;
|
||||
#endregion
|
||||
|
||||
private System.Windows.Threading.DispatcherTimer updateTimer, pollTimer;
|
||||
private Queue<long> requestQueue; //queue to store the requests timestemps
|
||||
private BackgroundWorker networkWorker;
|
||||
private bool online = false;
|
||||
private Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType net;
|
||||
private NetworkTypeRequestStatus requestStatus; //current status of the BackgroundWorker
|
||||
private bool IsInstantRequestPresent;
|
||||
private bool detailedMode;
|
||||
private bool isZuneConnected;
|
||||
|
||||
private NetworkDetector()
|
||||
{
|
||||
requestQueue = new Queue<long>();
|
||||
requestQueue.Clear();
|
||||
requestStatus = NetworkTypeRequestStatus.Default;
|
||||
updateTimer = new System.Windows.Threading.DispatcherTimer();
|
||||
updateTimer.Tick += new EventHandler(updateTimer_Tick);
|
||||
updateTimer.Interval = new TimeSpan(0, 0, 0, 0, 300);//there is no need to restart the BGWorker sooner then 300 millisec because the ~3request/sec requestlimit
|
||||
//updateTimer.Start();
|
||||
pollTimer = new System.Windows.Threading.DispatcherTimer();
|
||||
pollTimer.Tick += new EventHandler(pollTimer_Tick);
|
||||
networkWorker = new BackgroundWorker();
|
||||
networkWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(networkWorker_RunWorkerCompleted);
|
||||
networkWorker.DoWork += new DoWorkEventHandler(networkWorker_DoWork);
|
||||
IsInstantRequestPresent = false;
|
||||
detailedMode = false; //by default I hide the framework events for better Developer experience
|
||||
isZuneConnected = false;
|
||||
|
||||
SetupNetworkChange(); //signing on the framework event
|
||||
}
|
||||
|
||||
public static NetworkDetector Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
#region BackgroundWorker
|
||||
void networkWorker_DoWork(object sender, DoWorkEventArgs e)
|
||||
{
|
||||
Debug.WriteLine(">>>>> GetNetType started " + System.DateTime.Now.ToString("T") + " >>>>>");
|
||||
e.Result = Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType;
|
||||
}
|
||||
//no need to lock the variables if We do everithing in the completed event handler
|
||||
|
||||
void networkWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
|
||||
{
|
||||
DetectOnlineStatus();
|
||||
if ((detailedMode) || (net != (Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType)e.Result))
|
||||
{
|
||||
//there is no need to get events all the time, just when really changing something or the DetailedMode is true
|
||||
if (net != (Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType)e.Result)
|
||||
RaiseNotify(OnLostNetworkType, new NetworkDetectorEventArgs(online, net));
|
||||
net = (Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType)e.Result;
|
||||
Debug.WriteLine(" New NetType: " + net.ToString());
|
||||
if (net == Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ethernet) Debug.WriteLine("!!!!! Zune is Connected");
|
||||
switch (net)
|
||||
{
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ethernet:
|
||||
if (!isZuneConnected)
|
||||
{
|
||||
isZuneConnected = true;
|
||||
RaiseNotify(OnZuneConnected, new NetworkDetectorEventArgs(online, net));
|
||||
}
|
||||
RaiseNotify(OnConnectedEthernet, new NetworkDetectorEventArgs(online, net));
|
||||
break;
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Wireless80211:
|
||||
if (isZuneConnected)
|
||||
{
|
||||
isZuneConnected = false;
|
||||
RaiseNotify(OnZuneDisconnected, new NetworkDetectorEventArgs(online, net));
|
||||
}
|
||||
RaiseNotify(OnConnectedWifi, new NetworkDetectorEventArgs(online, net));
|
||||
break;
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.MobileBroadbandCdma:
|
||||
if (isZuneConnected)
|
||||
{
|
||||
isZuneConnected = false;
|
||||
RaiseNotify(OnZuneDisconnected, new NetworkDetectorEventArgs(online, net));
|
||||
}
|
||||
RaiseNotify(OnConnectedBroadbandCdma, new NetworkDetectorEventArgs(online, net));
|
||||
break;
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.MobileBroadbandGsm:
|
||||
if (isZuneConnected)
|
||||
{
|
||||
isZuneConnected = false;
|
||||
RaiseNotify(OnZuneDisconnected, new NetworkDetectorEventArgs(online, net));
|
||||
}
|
||||
RaiseNotify(OnConnectedBroadbandGsm, new NetworkDetectorEventArgs(online, net));
|
||||
break;
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.None:
|
||||
if (!online)
|
||||
{
|
||||
if (isZuneConnected)
|
||||
{
|
||||
/*if we lost all network connection and the Zune was present before,
|
||||
then we lost the Zune too. Normally when Zune is present and then we got
|
||||
a None NetType, the PC just lost the internet connection but not the Zune sync*/
|
||||
isZuneConnected = false;
|
||||
RaiseNotify(OnZuneDisconnected, new NetworkDetectorEventArgs(online, net));
|
||||
}
|
||||
}
|
||||
RaiseNotify(OnConnectedNone, new NetworkDetectorEventArgs(online, net));
|
||||
break;
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.AsymmetricDsl:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Atm:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.BasicIsdn:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ethernet3Megabit:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.FastEthernetFx:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.FastEthernetT:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Fddi:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.GenericModem:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.GigabitEthernet:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.HighPerformanceSerialBus:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.IPOverAtm:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Isdn:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Loopback:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.MultiRateSymmetricDsl:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ppp:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.PrimaryIsdn:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.RateAdaptDsl:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Slip:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.SymmetricDsl:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.TokenRing:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Tunnel:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Unknown:
|
||||
case Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.VeryHighSpeedDsl:
|
||||
default://theoretically we can't get here but better be prepared
|
||||
RaiseNotify(OnConnectedOther, new NetworkDetectorEventArgs(online, net));
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < requestQueue.Count; i++)
|
||||
{
|
||||
if (requestQueue.Peek() < System.DateTime.Now.Ticks) requestQueue.Dequeue();
|
||||
//the requests before this moment just got answered
|
||||
//if other requests are coming right after this, they will be served inside the next networkWorker_RunWorkerCompleted
|
||||
}
|
||||
if (requestQueue.Count == 0) updateTimer.Stop();
|
||||
if (IsInstantRequestPresent) //the user requested a single poll
|
||||
{
|
||||
RaiseNotify(OnAsyncGetNetworkTypeCompleted, new NetworkDetectorEventArgs(online, net));
|
||||
IsInstantRequestPresent = false;
|
||||
}
|
||||
requestStatus = NetworkTypeRequestStatus.Ended;
|
||||
Debug.WriteLine("<<<<< GetNetType ended " + System.DateTime.Now.ToString("T") + " <<<<<");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Functions
|
||||
private void EnqueueRequest()
|
||||
{
|
||||
requestQueue.Enqueue(System.DateTime.Now.Ticks);
|
||||
if (!updateTimer.IsEnabled) updateTimer.Start();
|
||||
}
|
||||
|
||||
private void DetectOnlineStatus() //are we connected to any network or not
|
||||
{
|
||||
if (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
|
||||
{
|
||||
if (!online)
|
||||
{
|
||||
online = true; //the network just came back
|
||||
RaiseNotify(OnNetworkON, new NetworkAvailableEventArgs(online));
|
||||
// do what is needed to GoOnline();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (online)
|
||||
{
|
||||
online = false; //we just lost all network connectivity
|
||||
RaiseNotify(OnNetworkOFF, new NetworkAvailableEventArgs(online));
|
||||
Debug.WriteLine("----- No network available. -----");
|
||||
// do what is needed to GoOffline();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pollTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
EnqueueRequest();
|
||||
}
|
||||
|
||||
void updateTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (requestQueue.Count > 0)
|
||||
{
|
||||
if (!networkWorker.IsBusy)
|
||||
{
|
||||
requestStatus = NetworkTypeRequestStatus.Started;
|
||||
networkWorker.RunWorkerAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Event Handling
|
||||
private void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
|
||||
{
|
||||
Debug.WriteLine("+++++ Changed started " + System.DateTime.Now.ToString("T") + " +++++");
|
||||
DetectOnlineStatus();
|
||||
if (detailedMode) RaiseNotify(OnNetworkChanged, new NetworkAvailableEventArgs(online));
|
||||
Debug.WriteLine(" IsOnline : " + online.ToString());
|
||||
Debug.WriteLine(" Current NetType: " + net.ToString());
|
||||
Debug.WriteLine("+++++ Changed Ended " + System.DateTime.Now.ToString("T"));
|
||||
Debug.WriteLine(" Changed GetNetType Launch" + System.DateTime.Now.ToString("T"));
|
||||
EnqueueRequest();
|
||||
}
|
||||
|
||||
private void SetupNetworkChange()
|
||||
{
|
||||
// Get current network availalability and store the
|
||||
// initial value of the online variable
|
||||
if (Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
|
||||
{
|
||||
online = true;
|
||||
// do what is needed to GoOnline();
|
||||
}
|
||||
else
|
||||
{
|
||||
online = false;
|
||||
// do what is needed to GoOffline();
|
||||
}
|
||||
// Now add a network change event handler to indicate network availability
|
||||
EnqueueRequest();
|
||||
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += new System.Net.NetworkInformation.NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
|
||||
}
|
||||
|
||||
protected void RaiseNotify(EventHandler<NetworkDetectorEventArgs> handler, NetworkDetectorEventArgs e)
|
||||
{
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected void RaiseNotify(EventHandler<NetworkAvailableEventArgs> handler, NetworkAvailableEventArgs e)
|
||||
{
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functions and Properties
|
||||
public void AsyncGetNetworkType()
|
||||
{
|
||||
//requestQueue.Enqueue(System.DateTime.Now.Ticks);
|
||||
IsInstantRequestPresent = true;
|
||||
if (!networkWorker.IsBusy)
|
||||
{
|
||||
requestStatus = NetworkTypeRequestStatus.Started;
|
||||
networkWorker.RunWorkerAsync();
|
||||
}
|
||||
if (!updateTimer.IsEnabled) updateTimer.Start();
|
||||
}
|
||||
|
||||
public void SetNetworkPolling(int Minutes, int Seconds, int Milliseconds)
|
||||
{
|
||||
pollTimer.Interval = new TimeSpan(0, 0, Minutes, Seconds, Milliseconds);
|
||||
if (!pollTimer.IsEnabled) pollTimer.Start();
|
||||
}
|
||||
|
||||
public void DisableNetworkPolling()
|
||||
{
|
||||
if (pollTimer.IsEnabled) pollTimer.Stop();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType GetCurrentNetworkType()
|
||||
{
|
||||
return net;
|
||||
}
|
||||
|
||||
public NetworkTypeRequestStatus GetRequestStatus()
|
||||
{
|
||||
//NetworkTypeRequestStatus temp = requestStatus;
|
||||
//if (requestStatus == NetworkTypeRequestStatus.Ended) requestStatus = NetworkTypeRequestStatus.Default;
|
||||
//return temp;
|
||||
return requestStatus;
|
||||
}
|
||||
|
||||
public bool DetailedMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return detailedMode;
|
||||
}
|
||||
set
|
||||
{
|
||||
detailedMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool GetZuneStatus()
|
||||
{
|
||||
return isZuneConnected;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Deployment.Parts>
|
||||
</Deployment.Parts>
|
||||
</Deployment>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NetworkDetection")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("NetworkDetection")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("2d90f1d3-7fb9-47d0-98c2-18ee1a63a5f5")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.0">
|
||||
<App xmlns="" ProductID="{794d79f0-e898-460d-bdb5-49fed553e0d5}" Title="NetworkDetection" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="NetworkDetection author" Description="Sample description" Publisher="NetworkDetection">
|
||||
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
|
||||
<Capabilities>
|
||||
<Capability Name="ID_CAP_GAMERSERVICES"/>
|
||||
<Capability Name="ID_CAP_IDENTITY_DEVICE"/>
|
||||
<Capability Name="ID_CAP_IDENTITY_USER"/>
|
||||
<Capability Name="ID_CAP_LOCATION"/>
|
||||
<Capability Name="ID_CAP_MEDIALIB"/>
|
||||
<Capability Name="ID_CAP_MICROPHONE"/>
|
||||
<Capability Name="ID_CAP_NETWORKING"/>
|
||||
<Capability Name="ID_CAP_PHONEDIALER"/>
|
||||
<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
|
||||
<Capability Name="ID_CAP_SENSORS"/>
|
||||
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="NetworkDetectionToken" TaskName="_default">
|
||||
<TemplateType5>
|
||||
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
|
||||
<Count>0</Count>
|
||||
<Title>NetworkDetection</Title>
|
||||
</TemplateType5>
|
||||
</PrimaryToken>
|
||||
</Tokens>
|
||||
</App>
|
||||
</Deployment>
|
||||
|
After Width: | Height: | Size: 9.2 KiB |
@@ -0,0 +1,19 @@
|
||||
<Application
|
||||
x:Class="NetworkNamespaces.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone">
|
||||
|
||||
<!--Application Resources-->
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
|
||||
<Application.ApplicationLifetimeObjects>
|
||||
<!--Required object that handles lifetime events for the application-->
|
||||
<shell:PhoneApplicationService
|
||||
Launching="Application_Launching" Closing="Application_Closing"
|
||||
Activated="Application_Activated" Deactivated="Application_Deactivated"/>
|
||||
</Application.ApplicationLifetimeObjects>
|
||||
|
||||
</Application>
|
||||
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
namespace NetworkNamespaces
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides easy access to the root frame of the Phone Application.
|
||||
/// </summary>
|
||||
/// <returns>The root frame of the Phone Application.</returns>
|
||||
public PhoneApplicationFrame RootFrame { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for the Application object.
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
// Global handler for uncaught exceptions.
|
||||
UnhandledException += Application_UnhandledException;
|
||||
|
||||
// Show graphics profiling information while debugging.
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// Display the current frame rate counters.
|
||||
Application.Current.Host.Settings.EnableFrameRateCounter = true;
|
||||
|
||||
// Show the areas of the app that are being redrawn in each frame.
|
||||
//Application.Current.Host.Settings.EnableRedrawRegions = true;
|
||||
|
||||
// Enable non-production analysis visualization mode,
|
||||
// which shows areas of a page that are being GPU accelerated with a colored overlay.
|
||||
//Application.Current.Host.Settings.EnableCacheVisualization = true;
|
||||
}
|
||||
|
||||
// Standard Silverlight initialization
|
||||
InitializeComponent();
|
||||
|
||||
// Phone-specific initialization
|
||||
InitializePhoneApplication();
|
||||
}
|
||||
|
||||
// Code to execute when the application is launching (eg, from Start)
|
||||
// This code will not execute when the application is reactivated
|
||||
private void Application_Launching(object sender, LaunchingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is activated (brought to foreground)
|
||||
// This code will not execute when the application is first launched
|
||||
private void Application_Activated(object sender, ActivatedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is deactivated (sent to background)
|
||||
// This code will not execute when the application is closing
|
||||
private void Application_Deactivated(object sender, DeactivatedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute when the application is closing (eg, user hit Back)
|
||||
// This code will not execute when the application is deactivated
|
||||
private void Application_Closing(object sender, ClosingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
// Code to execute if a navigation fails
|
||||
private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// A navigation has failed; break into the debugger
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
// Code to execute on Unhandled Exceptions
|
||||
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
|
||||
{
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// An unhandled exception has occurred; break into the debugger
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
}
|
||||
|
||||
#region Phone application initialization
|
||||
|
||||
// Avoid double-initialization
|
||||
private bool phoneApplicationInitialized = false;
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void InitializePhoneApplication()
|
||||
{
|
||||
if (phoneApplicationInitialized)
|
||||
return;
|
||||
|
||||
// Create the frame but don't set it as RootVisual yet; this allows the splash
|
||||
// screen to remain active until the application is ready to render.
|
||||
RootFrame = new PhoneApplicationFrame();
|
||||
RootFrame.Navigated += CompleteInitializePhoneApplication;
|
||||
|
||||
// Handle navigation failures
|
||||
RootFrame.NavigationFailed += RootFrame_NavigationFailed;
|
||||
|
||||
// Ensure we don't initialize again
|
||||
phoneApplicationInitialized = true;
|
||||
}
|
||||
|
||||
// Do not add any additional code to this method
|
||||
private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)
|
||||
{
|
||||
// Set the root visual to allow the application to render
|
||||
if (RootVisual != RootFrame)
|
||||
RootVisual = RootFrame;
|
||||
|
||||
// Remove this handler since it is no longer needed
|
||||
RootFrame.Navigated -= CompleteInitializePhoneApplication;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1,53 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="NetworkNamespaces.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot is the root grid where all page content is placed-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="144"/>
|
||||
<RowDefinition Height="624*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel contains the name of the application and page title-->
|
||||
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock x:Name="ApplicationTitle" Text="NETWORK NAMESPACE DIFFERENCES" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<Button Content="Refresh" Height="71" Name="buttonRefresh" Width="160" Click="buttonRefresh_Click" />
|
||||
</StackPanel>
|
||||
<!--ContentPanel - place additional content here-->
|
||||
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Height="576" HorizontalAlignment="Stretch" Margin="0,42,0,0" Name="listBoxSilverlight" VerticalAlignment="Top" Width="211" VerticalContentAlignment="Stretch" />
|
||||
<ListBox Grid.Column="1" Height="576" HorizontalAlignment="Left" Name="listBoxPhone" VerticalAlignment="Top" Width="240" Margin="0,42,0,0" />
|
||||
<TextBlock Height="30" HorizontalAlignment="Left" Margin="6,0,0,0" Name="textBlock1" Text="Silverlight" VerticalAlignment="Top" />
|
||||
<TextBlock Grid.Column="1" Height="30" HorizontalAlignment="Left" Name="textBlock2" Text="Phone" VerticalAlignment="Top" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!--Sample code showing usage of ApplicationBar-->
|
||||
<!--<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
|
||||
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
|
||||
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
|
||||
<shell:ApplicationBar.MenuItems>
|
||||
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
|
||||
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
|
||||
</shell:ApplicationBar.MenuItems>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>-->
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Shapes;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
namespace NetworkNamespaces
|
||||
{
|
||||
public partial class MainPage : PhoneApplicationPage
|
||||
{
|
||||
// Constructor
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
System.Net.NetworkInformation.NetworkChange.NetworkAddressChanged += new System.Net.NetworkInformation.NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);
|
||||
}
|
||||
|
||||
void NetworkChange_NetworkAddressChanged(object sender, EventArgs e)
|
||||
{
|
||||
listBoxPhone.Items.Insert(0,Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable().ToString());
|
||||
listBoxSilverlight.Items.Insert(0,System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable().ToString());
|
||||
if (listBoxSilverlight.Items.Count > 21) listBoxSilverlight.Items.RemoveAt(listBoxSilverlight.Items.Count-1);
|
||||
if (listBoxPhone.Items.Count > 21) listBoxPhone.Items.RemoveAt(listBoxPhone.Items.Count - 1);
|
||||
}
|
||||
|
||||
private void buttonRefresh_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
listBoxPhone.Items.Insert(0,Microsoft.Phone.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable().ToString());
|
||||
listBoxSilverlight.Items.Insert(0,System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable().ToString());
|
||||
if (listBoxSilverlight.Items.Count > 21) listBoxSilverlight.Items.RemoveAt(listBoxSilverlight.Items.Count - 1);
|
||||
if (listBoxPhone.Items.Count > 21) listBoxPhone.Items.RemoveAt(listBoxPhone.Items.Count - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>10.0.20506</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{41A5C85F-7E30-418B-BAD2-AB2F40FF22CF}</ProjectGuid>
|
||||
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>NetworkNamespaces</RootNamespace>
|
||||
<AssemblyName>NetworkNamespaces</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
|
||||
<TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile>
|
||||
<TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
|
||||
<SilverlightApplication>true</SilverlightApplication>
|
||||
<SupportedCultures>
|
||||
</SupportedCultures>
|
||||
<XapOutputs>true</XapOutputs>
|
||||
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
|
||||
<XapFilename>NetworkNamespaces.xap</XapFilename>
|
||||
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
|
||||
<SilverlightAppEntry>NetworkNamespaces.App</SilverlightAppEntry>
|
||||
<ValidateXaml>true</ValidateXaml>
|
||||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT;WINDOWS_PHONE</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Phone" />
|
||||
<Reference Include="Microsoft.Phone.Interop" />
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="system" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
<None Include="Properties\WMAppManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ApplicationIcon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Background.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="SplashScreenImage.jpg" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.$(TargetFrameworkProfile).Overrides.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions />
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Deployment.Parts>
|
||||
</Deployment.Parts>
|
||||
</Deployment>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("NetworkNamespaces")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("NetworkNamespaces")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e86f4db7-5169-481a-88c2-7afd0f470c2e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2009/deployment" AppPlatformVersion="7.0">
|
||||
<App xmlns="" ProductID="{8a7d2a0b-f2ff-417f-aae7-56e8cf14a061}" Title="NetworkNamespaces" RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="NetworkNamespaces author" Description="Sample description" Publisher="NetworkNamespaces">
|
||||
<IconPath IsRelative="true" IsResource="false">ApplicationIcon.png</IconPath>
|
||||
<Capabilities>
|
||||
<Capability Name="ID_CAP_GAMERSERVICES"/>
|
||||
<Capability Name="ID_CAP_IDENTITY_DEVICE"/>
|
||||
<Capability Name="ID_CAP_IDENTITY_USER"/>
|
||||
<Capability Name="ID_CAP_LOCATION"/>
|
||||
<Capability Name="ID_CAP_MEDIALIB"/>
|
||||
<Capability Name="ID_CAP_MICROPHONE"/>
|
||||
<Capability Name="ID_CAP_NETWORKING"/>
|
||||
<Capability Name="ID_CAP_PHONEDIALER"/>
|
||||
<Capability Name="ID_CAP_PUSH_NOTIFICATION"/>
|
||||
<Capability Name="ID_CAP_SENSORS"/>
|
||||
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT"/>
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name ="_default" NavigationPage="MainPage.xaml"/>
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="NetworkNamespacesToken" TaskName="_default">
|
||||
<TemplateType5>
|
||||
<BackgroundImageURI IsRelative="true" IsResource="false">Background.png</BackgroundImageURI>
|
||||
<Count>0</Count>
|
||||
<Title>NetworkNamespaces</Title>
|
||||
</TemplateType5>
|
||||
</PrimaryToken>
|
||||
</Tokens>
|
||||
</App>
|
||||
</Deployment>
|
||||
|
After Width: | Height: | Size: 9.2 KiB |