Add project files.
@@ -0,0 +1,59 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26127.3
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CompassVO", "CompassVO\CompassVO.csproj", "{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Phone7.Fx.Preview", "Phone7.Fx.Preview\Phone7.Fx.Preview.csproj", "{B55A0F90-2B5A-4C4B-88F4-013AA1629866}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{60E3BC0B-053D-498A-B5F1-8F953EFA4C07}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
ReadMe.md = ReadMe.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|x86.Build.0 = Debug|x86
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|ARM.Build.0 = Release|ARM
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|x86.ActiveCfg = Release|x86
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|x86.Build.0 = Release|x86
|
||||
{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}.Release|x86.Deploy.0 = Release|x86
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Debug|x86.Build.0 = Debug|x86
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|ARM.Build.0 = Release|ARM
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|x86.ActiveCfg = Release|x86
|
||||
{B55A0F90-2B5A-4C4B-88F4-013AA1629866}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,129 @@
|
||||
<phone:PhoneApplicationPage x:Class="CompassVO.AboutPage"
|
||||
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"
|
||||
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait"
|
||||
Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768"
|
||||
d:DesignWidth="480"
|
||||
shell:SystemTray.IsVisible="True"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}">
|
||||
|
||||
<!--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="Compass VO"
|
||||
Margin="0"
|
||||
Style="{StaticResource PhoneTextNormalStyle}" />
|
||||
<TextBlock x:Name="PageTitle"
|
||||
Text="About"
|
||||
Margin="0,-7,0,0"
|
||||
Style="{StaticResource PhoneTextTitle1Style}" />
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - place additional content here-->
|
||||
<Grid x:Name="ContentPanel"
|
||||
Grid.Row="1"
|
||||
Margin="12,0,12,0">
|
||||
<StackPanel>
|
||||
<TextBlock>
|
||||
Version: 1.2.0.0
|
||||
</TextBlock>
|
||||
<TextBlock FontSize="16">
|
||||
ChangeLog:<LineBreak />
|
||||
- multiple fixes: (heading declinations, calibration crash)<LineBreak />
|
||||
- tweaks on orienteering theme<LineBreak />
|
||||
- new themes: digital and night<LineBreak />
|
||||
- new feature: taking map photo by hardware camera button<LineBreak />
|
||||
</TextBlock>
|
||||
<TextBlock Margin="0, 12, 0, 6">
|
||||
Carefully designed by
|
||||
</TextBlock>
|
||||
<Border Background="White"
|
||||
HorizontalAlignment="Center"
|
||||
Width="452" Height="80">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonDown">
|
||||
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Path=OpenWebPageCommand, Mode=OneWay}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<Image Margin="12"
|
||||
Stretch="Uniform"
|
||||
Source="/Images/jwp_banner_452.jpg" />
|
||||
</Border>
|
||||
<TextBlock Margin="0, 6, 0, 6">
|
||||
and
|
||||
</TextBlock>
|
||||
<Border Background="White"
|
||||
HorizontalAlignment="Center"
|
||||
Width="452" Height="80">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="MouseLeftButtonDown">
|
||||
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Path=OpenWebPageVOCommand, Mode=OneWay}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<Image Margin="12"
|
||||
Stretch="Uniform"
|
||||
Source="/Images/banner_logo.png" />
|
||||
</Border>
|
||||
|
||||
<Button Width="300"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="-10, 24, 0, 0"
|
||||
x:Name="btnRateMe"
|
||||
Content="review and rate">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Path=RateMeCommand, Mode=OneWay}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<Button Width="300"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="-10, 6, 0, 0"
|
||||
x:Name="btnFeedback"
|
||||
Content="feedback">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Path=SendFeedbackCommand, Mode=OneWay}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
</Button>
|
||||
<TextBlock>
|
||||
Thank you for your feedback and ideas!
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</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,12 @@
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
namespace CompassVO
|
||||
{
|
||||
public partial class AboutPage : PhoneApplicationPage
|
||||
{
|
||||
public AboutPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Application x:Class="CompassVO.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"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="clr-namespace:CompassVO.ViewModel"
|
||||
xmlns:Converters="clr-namespace:Coding4Fun.Phone.Controls.Converters;assembly=Coding4Fun.Phone.Controls"
|
||||
xmlns:Converters1="clr-namespace:CompassVO.Converters" mc:Ignorable="d">
|
||||
<!--Application Resources-->
|
||||
<Application.Resources>
|
||||
<vm:ViewModelLocator x:Key="Locator"
|
||||
d:IsDataSource="True" />
|
||||
|
||||
<Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<Converters1:ConditionalTextConverter x:Key="ConditionalTextConverter" />
|
||||
<Converters1:NegativeNumberConverter x:Key="NegativeNumberConverter" />
|
||||
<FontFamily x:Key="Digital">/Resources/Fonts/LCDMU.TTF#LCDMono</FontFamily>
|
||||
</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,196 @@
|
||||
using CompassVO.Model;
|
||||
using CompassVO.Utils.Logging;
|
||||
using CompassVO.ViewModel;
|
||||
using GalaSoft.MvvmLight.Threading;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace CompassVO
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public static bool IgnoreAllErrors { get; set; }
|
||||
|
||||
private static bool _canExit = true;
|
||||
|
||||
public static bool CanExit
|
||||
{
|
||||
get { return _canExit; }
|
||||
set { _canExit = value; }
|
||||
}
|
||||
|
||||
/// <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;
|
||||
|
||||
DispatcherHelper.Initialize();
|
||||
|
||||
// Standard Silverlight initialization
|
||||
InitializeComponent();
|
||||
|
||||
// Phone-specific initialization
|
||||
InitializePhoneApplication();
|
||||
|
||||
// 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 handed off to GPU with a colored overlay.
|
||||
//Application.Current.Host.Settings.EnableCacheVisualization = true;
|
||||
|
||||
// Disable the application idle detection by setting the UserIdleDetectionMode property of the
|
||||
// application's PhoneApplicationService object to Disabled.
|
||||
// Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
|
||||
// and consume battery power when the user is not using the phone.
|
||||
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (Locator != null)
|
||||
Locator.Cleanup();
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
#region Error Logging
|
||||
|
||||
if (IgnoreAllErrors)
|
||||
{
|
||||
e.Handled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.ExceptionObject is QuitException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (e.ExceptionObject is WebException)
|
||||
{
|
||||
MessageBox.Show(e.ExceptionObject.Message);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowException(e.ExceptionObject);
|
||||
}
|
||||
|
||||
#endregion Error Logging
|
||||
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
// An unhandled exception has occurred; break into the debugger
|
||||
System.Diagnostics.Debugger.Break();
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowException(Exception ex)
|
||||
{
|
||||
DispatcherHelper.CheckBeginInvokeOnUI(() =>
|
||||
{
|
||||
var exception = new ExceptionPrompt();
|
||||
exception.To = Constants.JWP_SUPPORT_EMAIL;
|
||||
exception.Show(ex);
|
||||
});
|
||||
}
|
||||
|
||||
#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 Phone application initialization
|
||||
|
||||
public static ViewModelLocator Locator
|
||||
{
|
||||
get
|
||||
{
|
||||
return App.Current.Resources["Locator"] as ViewModelLocator;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
@@ -0,0 +1,366 @@
|
||||
<?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>{AC16D6A0-B6AA-4732-9AC4-A0C35EF75B97}</ProjectGuid>
|
||||
<ProjectTypeGuids>{C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CompassVO</RootNamespace>
|
||||
<AssemblyName>CompassVO</AssemblyName>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<SilverlightVersion>
|
||||
</SilverlightVersion>
|
||||
<TargetFrameworkProfile>
|
||||
</TargetFrameworkProfile>
|
||||
<TargetFrameworkIdentifier>WindowsPhone</TargetFrameworkIdentifier>
|
||||
<SilverlightApplication>true</SilverlightApplication>
|
||||
<SupportedCultures>
|
||||
</SupportedCultures>
|
||||
<XapOutputs>true</XapOutputs>
|
||||
<GenerateSilverlightManifest>true</GenerateSilverlightManifest>
|
||||
<XapFilename>CompassVO_$(Configuration)_$(Platform).xap</XapFilename>
|
||||
<SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
|
||||
<SilverlightAppEntry>CompassVO.App</SilverlightAppEntry>
|
||||
<ValidateXaml>true</ValidateXaml>
|
||||
<ThrowErrorsInValidation>true</ThrowErrorsInValidation>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>4.0</OldToolsVersion>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</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>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<PlatformTarget />
|
||||
<OutputPath>Bin\x86\Debug</OutputPath>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<PlatformTarget />
|
||||
<OutputPath>Bin\x86\Release</OutputPath>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<PlatformTarget />
|
||||
<OutputPath>Bin\ARM\Debug</OutputPath>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<PlatformTarget />
|
||||
<OutputPath>Bin\ARM\Release</OutputPath>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Coding4Fun.Phone.Controls">
|
||||
<HintPath>..\packages\Coding4Fun.Phone.Controls.Complete.1.4.6\lib\Coding4Fun.Phone.Controls.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Coding4Fun.Phone.Controls.Toolkit">
|
||||
<HintPath>..\packages\Coding4Fun.Phone.Controls.Complete.1.4.6\lib\Coding4Fun.Phone.Controls.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Extras.WP71, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
|
||||
<Reference Include="GalaSoft.MvvmLight.WP71, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL" />
|
||||
<Reference Include="MicroIoc">
|
||||
<HintPath>..\packages\microioc.1.0\lib\MicroIoc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Phone.Controls, Version=8.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.Phone.Controls.Toolkit, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SilverlightToolkitWP.4.2011.8.17\lib\sl4-windowsphone71\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Interactivity, Version=3.8.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="Telerik.Windows.Controls.Primitives, Version=2011.3.817.1040, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
|
||||
<Reference Include="Telerik.Windows.Core, Version=2011.3.817.1040, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AboutPage.xaml.cs">
|
||||
<DependentUpon>AboutPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converters\ConditionalTextConverter.cs" />
|
||||
<Compile Include="Converters\NegativeNumberConverter.cs" />
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Model\AppSettings.cs" />
|
||||
<Compile Include="Model\Constants.cs" />
|
||||
<Compile Include="Model\Container.cs" />
|
||||
<Compile Include="Model\Messages\CompassThemeChangedMessage.cs" />
|
||||
<Compile Include="Model\Messages\LoadPhotoMessage.cs" />
|
||||
<Compile Include="Model\Messages\RefreshAppBarMessage.cs" />
|
||||
<Compile Include="Model\Messages\ShowCameraPreviewMessage.cs" />
|
||||
<Compile Include="Model\Messages\TakePhotoMessage.cs" />
|
||||
<Compile Include="Model\Messages\UpdateCompassUIMessage.cs" />
|
||||
<Compile Include="Model\OperationModeEnum.cs" />
|
||||
<Compile Include="Model\QuitException.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Service\CompassEx.cs" />
|
||||
<Compile Include="Service\CompassReadingEx.cs" />
|
||||
<Compile Include="Service\CompassThemeController.cs" />
|
||||
<Compile Include="Service\Navigation\IPageNavigation.cs" />
|
||||
<Compile Include="Service\Navigation\PageNavigation.cs" />
|
||||
<Compile Include="SettingsPage.xaml.cs">
|
||||
<DependentUpon>SettingsPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Themes\CompassUiUtil.cs" />
|
||||
<Compile Include="Themes\compass_metro_graphic\compass_metro_graphic_UI.xaml.cs">
|
||||
<DependentUpon>compass_metro_graphic_UI.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Themes\compass_metro_graphic\theme_compass_metro_graphic.cs" />
|
||||
<Compile Include="Themes\compass_cardinal\compass_cardinal_UI.xaml.cs">
|
||||
<DependentUpon>compass_cardinal_UI.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Themes\compass_cardinal\theme_compass_cardinal.cs" />
|
||||
<Compile Include="Themes\compass_night\compass_night_UI.xaml.cs">
|
||||
<DependentUpon>compass_night_UI.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Themes\compass_night\theme_compass_night.cs" />
|
||||
<Compile Include="Themes\compass_orienteering\compass_orienteering_UI.xaml.cs">
|
||||
<DependentUpon>compass_orienteering_UI.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Themes\compass_orienteering\theme_compass_orienteering.cs" />
|
||||
<Compile Include="Themes\compass_digital\compass_digital_UI.xaml.cs">
|
||||
<DependentUpon>compass_digital_UI.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Themes\compass_digital\theme_compass_digital.cs" />
|
||||
<Compile Include="Themes\ICompassTheme.cs" />
|
||||
<Compile Include="Utils\Filters\SimpleKalman.cs" />
|
||||
<Compile Include="Utils\IsolatedStorageHelper.cs" />
|
||||
<Compile Include="Utils\Logging\ExceptionPrompt.cs" />
|
||||
<Compile Include="Utils\MediaHelper.cs" />
|
||||
<Compile Include="Utils\PhoneThemeDetect.cs" />
|
||||
<Compile Include="ViewModel\MainViewModel.cs" />
|
||||
<Compile Include="ViewModel\ViewModelBase.cs" />
|
||||
<Compile Include="ViewModel\ViewModelLocator.cs" />
|
||||
<Compile Include="Views\compass_calibration.xaml.cs">
|
||||
<DependentUpon>compass_calibration.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="AboutPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="SettingsPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\compass_metro_graphic\compass_metro_graphic_UI.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\compass_cardinal\compass_cardinal_UI.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\compass_night\compass_night_UI.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\compass_orienteering\compass_orienteering_UI.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Themes\compass_digital\compass_digital_UI.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Themes\Generic.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\compass_calibration.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\AppManifest.xml" />
|
||||
<None Include="Properties\WMAppManifest.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<Content Include="Resources\Fonts\LCDMU.TTF">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="ApplicationIcon.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Background.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\appbar.check.rest.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\appbar.delete.rest.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\appbar.feature.camera.rest.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\appbar.feature.settings.rest.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\appbar.folder.rest.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\banner_logo.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\banner_logo_100.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\calibrate_compass.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\icon_dial_lock.png" />
|
||||
<Content Include="Images\icon_dial_unlock.png" />
|
||||
<Content Include="Images\icon_map.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\jwp_banner_452.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\pinch_zoom_72.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Sounds\camera.wav">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_cardinal\images\compass_old_needle_light.png" />
|
||||
<Content Include="Themes\compass_digital\images\compass_digital_dial.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_digital\images\compass_digital_needle.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_metro_graphic\images\sample_metro_graphic.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_cardinal\images\compass_old_needle.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_cardinal\images\sample_old.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_night\images\sample_night.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_orienteering\images\compass_orienteering_back.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_orienteering\images\compass_orienteering_dial.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_orienteering\images\compass_orienteering_needle.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\icon_dial_black.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\icon_dial_white.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\icon_background_black.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\icon_background_white.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="SplashScreenImage.jpg" />
|
||||
<Content Include="Themes\compass_orienteering\images\compass_orienteering_rotate.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_orienteering\images\sample_orienteering.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Themes\compass_digital\images\sample_digital.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Cancel.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Check.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Delete.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Select.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Phone7.Fx.Preview\Phone7.Fx.Preview.csproj">
|
||||
<Project>{B55A0F90-2B5A-4C4B-88F4-013AA1629866}</Project>
|
||||
<Name>Phone7.Fx.Preview</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).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,32 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace CompassVO.Converters
|
||||
{
|
||||
public class ConditionalTextConverter : IValueConverter
|
||||
{
|
||||
#region Implementation of IValueConverter
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value != null && parameter != null && value is bool)
|
||||
{
|
||||
bool boolVal = (bool)value;
|
||||
string[] texts = parameter.ToString().Split('|');
|
||||
if (texts.Length == 2)
|
||||
{
|
||||
return boolVal ? texts[0] : texts[1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion Implementation of IValueConverter
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace CompassVO.Converters
|
||||
{
|
||||
public class NegativeNumberConverter : IValueConverter
|
||||
{
|
||||
#region Implementation of IValueConverter
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
if (value is int)
|
||||
{
|
||||
return -(int)value;
|
||||
}
|
||||
if (value is double)
|
||||
{
|
||||
return -(double)value;
|
||||
}
|
||||
if (value is long)
|
||||
{
|
||||
return -(long)value;
|
||||
}
|
||||
if (value is decimal)
|
||||
{
|
||||
return -(decimal)value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion Implementation of IValueConverter
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 414 B |
|
After Width: | Height: | Size: 445 B |
|
After Width: | Height: | Size: 490 B |
|
After Width: | Height: | Size: 543 B |
|
After Width: | Height: | Size: 282 B |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 464 B |
|
After Width: | Height: | Size: 514 B |
|
After Width: | Height: | Size: 547 B |
|
After Width: | Height: | Size: 492 B |
|
After Width: | Height: | Size: 503 B |
|
After Width: | Height: | Size: 634 B |
|
After Width: | Height: | Size: 978 B |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,258 @@
|
||||
<phone:PhoneApplicationPage xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
|
||||
x:Class="CompassVO.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"
|
||||
xmlns:Preview="clr-namespace:Phone7.Fx.Preview;assembly=Phone7.Fx.Preview"
|
||||
xmlns:compass_orienteering="clr-namespace:CompassVO.Themes.compass_orienteering"
|
||||
xmlns:Views="clr-namespace:CompassVO.Views"
|
||||
xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP71"
|
||||
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
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"
|
||||
Unloaded="PhoneApplicationPage_Unloaded"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||
BackKeyPress="PhoneApplicationPage_BackKeyPress">
|
||||
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Loaded">
|
||||
<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Main.MainPageLoaded, Mode=OneWay, Source={StaticResource Locator}}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
|
||||
<!--LayoutRoot is the root grid where all page content is placed-->
|
||||
<Grid x:Name="LayoutRoot"
|
||||
Background="White">
|
||||
|
||||
<!--ContentPanel - place additional content here-->
|
||||
<Grid x:Name="ContentPanel"
|
||||
Grid.Row="0"
|
||||
Margin="0"
|
||||
DoubleTap="ContentPanel_DoubleTap"
|
||||
ManipulationStarted="ContentPanel_ManipulationStarted"
|
||||
ManipulationDelta="ContentPanel_ManipulationDelta"
|
||||
ManipulationCompleted="ContentPanel_ManipulationCompleted">
|
||||
|
||||
<toolkit:GestureService.GestureListener>
|
||||
<toolkit:GestureListener x:Name="gl"
|
||||
DragStarted="gl_DragStarted"
|
||||
DragDelta="gl_DragDelta"
|
||||
PinchStarted="gl_PinchStarted"
|
||||
PinchDelta="gl_PinchDelta" />
|
||||
</toolkit:GestureService.GestureListener>
|
||||
|
||||
<Grid Visibility="{Binding IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<TextBlock Foreground="Black"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="24">
|
||||
Loading ...
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
|
||||
<Canvas x:Name="viewfinderCanvas"
|
||||
Margin="0"
|
||||
Width="1066"
|
||||
Height="800"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding IsCameraActive, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
|
||||
<!--Camera viewfinder -->
|
||||
<Canvas.Background>
|
||||
<VideoBrush x:Name="viewfinderBrush"
|
||||
Stretch="UniformToFill">
|
||||
</VideoBrush>
|
||||
</Canvas.Background>
|
||||
<Canvas.RenderTransform>
|
||||
<RotateTransform Angle="90"
|
||||
CenterX="533"
|
||||
CenterY="400"></RotateTransform>
|
||||
</Canvas.RenderTransform>
|
||||
</Canvas>
|
||||
|
||||
<Grid>
|
||||
<Canvas x:Name="viewPhoto"
|
||||
Margin="0"
|
||||
Width="1"
|
||||
Height="1"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Visibility="{Binding HasPhoto, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
|
||||
<!--Camera Photo -->
|
||||
<Image x:Name="backPhoto"
|
||||
CacheMode="BitmapCache">
|
||||
<Image.RenderTransform>
|
||||
<TransformGroup>
|
||||
<TranslateTransform X="{Binding PhotoOffsetX}"
|
||||
Y="{Binding PhotoOffsetY}" />
|
||||
<RotateTransform Angle="{Binding PhotoAngle}"
|
||||
CenterX="0"
|
||||
CenterY="0" />
|
||||
<ScaleTransform ScaleX="{Binding PhotoScale}"
|
||||
ScaleY="{Binding PhotoScale}"
|
||||
CenterX="0"
|
||||
CenterY="0" />
|
||||
</TransformGroup>
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
|
||||
<Grid x:Name="compassContainer"
|
||||
Opacity="{Binding CompasUIOpacity}">
|
||||
<!--<compass_orienteering:compass_orienteering />-->
|
||||
<!--<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="lblAngleMagnetic"
|
||||
FontSize="28"
|
||||
Margin="6">Angle magnetic:</TextBlock>
|
||||
<TextBlock x:Name="lblAngleMagneticValue"
|
||||
Margin="6"
|
||||
FontSize="28"
|
||||
Text="{Binding Path=MagneticHeading, Mode=OneWay, StringFormat='0'}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="lblAngleTrue"
|
||||
FontSize="28"
|
||||
Margin="6">Angle true:</TextBlock>
|
||||
<TextBlock x:Name="lblAngleTrueValue"
|
||||
Margin="6"
|
||||
FontSize="28"
|
||||
Text="{Binding Path=TrueHeading, Mode=OneWay, StringFormat='0'}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="lblAngleMD"
|
||||
FontSize="28"
|
||||
Margin="6">Magnetic declination:</TextBlock>
|
||||
<TextBlock x:Name="lblAngleMDValue"
|
||||
Margin="6"
|
||||
FontSize="28"
|
||||
Text="{Binding Path=MagneticDeclination, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="lblAccuracy"
|
||||
FontSize="28"
|
||||
Margin="6">Accuracy:</TextBlock>
|
||||
<TextBlock x:Name="lblAccuracyValue"
|
||||
Margin="6"
|
||||
FontSize="28"
|
||||
Text="{Binding Path=HeadingAccuracy, Mode=OneWay}" />
|
||||
</StackPanel>-->
|
||||
</Grid>
|
||||
|
||||
<Grid HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Margin="0"
|
||||
Background="Transparent" />
|
||||
|
||||
<!--all status messages-->
|
||||
<Grid HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch">
|
||||
<!--camera init-->
|
||||
<Border CornerRadius="6"
|
||||
BorderThickness="2"
|
||||
BorderBrush="DarkGray"
|
||||
Background="White"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding IsInitCamera, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid Margin="24">
|
||||
<TextBlock Foreground="Black"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0"
|
||||
FontSize="22">Starting camera ...</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!--saving photo-->
|
||||
<Border CornerRadius="6"
|
||||
BorderThickness="2"
|
||||
BorderBrush="DarkGray"
|
||||
Background="White"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding IsSavingPhoto, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid Margin="24">
|
||||
<TextBlock Foreground="Black"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0"
|
||||
FontSize="22">Saving photo ...</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
<!--image editing-->
|
||||
<Image Source="/Images/pinch_zoom_72.png"
|
||||
Stretch="None"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="12"
|
||||
Visibility="{Binding HasPhotoAndEditImage, Converter={StaticResource BooleanToVisibilityConverter}}"></Image>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!--Calibration UI-->
|
||||
<telerikPrimitives:RadWindow x:Name="winCalibration"
|
||||
IsFullScreen="True"
|
||||
IsOpen="{Binding NeedsCalibration}"
|
||||
IsClosedOnBackButton="False"
|
||||
IsClosedOnOutsideTap="False">
|
||||
<Border Background="Black">
|
||||
<Views:compass_calibration x:Name="pnlCalibration"
|
||||
Width="380"
|
||||
Height="600" />
|
||||
</Border>
|
||||
</telerikPrimitives:RadWindow>
|
||||
|
||||
<!--app bar-->
|
||||
<Preview:BindableApplicationBar x:Name="AppBar"
|
||||
BarOpacity="0.8"
|
||||
IsMenuEnabled="True">
|
||||
<!--<Preview:BindableApplicationBarIconButton Command="{Binding Main.BackPictureEdit, Mode=OneWay, Source={StaticResource Locator}}"
|
||||
IconUri="/Images/icon_background_white.png"
|
||||
IsEnabled="{Binding IsCompassMode}"
|
||||
Text="edit back" />
|
||||
<Preview:BindableApplicationBarIconButton Command="{Binding Main.CompassDialEdit, Mode=OneWay, Source={StaticResource Locator}}"
|
||||
IconUri="/Images/icon_dial_white.png"
|
||||
IsEnabled="{Binding IsCompassMode}"
|
||||
Text="edit dial" />
|
||||
<Preview:BindableApplicationBarIconButton Command="{Binding Main.ShowSettings, Mode=OneWay, Source={StaticResource Locator}}"
|
||||
IconUri="/Images/appbar.feature.settings.rest.png"
|
||||
IsEnabled="{Binding IsCompassMode}"
|
||||
Text="setting" />
|
||||
|
||||
<Preview:BindableApplicationBarIconButton Command="{Binding Main.AcceptDialEdit, Mode=OneWay, Source={StaticResource Locator}}"
|
||||
IconUri="/Images/appbar.check.rest.png"
|
||||
IsEnabled="{Binding IsDialEdit}"
|
||||
Text="accept" />-->
|
||||
|
||||
<!--<Preview:BindableApplicationBar.MenuItems>
|
||||
<Preview:BindableApplicationBarMenuItem Text="about"
|
||||
Command="{Binding ShowAbout}" />
|
||||
</Preview:BindableApplicationBar.MenuItems>-->
|
||||
</Preview:BindableApplicationBar>
|
||||
</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,368 @@
|
||||
using CompassVO.Model;
|
||||
using CompassVO.Model.Messages;
|
||||
using CompassVO.Utils;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using GalaSoft.MvvmLight.Threading;
|
||||
using Microsoft.Devices;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Xna.Framework.Media;
|
||||
using Phone7.Fx.Preview;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace CompassVO
|
||||
{
|
||||
public partial class MainPage : PhoneApplicationPage
|
||||
{
|
||||
private PhotoCamera cam;
|
||||
private UserControl compass_control;
|
||||
private bool isCamInit = false;
|
||||
|
||||
// Constructor
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
Messenger.Default.Register<CompassThemeChangedMessage>(this, (res) => CreateCompassTheme());
|
||||
Messenger.Default.Register<RefreshAppBarMessage>(this, (res) => FillAppBar());
|
||||
Messenger.Default.Register<ShowCameraPreviewMessage>(this, (res) => InitCamera(res));
|
||||
Messenger.Default.Register<TakePhotoMessage>(this, (res) => TakePhoto());
|
||||
Messenger.Default.Register<LoadPhotoMessage>(this, (res) => LoadPhoto());
|
||||
}
|
||||
|
||||
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsBackgroundImageEdit && App.Locator.Main.IsCameraActive && !App.Locator.Main.HasPhoto)
|
||||
{
|
||||
App.Locator.Main.IsInitCamera = true;
|
||||
InitCamera(new ShowCameraPreviewMessage(true));
|
||||
}
|
||||
base.OnNavigatedTo(e);
|
||||
}
|
||||
|
||||
private void LoadPhoto()
|
||||
{
|
||||
if (App.Locator.Main.HasPhoto)
|
||||
{
|
||||
WriteableBitmap bmp = IsolatedStorageHelper.LoadFromLocalStorage(Constants.FINAL_PHOTO_FILENAME, Constants.PHOTO_FOLDER);
|
||||
backPhoto.Source = bmp;
|
||||
backPhoto.UpdateLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private void InitCamera(ShowCameraPreviewMessage res)
|
||||
{
|
||||
if (cam != null)
|
||||
cam.Dispose();
|
||||
cam = null;
|
||||
isCamInit = false;
|
||||
|
||||
if (res.ShowCamera)
|
||||
{
|
||||
if ((PhotoCamera.IsCameraTypeSupported(CameraType.Primary) == true))
|
||||
{
|
||||
// Otherwise, use standard camera on back of device.
|
||||
cam = new Microsoft.Devices.PhotoCamera(CameraType.Primary);
|
||||
cam.Initialized += new EventHandler<CameraOperationCompletedEventArgs>(cam_Initialized);
|
||||
cam.CaptureImageAvailable += new EventHandler<ContentReadyEventArgs>(cam_CaptureImageAvailable);
|
||||
CameraButtons.ShutterKeyHalfPressed += new EventHandler(CameraButtons_ShutterKeyHalfPressed);
|
||||
CameraButtons.ShutterKeyReleased += new EventHandler(CameraButtons_ShutterKeyReleased);
|
||||
CameraButtons.ShutterKeyPressed += new EventHandler(CameraButtons_ShutterKeyPressed);
|
||||
//Set the VideoBrush source to the camera.
|
||||
viewfinderBrush.SetSource(cam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CameraButtons_ShutterKeyPressed(object sender, EventArgs e)
|
||||
{
|
||||
if (cam != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
cam.CaptureImage();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CameraButtons_ShutterKeyReleased(object sender, EventArgs e)
|
||||
{
|
||||
if (cam != null)
|
||||
{
|
||||
cam.CancelFocus();
|
||||
}
|
||||
}
|
||||
|
||||
private void CameraButtons_ShutterKeyHalfPressed(object sender, EventArgs e)
|
||||
{
|
||||
if (cam != null)
|
||||
{
|
||||
DispatcherHelper.CheckBeginInvokeOnUI(() =>
|
||||
{
|
||||
cam.Focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
|
||||
{
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
App.Locator.Main.IsCameraActive = false;
|
||||
App.Locator.Main.IsSavingPhoto = true;
|
||||
MediaHelper.PlaySound("Sounds\\camera.wav");
|
||||
InitCamera(new ShowCameraPreviewMessage(false));
|
||||
});
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
byte[] buffer = new byte[4096];
|
||||
int len = 0;
|
||||
while ((len = e.ImageStream.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
ms.Write(buffer, 0, len);
|
||||
}
|
||||
buffer = ms.ToArray();
|
||||
IsolatedStorageHelper.SaveToLocalStorage(Constants.TEMP_PHOTO_FILENAME, Constants.PHOTO_FOLDER, buffer);
|
||||
//save also to media lib
|
||||
MediaLibrary myMediaLibrary = new MediaLibrary();
|
||||
myMediaLibrary.SavePicture(string.Format("mapscan_{0}.jpg", Guid.NewGuid().ToString("N")), buffer);
|
||||
}
|
||||
//
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
WriteableBitmap bmp = IsolatedStorageHelper.LoadFromLocalStorage(Constants.TEMP_PHOTO_FILENAME, Constants.PHOTO_FOLDER);
|
||||
backPhoto.Source = bmp;
|
||||
|
||||
App.Locator.Main.PhotoOffsetX = -(double)bmp.PixelWidth / 2;
|
||||
App.Locator.Main.PhotoOffsetY = -(double)bmp.PixelHeight / 2;
|
||||
App.Locator.Main.PhotoScale = (double)1066 / bmp.PixelWidth;
|
||||
App.Locator.Main.PhotoAngle = 90;
|
||||
App.Locator.Main.SavePhotoSettings();
|
||||
|
||||
App.Locator.Main.HasPhoto = true;
|
||||
FillAppBar();
|
||||
App.Locator.Main.IsSavingPhoto = false;
|
||||
});
|
||||
}
|
||||
|
||||
private void cam_Initialized(object sender, CameraOperationCompletedEventArgs e)
|
||||
{
|
||||
isCamInit = true;
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
App.Locator.Main.IsInitCamera = false;
|
||||
});
|
||||
}
|
||||
|
||||
private void FillAppBar()
|
||||
{
|
||||
AppBar.Buttons.Clear();
|
||||
if (App.Locator.Main.IsCompassMode)
|
||||
{
|
||||
BindableApplicationBarIconButton button1 = new BindableApplicationBarIconButton();
|
||||
button1.IconUri = new Uri("/Images/icon_map.png", UriKind.Relative);
|
||||
button1.Text = "set map";
|
||||
button1.Command = App.Locator.Main.BackPictureEdit;
|
||||
AppBar.Buttons.Add(button1);
|
||||
|
||||
if (App.Locator.Main.CurrentTheme.SupportsDialRotation)
|
||||
{
|
||||
BindableApplicationBarIconButton button2 = new BindableApplicationBarIconButton();
|
||||
button2.IconUri = new Uri(App.Locator.Main.IsDialEdit ? "/Images/icon_dial_lock.png" : "/Images/icon_dial_unlock.png", UriKind.Relative);
|
||||
button2.Text = "dial";
|
||||
button2.Command = App.Locator.Main.CompassDialEdit;
|
||||
AppBar.Buttons.Add(button2);
|
||||
}
|
||||
|
||||
BindableApplicationBarIconButton button3 = new BindableApplicationBarIconButton();
|
||||
button3.IconUri = new Uri("/Images/appbar.feature.settings.rest.png", UriKind.Relative);
|
||||
button3.Text = "settings";
|
||||
button3.Command = App.Locator.Main.ShowSettings;
|
||||
AppBar.Buttons.Add(button3);
|
||||
}
|
||||
else if (App.Locator.Main.IsBackgroundImageEdit)
|
||||
{
|
||||
if (!App.Locator.Main.HasPhoto)
|
||||
{
|
||||
//no photo
|
||||
BindableApplicationBarIconButton button1 = new BindableApplicationBarIconButton();
|
||||
button1.IconUri = new Uri("/Images/appbar.feature.camera.rest.png", UriKind.Relative);
|
||||
button1.Text = "photo";
|
||||
button1.Command = App.Locator.Main.TakePhotoCommand;
|
||||
AppBar.Buttons.Add(button1);
|
||||
|
||||
BindableApplicationBarIconButton button2 = new BindableApplicationBarIconButton();
|
||||
button2.IconUri = new Uri("/Images/appbar.folder.rest.png", UriKind.Relative);
|
||||
button2.Text = "browse";
|
||||
button2.Command = App.Locator.Main.SelectPhotoCommand;
|
||||
AppBar.Buttons.Add(button2);
|
||||
}
|
||||
else
|
||||
{
|
||||
BindableApplicationBarIconButton button1 = new BindableApplicationBarIconButton();
|
||||
button1.IconUri = new Uri("/Images/appbar.check.rest.png", UriKind.Relative);
|
||||
button1.Text = "accept";
|
||||
button1.Command = App.Locator.Main.AcceptPhotoEdit;
|
||||
AppBar.Buttons.Add(button1);
|
||||
//has photo
|
||||
BindableApplicationBarIconButton button3 = new BindableApplicationBarIconButton();
|
||||
button3.IconUri = new Uri("/Images/appbar.delete.rest.png", UriKind.Relative);
|
||||
button3.Text = "remove";
|
||||
button3.Command = App.Locator.Main.RemovePhotoCommand;
|
||||
AppBar.Buttons.Add(button3);
|
||||
}
|
||||
}
|
||||
else if (App.Locator.Main.IsDialEdit)
|
||||
{
|
||||
BindableApplicationBarIconButton button1 = new BindableApplicationBarIconButton();
|
||||
button1.IconUri = new Uri("/Images/appbar.check.rest.png", UriKind.Relative);
|
||||
button1.Text = "accept";
|
||||
button1.Command = App.Locator.Main.AcceptDialEdit;
|
||||
AppBar.Buttons.Add(button1);
|
||||
}
|
||||
|
||||
//about
|
||||
BindableApplicationBarMenuItem menu1 = new BindableApplicationBarMenuItem();
|
||||
menu1.Text = "about";
|
||||
menu1.Command = App.Locator.Main.ShowAbout;
|
||||
AppBar.MenuItems.Add(menu1);
|
||||
}
|
||||
|
||||
public void CreateCompassTheme()
|
||||
{
|
||||
if (App.Locator.Main.CurrentTheme != null)
|
||||
{
|
||||
compassContainer.Children.Clear();
|
||||
//
|
||||
compass_control = (UserControl)Activator.CreateInstance(App.Locator.Main.CurrentTheme.UIcomponent);
|
||||
compass_control.Width = 480;
|
||||
compass_control.Height = 800;
|
||||
compass_control.HorizontalAlignment = HorizontalAlignment.Center;
|
||||
compass_control.VerticalAlignment = VerticalAlignment.Center;
|
||||
compassContainer.Children.Add(compass_control);
|
||||
compass_control.UpdateLayout();
|
||||
|
||||
//back color
|
||||
LayoutRoot.Background = new SolidColorBrush(App.Locator.Main.CurrentTheme.BackgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void PhoneApplicationPage_Unloaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
private void ContentPanel_DoubleTap(object sender, System.Windows.Input.GestureEventArgs e)
|
||||
{
|
||||
if (cam != null && isCamInit && cam.IsFocusSupported)
|
||||
{
|
||||
cam.CancelFocus();
|
||||
cam.Focus();
|
||||
}
|
||||
}
|
||||
|
||||
private void ContentPanel_ManipulationStarted(object sender, System.Windows.Input.ManipulationStartedEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsDialEdit)
|
||||
{
|
||||
MatrixTransform pt = (MatrixTransform)e.ManipulationContainer.TransformToVisual(LayoutRoot);
|
||||
App.Locator.Main.CompassDialEditStarted(new Point(pt.Matrix.OffsetX + e.ManipulationOrigin.X, pt.Matrix.OffsetY + e.ManipulationOrigin.Y));
|
||||
}
|
||||
}
|
||||
|
||||
private void ContentPanel_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsDialEdit)
|
||||
{
|
||||
MatrixTransform pt = (MatrixTransform)e.ManipulationContainer.TransformToVisual(LayoutRoot);
|
||||
App.Locator.Main.CompassDialEditDelta(new Point(pt.Matrix.OffsetX + e.ManipulationOrigin.X, pt.Matrix.OffsetY + e.ManipulationOrigin.Y));
|
||||
}
|
||||
}
|
||||
|
||||
private void ContentPanel_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsDialEdit)
|
||||
{
|
||||
App.Locator.Main.CompassDialEditCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
//
|
||||
if (!App.Locator.Main.IsCompassMode)
|
||||
{
|
||||
App.Locator.Main.CancelEdit();
|
||||
e.Cancel = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void TakePhoto()
|
||||
{
|
||||
if (cam != null && isCamInit)
|
||||
{
|
||||
try
|
||||
{
|
||||
cam.CaptureImage();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void gl_DragStarted(object sender, DragStartedGestureEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsBackgroundImageEdit && App.Locator.Main.HasPhoto)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
private const double Rad2Deg = 180.0 / Math.PI;
|
||||
private const double Deg2Rad = Math.PI / 180.0;
|
||||
|
||||
private void gl_DragDelta(object sender, DragDeltaGestureEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsBackgroundImageEdit && App.Locator.Main.HasPhoto)
|
||||
{
|
||||
double radians = -App.Locator.Main.PhotoAngle * Deg2Rad;
|
||||
double msin = Math.Sin(radians);
|
||||
double mcos = Math.Cos(radians);
|
||||
double x = mcos * e.HorizontalChange - msin * e.VerticalChange;
|
||||
double y = msin * e.HorizontalChange + mcos * e.VerticalChange;
|
||||
|
||||
App.Locator.Main.PhotoOffsetX += x / App.Locator.Main.PhotoScale;
|
||||
App.Locator.Main.PhotoOffsetY += y / App.Locator.Main.PhotoScale;
|
||||
}
|
||||
}
|
||||
|
||||
private void gl_PinchDelta(object sender, PinchGestureEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsBackgroundImageEdit && App.Locator.Main.HasPhoto)
|
||||
{
|
||||
App.Locator.Main.PhotoAngle = _initPhotoRotation + e.TotalAngleDelta;
|
||||
App.Locator.Main.PhotoScale = _initPhotoScale * e.DistanceRatio;
|
||||
}
|
||||
}
|
||||
|
||||
private double _initPhotoRotation;
|
||||
private double _initPhotoScale;
|
||||
|
||||
private void gl_PinchStarted(object sender, PinchStartedGestureEventArgs e)
|
||||
{
|
||||
if (App.Locator.Main.IsBackgroundImageEdit && App.Locator.Main.HasPhoto)
|
||||
{
|
||||
_initPhotoRotation = App.Locator.Main.PhotoAngle;
|
||||
_initPhotoScale = App.Locator.Main.PhotoScale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace CompassVO.Model
|
||||
{
|
||||
[DataContract]
|
||||
public class AppSettings
|
||||
{
|
||||
[IgnoreDataMember]
|
||||
public const string APP_SETTINGS_KEY = "APP_SETTINGS_KEY";
|
||||
|
||||
private double _dialAngle;
|
||||
|
||||
[DataMember]
|
||||
public double DialAngle
|
||||
{
|
||||
get { return _dialAngle; }
|
||||
set
|
||||
{
|
||||
if (_dialAngle == value)
|
||||
return;
|
||||
_dialAngle = value;
|
||||
}
|
||||
}
|
||||
|
||||
private string _currentTheme;
|
||||
|
||||
[DataMember]
|
||||
public string CurrentTheme
|
||||
{
|
||||
get { return _currentTheme; }
|
||||
set
|
||||
{
|
||||
if (_currentTheme == value)
|
||||
return;
|
||||
_currentTheme = value;
|
||||
}
|
||||
}
|
||||
|
||||
private double _photoOffsetX = 0;
|
||||
|
||||
[DataMember]
|
||||
public double PhotoOffsetX
|
||||
{
|
||||
get { return _photoOffsetX; }
|
||||
set
|
||||
{
|
||||
if (_photoOffsetX == value)
|
||||
return;
|
||||
_photoOffsetX = value;
|
||||
}
|
||||
}
|
||||
|
||||
private double _photoOffsetY = 0;
|
||||
|
||||
[DataMember]
|
||||
public double PhotoOffsetY
|
||||
{
|
||||
get { return _photoOffsetY; }
|
||||
set
|
||||
{
|
||||
if (_photoOffsetY == value)
|
||||
return;
|
||||
_photoOffsetY = value;
|
||||
}
|
||||
}
|
||||
|
||||
private double _photoScale = 1;
|
||||
|
||||
[DataMember]
|
||||
public double PhotoScale
|
||||
{
|
||||
get { return _photoScale; }
|
||||
set
|
||||
{
|
||||
if (_photoScale == value)
|
||||
return;
|
||||
_photoScale = value;
|
||||
}
|
||||
}
|
||||
|
||||
private double _photoAngle = 0;
|
||||
|
||||
[DataMember]
|
||||
public double PhotoAngle
|
||||
{
|
||||
get { return _photoAngle; }
|
||||
set
|
||||
{
|
||||
if (_photoAngle == value)
|
||||
return;
|
||||
_photoAngle = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isHeadingMagnetic = true;
|
||||
|
||||
[DataMember]
|
||||
public bool IsHeadingMagnetic
|
||||
{
|
||||
get { return _isHeadingMagnetic; }
|
||||
set
|
||||
{
|
||||
if (_isHeadingMagnetic == value)
|
||||
return;
|
||||
_isHeadingMagnetic = value;
|
||||
}
|
||||
}
|
||||
|
||||
private AppSettings()
|
||||
{
|
||||
}
|
||||
|
||||
private static AppSettings _instance;
|
||||
|
||||
public static AppSettings Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
{
|
||||
if (IsolatedStorageSettings.ApplicationSettings.Contains(APP_SETTINGS_KEY))
|
||||
_instance = IsolatedStorageSettings.ApplicationSettings[APP_SETTINGS_KEY] as AppSettings;
|
||||
else
|
||||
_instance = new AppSettings();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static object _lock = new object();
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (IsolatedStorageSettings.ApplicationSettings.Contains(APP_SETTINGS_KEY))
|
||||
{
|
||||
IsolatedStorageSettings.ApplicationSettings[APP_SETTINGS_KEY] = AppSettings.Instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsolatedStorageSettings.ApplicationSettings.Add(APP_SETTINGS_KEY, AppSettings.Instance);
|
||||
}
|
||||
IsolatedStorageSettings.ApplicationSettings.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Load()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (IsolatedStorageSettings.ApplicationSettings.Contains(APP_SETTINGS_KEY))
|
||||
_instance = IsolatedStorageSettings.ApplicationSettings[APP_SETTINGS_KEY] as AppSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace CompassVO.Model
|
||||
{
|
||||
public class Constants
|
||||
{
|
||||
public const string WEB_PAGE = "http://www.just-windows-phone.com";
|
||||
public const string WEB_PAGE_VO = "http://www.vorienteering.com";
|
||||
public const string JWP_SUPPORT_EMAIL = "justwindowsphone@gmail.com";
|
||||
|
||||
public const string FINAL_PHOTO_FILENAME = "selectedPhoto.jpg";
|
||||
public const string TEMP_PHOTO_FILENAME = "tempPhoto.jpg";
|
||||
public const string PHOTO_FOLDER = "photo";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using MicroIoc;
|
||||
|
||||
namespace CompassVO.Model
|
||||
{
|
||||
public sealed class Container
|
||||
{
|
||||
private Container()
|
||||
{
|
||||
}
|
||||
|
||||
public static IMicroIocContainer Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
return Nested.instance;
|
||||
}
|
||||
}
|
||||
|
||||
private class Nested
|
||||
{
|
||||
// Explicit static constructor to tell C# compiler
|
||||
// not to mark type as before field init
|
||||
static Nested()
|
||||
{
|
||||
}
|
||||
|
||||
internal static readonly IMicroIocContainer instance =
|
||||
new MicroIocContainer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompassVO.Model.Messages
|
||||
{
|
||||
public class CompassThemeChangedMessage
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompassVO.Model.Messages
|
||||
{
|
||||
public class LoadPhotoMessage
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompassVO.Model.Messages
|
||||
{
|
||||
public class RefreshAppBarMessage
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace CompassVO.Model.Messages
|
||||
{
|
||||
public class ShowCameraPreviewMessage
|
||||
{
|
||||
public bool ShowCamera { get; set; }
|
||||
|
||||
public ShowCameraPreviewMessage(bool showCamera)
|
||||
{
|
||||
ShowCamera = showCamera;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace CompassVO.Model.Messages
|
||||
{
|
||||
public class TakePhotoMessage
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace CompassVO.Model.Messages
|
||||
{
|
||||
public class UpdateCompassUIMessage
|
||||
{
|
||||
private UpdateCompassUIMessage()
|
||||
{
|
||||
}
|
||||
|
||||
public UpdateCompassUIMessage(double angle)
|
||||
{
|
||||
Angle = angle;
|
||||
}
|
||||
|
||||
public double Angle { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace CompassVO.Model
|
||||
{
|
||||
public enum OperationModeEnum
|
||||
{
|
||||
CompassMode,
|
||||
DialEdit,
|
||||
PhotoEdit
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
|
||||
namespace CompassVO.Model
|
||||
{
|
||||
public class QuitException : Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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,36 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
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("Compass VO")]
|
||||
[assembly: AssemblyDescription("Compass application for all users.")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Just Windows Phone")]
|
||||
[assembly: AssemblyProduct("Compass VO")]
|
||||
[assembly: AssemblyCopyright("Copyright © Just Windows Phone 2011")]
|
||||
[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("dd9d3d8f-4ce9-4b41-8a35-0cd127192ade")]
|
||||
|
||||
// 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.2.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en-US")]
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Deployment xmlns="http://schemas.microsoft.com/windowsphone/2012/deployment" AppPlatformVersion="8.0">
|
||||
<DefaultLanguage xmlns="" code="" />
|
||||
<App xmlns="" ProductID="{c1b722e3-2eda-45d7-b043-e97041552c56}" Title="Compass VO" RuntimeType="Silverlight" Version="1.2.0.0" Genre="apps.normal" Author="Just Windows Phone" Description="Compass application for all users." Publisher="Just Windows Phone" PublisherID="{47cd8814-8b38-4f7c-980e-9bb4631a0f4e}">
|
||||
<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_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" />
|
||||
<Capability Name="ID_CAP_ISV_CAMERA" />
|
||||
<Capability Name="ID_CAP_CONTACTS" />
|
||||
<Capability Name="ID_CAP_APPOINTMENTS" />
|
||||
<Capability Name="ID_CAP_MEDIALIB_AUDIO" />
|
||||
<Capability Name="ID_CAP_MEDIALIB_PHOTO" />
|
||||
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name="_default" NavigationPage="MainPage.xaml" />
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="CompassVOToken" TaskName="_default">
|
||||
<TemplateFlip>
|
||||
<SmallImageURI IsResource="false" IsRelative="true">Background.png</SmallImageURI>
|
||||
<Count>0</Count>
|
||||
<BackgroundImageURI IsResource="false" IsRelative="true">Background.png</BackgroundImageURI>
|
||||
<Title>Compass VO</Title>
|
||||
<BackContent></BackContent>
|
||||
<BackBackgroundImageURI></BackBackgroundImageURI>
|
||||
<BackTitle></BackTitle>
|
||||
<DeviceLockImageURI></DeviceLockImageURI>
|
||||
<HasLarge>false</HasLarge>
|
||||
</TemplateFlip>
|
||||
</PrimaryToken>
|
||||
</Tokens>
|
||||
<ScreenResolutions>
|
||||
<ScreenResolution Name="ID_RESOLUTION_WVGA" />
|
||||
<ScreenResolution Name="ID_RESOLUTION_WXGA" />
|
||||
<ScreenResolution Name="ID_RESOLUTION_HD720P" />
|
||||
</ScreenResolutions>
|
||||
</App>
|
||||
</Deployment>
|
||||
@@ -0,0 +1,186 @@
|
||||
using CompassVO.Utils.Filters;
|
||||
using Microsoft.Devices.Sensors;
|
||||
using System;
|
||||
|
||||
namespace CompassVO.Service
|
||||
{
|
||||
public class CompassEx : IDisposable
|
||||
{
|
||||
private Compass _compass;
|
||||
private bool _needsCalibration;
|
||||
private SimpleKalman filteredHeading = new SimpleKalman();
|
||||
|
||||
#region static Properties
|
||||
|
||||
private static bool isInit;
|
||||
private static bool _isSupported;
|
||||
|
||||
public static bool IsSupported
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!isInit)
|
||||
{
|
||||
_isSupported = Compass.IsSupported;
|
||||
isInit = true;
|
||||
}
|
||||
return _isSupported;
|
||||
}
|
||||
set { _isSupported = value; }
|
||||
}
|
||||
|
||||
#endregion static Properties
|
||||
|
||||
#region public properties
|
||||
|
||||
public TimeSpan TimeBetweenUpdates { get; set; }
|
||||
|
||||
private CompassReadingEx _currentValue = new CompassReadingEx();
|
||||
|
||||
public CompassReadingEx CurrentValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentValue;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDataValid
|
||||
{
|
||||
get { return _compass != null ? _compass.IsDataValid : false; }
|
||||
}
|
||||
|
||||
#endregion public properties
|
||||
|
||||
#region public events
|
||||
|
||||
public event System.EventHandler<CalibrationEventArgs> Calibrate;
|
||||
|
||||
public event System.EventHandler<CalibrationEventArgs> Calibrated;
|
||||
|
||||
public event System.EventHandler<SensorReadingEventArgs<CompassReadingEx>> CurrentValueChanged;
|
||||
|
||||
#endregion public events
|
||||
|
||||
public CompassEx()
|
||||
{
|
||||
_compass = new Compass();
|
||||
_compass.Calibrate += new EventHandler<CalibrationEventArgs>(_compass_Calibrate);
|
||||
_compass.CurrentValueChanged += new EventHandler<SensorReadingEventArgs<CompassReading>>(_compass_CurrentValueChanged);
|
||||
}
|
||||
|
||||
private void _compass_CurrentValueChanged(object sender, SensorReadingEventArgs<CompassReading> e)
|
||||
{
|
||||
if (_needsCalibration && e.SensorReading.HeadingAccuracy <= 20)
|
||||
{
|
||||
_needsCalibration = false;
|
||||
Calibrated?.Invoke(sender, new CalibrationEventArgs());
|
||||
}
|
||||
|
||||
if (_compass != null)
|
||||
{
|
||||
ProcessCurrentValue(e.SensorReading);
|
||||
}
|
||||
|
||||
if (CurrentValueChanged != null)
|
||||
{
|
||||
CurrentValueChanged(sender, new SensorReadingEventArgs<CompassReadingEx>() { SensorReading = CurrentValue });
|
||||
}
|
||||
}
|
||||
|
||||
private void _compass_Calibrate(object sender, CalibrationEventArgs e)
|
||||
{
|
||||
_needsCalibration = true;
|
||||
Calibrate?.Invoke(sender, e);
|
||||
}
|
||||
|
||||
private bool isFirstReading;
|
||||
private double md;
|
||||
|
||||
private void ProcessCurrentValue(CompassReading compassReading)
|
||||
{
|
||||
double newmd = compassReading.TrueHeading - compassReading.MagneticHeading;
|
||||
if (Math.Abs(newmd) < 45)
|
||||
{
|
||||
md = newmd;
|
||||
}
|
||||
|
||||
if (isFirstReading)
|
||||
{
|
||||
filteredHeading.init(compassReading.TrueHeading);
|
||||
isFirstReading = false;
|
||||
}
|
||||
|
||||
double currentFilter = filteredHeading.current();
|
||||
double currentRead = compassReading.TrueHeading - md;
|
||||
if (Math.Abs(currentRead - currentFilter) > 180)
|
||||
{
|
||||
if (currentRead > currentFilter)
|
||||
currentRead -= 360;
|
||||
else if (currentRead < currentFilter)
|
||||
currentRead += 360;
|
||||
|
||||
if (Math.Sign(currentRead) == Math.Sign(currentFilter))
|
||||
{
|
||||
if (currentRead < 0)
|
||||
{
|
||||
currentRead += 360;
|
||||
currentFilter += 360;
|
||||
filteredHeading.init(currentFilter);
|
||||
}
|
||||
else if (currentRead > 360 && currentFilter > 360)
|
||||
{
|
||||
currentRead -= 360;
|
||||
currentFilter -= 360;
|
||||
filteredHeading.init(currentFilter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
currentRead = filteredHeading.update(currentRead);
|
||||
currentRead = (currentRead + 360) % 360;
|
||||
double trueRead = ((currentRead + md) + 360) % 360;
|
||||
|
||||
_currentValue = new CompassReadingEx()
|
||||
{
|
||||
HeadingAccuracy = compassReading.HeadingAccuracy,
|
||||
TrueHeading = trueRead,
|
||||
MagneticHeading = currentRead,
|
||||
MagneticDeclination = md,
|
||||
MagnetometerReading = compassReading.MagnetometerReading,
|
||||
Timestamp = compassReading.Timestamp,
|
||||
MagneticCardinalDirection = CompassReadingEx.GetCardinalDirection(currentRead),
|
||||
TrueCardinalDirection = CompassReadingEx.GetCardinalDirection(trueRead)
|
||||
};
|
||||
}
|
||||
|
||||
#region public methods
|
||||
|
||||
public void Start()
|
||||
{
|
||||
if (IsSupported)
|
||||
{
|
||||
_compass.TimeBetweenUpdates = this.TimeBetweenUpdates;
|
||||
_compass.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (_compass != null)
|
||||
_compass.Stop();
|
||||
}
|
||||
|
||||
#endregion public methods
|
||||
|
||||
#region Implementation of IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_compass != null)
|
||||
_compass.Dispose();
|
||||
}
|
||||
|
||||
#endregion Implementation of IDisposable
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
using Microsoft.Devices.Sensors;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace CompassVO.Service
|
||||
{
|
||||
public struct CompassReadingEx : ISensorReading
|
||||
{
|
||||
public DateTimeOffset Timestamp
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public double HeadingAccuracy
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public double TrueHeading
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public Vector3 MagnetometerReading
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public double MagneticHeading
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public double MagneticDeclination
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public CardinalDirection MagneticCardinalDirection
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public CardinalDirection TrueCardinalDirection
|
||||
{
|
||||
get;
|
||||
internal set;
|
||||
}
|
||||
|
||||
public static CardinalDirection GetCardinalDirection(double angle)
|
||||
{
|
||||
angle = angle % 360;
|
||||
if (angle < 22.5 || angle >= 337.5)
|
||||
{
|
||||
return CardinalDirection.N;
|
||||
}
|
||||
if (angle >= 22.5 && angle < 67.5)
|
||||
{
|
||||
return CardinalDirection.NE;
|
||||
}
|
||||
if (angle >= 67.5 && angle < 112.5)
|
||||
{
|
||||
return CardinalDirection.E;
|
||||
}
|
||||
if (angle >= 112.5 && angle < 157.5)
|
||||
{
|
||||
return CardinalDirection.SE;
|
||||
}
|
||||
if (angle >= 157.5 && angle < 202.5)
|
||||
{
|
||||
return CardinalDirection.S;
|
||||
}
|
||||
if (angle >= 202.5 && angle < 247.5)
|
||||
{
|
||||
return CardinalDirection.SW;
|
||||
}
|
||||
if (angle >= 247.5 && angle < 292.5)
|
||||
{
|
||||
return CardinalDirection.W;
|
||||
}
|
||||
if (angle >= 292.5 && angle < 337.5)
|
||||
{
|
||||
return CardinalDirection.NW;
|
||||
}
|
||||
return CardinalDirection.Unknow;
|
||||
}
|
||||
}
|
||||
|
||||
public enum CardinalDirection
|
||||
{
|
||||
Unknow,
|
||||
N,
|
||||
S,
|
||||
E,
|
||||
W,
|
||||
NE,
|
||||
SE,
|
||||
NW,
|
||||
SW
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using CompassVO.Themes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
|
||||
namespace CompassVO.Service
|
||||
{
|
||||
public class CompassThemeController
|
||||
{
|
||||
private static CompassThemeController _instance;
|
||||
|
||||
public static CompassThemeController Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_instance == null)
|
||||
_instance = new CompassThemeController();
|
||||
return _instance;
|
||||
}
|
||||
}
|
||||
|
||||
private List<ICompassTheme> _allThemes;
|
||||
|
||||
public List<ICompassTheme> GetAllThemes()
|
||||
{
|
||||
if (_allThemes == null)
|
||||
{
|
||||
_allThemes = new List<ICompassTheme>();
|
||||
foreach (Type appType in Assembly.GetExecutingAssembly().GetTypes())
|
||||
{
|
||||
if (appType != typeof(ICompassTheme) && appType.GetInterface(typeof(ICompassTheme).FullName, false) != null)
|
||||
{
|
||||
_allThemes.Add((ICompassTheme)Activator.CreateInstance(appType));
|
||||
}
|
||||
}
|
||||
_allThemes.Sort((a, b) => { return a.Order.CompareTo(b.Order); });
|
||||
}
|
||||
|
||||
return _allThemes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace CompassVO.Service.Navigation
|
||||
{
|
||||
public interface INavigationService
|
||||
{
|
||||
event NavigatingCancelEventHandler Navigating;
|
||||
|
||||
object CurrentContext { get; }
|
||||
|
||||
void NavigateTo(Uri pageUri);
|
||||
|
||||
void NavigateTo(Uri pageUri, object context);
|
||||
|
||||
void GoBack();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using Microsoft.Phone.Controls;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
|
||||
namespace CompassVO.Service.Navigation
|
||||
{
|
||||
public class NavigationService : INavigationService
|
||||
{
|
||||
private PhoneApplicationFrame mainFrame;
|
||||
|
||||
private bool EnsureMainFrame()
|
||||
{
|
||||
if (mainFrame != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
mainFrame = Application.Current.RootVisual as PhoneApplicationFrame;
|
||||
if (mainFrame != null)
|
||||
{
|
||||
// Could be null if the app runs inside a design tool
|
||||
mainFrame.Navigating += (s, e) =>
|
||||
{
|
||||
if (Navigating != null)
|
||||
{
|
||||
Navigating(s, e);
|
||||
}
|
||||
};
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#region INavigationService implementation
|
||||
|
||||
public event NavigatingCancelEventHandler Navigating;
|
||||
|
||||
private object currentContext;
|
||||
|
||||
public object CurrentContext
|
||||
{
|
||||
get { return this.currentContext; }
|
||||
}
|
||||
|
||||
public void NavigateTo(Uri pageUri)
|
||||
{
|
||||
if (pageUri == null)
|
||||
throw new ArgumentNullException("uri");
|
||||
if (EnsureMainFrame())
|
||||
this.NavigateTo(pageUri, null);
|
||||
}
|
||||
|
||||
public void NavigateTo(Uri pageUri, object context)
|
||||
{
|
||||
if (pageUri == null)
|
||||
throw new ArgumentNullException("uri");
|
||||
if (EnsureMainFrame())
|
||||
{
|
||||
this.currentContext = context;
|
||||
mainFrame.Navigate(pageUri);
|
||||
}
|
||||
}
|
||||
|
||||
public void GoBack()
|
||||
{
|
||||
if (EnsureMainFrame() && mainFrame.CanGoBack)
|
||||
{
|
||||
try
|
||||
{
|
||||
mainFrame.GoBack();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion INavigationService implementation
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<phone:PhoneApplicationPage xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
|
||||
x:Class="CompassVO.SettingsPage"
|
||||
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:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 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"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}"
|
||||
Loaded="PhoneApplicationPage_Loaded">
|
||||
|
||||
<!--LayoutRoot is the root grid where all page content is placed-->
|
||||
<Grid x:Name="LayoutRoot"
|
||||
Background="Transparent">
|
||||
<!--Pivot Control-->
|
||||
<controls:Pivot Title="Compass VO"
|
||||
Margin="0">
|
||||
<!--Pivot item one-->
|
||||
<controls:PivotItem Header="theme">
|
||||
<Grid>
|
||||
|
||||
<telerikPrimitives:RadDataBoundListBox ItemsSource="{Binding Themes, Mode=OneWay}"
|
||||
SelectedItem="{Binding CurrentTheme, Mode=TwoWay}"
|
||||
SelectionChanged="RadDataBoundListBox_SelectionChanged">
|
||||
<telerikPrimitives:RadDataBoundListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Margin="0, 0, 0, 12">
|
||||
<TextBlock
|
||||
Style="{StaticResource PhoneTextTitle2Style}"
|
||||
Text="{Binding ThemeName}" />
|
||||
<Button toolkit:TiltEffect.IsTiltEnabled="True"
|
||||
Margin="0"
|
||||
Padding="-12, -7, 0, 0"
|
||||
BorderThickness="1"
|
||||
Command="{Binding Main.ThemeSelectedCommand, Source={StaticResource Locator}}" CommandParameter="{Binding}">
|
||||
<Border BorderThickness="1" BorderBrush="Gray" Margin="12, 6, 0, 0">
|
||||
<Image Width="450" Height="150" Stretch="None" Source="{Binding ThemeImageUrl}" />
|
||||
</Border>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</telerikPrimitives:RadDataBoundListBox.ItemTemplate>
|
||||
</telerikPrimitives:RadDataBoundListBox>
|
||||
</Grid>
|
||||
</controls:PivotItem>
|
||||
|
||||
<!--Pivot item two-->
|
||||
<controls:PivotItem Header="customize">
|
||||
<Grid>
|
||||
<StackPanel Margin="0, 0, 0, 12">
|
||||
<toolkit:ToggleSwitch Header="Compass Heading"
|
||||
IsChecked="{Binding IsHeadingMagnetic, Mode=TwoWay}"
|
||||
Content="{Binding IsHeadingMagnetic, Converter={StaticResource ConditionalTextConverter}, ConverterParameter='Magnetic North|Geographic North'}"></toolkit:ToggleSwitch>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</controls:PivotItem>
|
||||
</controls:Pivot>
|
||||
</Grid>
|
||||
|
||||
<!--Sample code showing usage of ApplicationBar-->
|
||||
<!--<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
|
||||
<shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Images/appbar_button1.png" Text="Button 1" />
|
||||
<shell:ApplicationBarIconButton x:Name="appbar_button2" IconUri="/Images/appbar_button2.png" Text="Button 2" />
|
||||
<shell:ApplicationBar.MenuItems>
|
||||
<shell:ApplicationBarMenuItem x:Name="menuItem1" Text="MenuItem 1" />
|
||||
<shell:ApplicationBarMenuItem x:Name="menuItem2" Text="MenuItem 2" />
|
||||
</shell:ApplicationBar.MenuItems>
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>-->
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,27 @@
|
||||
using Microsoft.Phone.Controls;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CompassVO
|
||||
{
|
||||
public partial class SettingsPage : PhoneApplicationPage
|
||||
{
|
||||
private bool isPageLoaded;
|
||||
|
||||
public SettingsPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void RadDataBoundListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (isPageLoaded && NavigationService.CanGoBack)
|
||||
NavigationService.GoBack();
|
||||
}
|
||||
|
||||
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
isPageLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1,70 @@
|
||||
using CompassVO.Model.Messages;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace CompassVO.Themes
|
||||
{
|
||||
public static class CompassUiUtil
|
||||
{
|
||||
private static Storyboard sb;
|
||||
public static RotateTransform needleRotation;
|
||||
private static UserControl CompassUi;
|
||||
|
||||
public static void UpdateCompassUI(UpdateCompassUIMessage res, UserControl compassUi)
|
||||
{
|
||||
UpdateUI(res.Angle, compassUi);
|
||||
}
|
||||
|
||||
private static void SetControl(UserControl compassUi)
|
||||
{
|
||||
CompassUi = compassUi;
|
||||
needleRotation = compassUi.FindName("needleRotation") as RotateTransform;
|
||||
}
|
||||
|
||||
public static void UpdateUI(double angle, UserControl compassUi)
|
||||
{
|
||||
SetControl(compassUi);
|
||||
|
||||
if (sb != null)
|
||||
sb.SkipToFill();
|
||||
|
||||
double newAngle = angle;
|
||||
needleRotation.Angle = needleRotation.Angle % 360;
|
||||
double diff = newAngle - needleRotation.Angle;
|
||||
if (Math.Abs(diff) > 180)
|
||||
newAngle += -Math.Sign(diff) * 360;
|
||||
sb = StoryBoardEffect(newAngle, 50);
|
||||
sb.Begin();
|
||||
}
|
||||
|
||||
#region StoryBoard
|
||||
|
||||
private static Storyboard StoryBoardEffect(double needleRotationAngle, int miliseconds)
|
||||
{
|
||||
//add new storyboard and animation
|
||||
Storyboard sb = new Storyboard();
|
||||
if (needleRotation != null)
|
||||
{
|
||||
#region ellipse width
|
||||
|
||||
DoubleAnimation daNeedle = new DoubleAnimation
|
||||
{
|
||||
To = needleRotationAngle,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(miliseconds))
|
||||
};
|
||||
Storyboard.SetTarget(daNeedle, needleRotation);
|
||||
PropertyPath myPropertyPath = new PropertyPath(RotateTransform.AngleProperty);
|
||||
Storyboard.SetTargetProperty(daNeedle, myPropertyPath);
|
||||
sb.Children.Add(daNeedle);
|
||||
|
||||
#endregion ellipse width
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
#endregion StoryBoard
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Controls="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls"
|
||||
xmlns:Logging="clr-namespace:CompassVO.Utils.Logging">
|
||||
|
||||
<Style TargetType="Logging:ExceptionPrompt">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Logging:ExceptionPrompt">
|
||||
<Grid>
|
||||
<Rectangle Fill="Transparent" />
|
||||
<Border VerticalAlignment="Center"
|
||||
Width="460"
|
||||
Height="390"
|
||||
Background="{StaticResource PhoneChromeBrush}"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{StaticResource PhoneForegroundBrush}">
|
||||
|
||||
<Grid Width="450"
|
||||
Height="380"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Grid.Row="0"
|
||||
Text="The program has encountered a problem and needs to close. We are sorry for the inconvenience."
|
||||
TextWrapping="Wrap"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="5"
|
||||
Style="{StaticResource PhoneTextNormalStyle}" />
|
||||
<TextBlock Grid.Row="1"
|
||||
Text="We have created an error report that you can send to the developers."
|
||||
TextWrapping="Wrap"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="5,10,5,5"
|
||||
Style="{StaticResource PhoneTextNormalStyle}" />
|
||||
|
||||
<CheckBox Content="Email report to developer"
|
||||
Grid.Row="2"
|
||||
x:Name="canSubmitCheckBox" />
|
||||
<Controls:RoundButton x:Name="okButton"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalAlignment="Center"
|
||||
Grid.Row="3" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CompassVO.Themes
|
||||
{
|
||||
public interface ICompassTheme
|
||||
{
|
||||
string ThemeName { get; }
|
||||
string ThemeImageUrl { get; }
|
||||
Color BackgroundColor { get; }
|
||||
Color ForegroundColor { get; }
|
||||
int Order { get; }
|
||||
|
||||
bool SupportsDialRotation { get; }
|
||||
bool SupportsBackgroundImages { get; }
|
||||
bool SupportsTargets { get; }
|
||||
Type UIcomponent { get; }
|
||||
|
||||
double GetAngle(Point point);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<UserControl x:Class="CompassVO.Themes.compass_cardinal.compass_cardinal_UI"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="480"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}">
|
||||
|
||||
<Grid x:Name="LayoutRoot"
|
||||
Background="Transparent">
|
||||
<StackPanel Margin="0, 24, 0, 0"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
HorizontalAlignment="Center">magnetic heading:</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
Text="{Binding Path=MagneticHeading, Mode=OneWay, StringFormat='0'}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 0, 0, 0" />
|
||||
<TextBlock>°</TextBlock>
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
Margin="6, 0, 0, 0"
|
||||
Text="{Binding Path=MagneticCardinalDirection, Mode=OneWay}"
|
||||
HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
HorizontalAlignment="Center">true heading:</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
Text="{Binding Path=TrueHeading, Mode=OneWay, StringFormat='0'}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 0, 0, 0" />
|
||||
<TextBlock>°</TextBlock>
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
Margin="6, 0, 0, 0"
|
||||
Text="{Binding Path=TrueCardinalDirection, Mode=OneWay}"
|
||||
HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
HorizontalAlignment="Center">magnetic declination:</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
Text="{Binding Path=MagneticDeclination, Mode=OneWay, StringFormat='0'}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 0, 0, 0" />
|
||||
<TextBlock>°</TextBlock>
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
HorizontalAlignment="Center">accuracy:</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock Style="{StaticResource PhoneTextTitle3Style}"
|
||||
Text="{Binding Path=HeadingAccuracy, Mode=OneWay, StringFormat='0'}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 0, 0, 0" />
|
||||
<TextBlock>°</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Grid HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Width="410"
|
||||
Height="410"
|
||||
Margin="0,290,0,0.3"
|
||||
Opacity="1">
|
||||
<Image Height="410"
|
||||
x:Name="imgCompass"
|
||||
Stretch="UniformToFill"
|
||||
Width="410"
|
||||
Source="images\compass_old_needle.png"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
CacheMode="BitmapCache">
|
||||
<Image.RenderTransform>
|
||||
<RotateTransform x:Name="needleRotation" Angle="0"
|
||||
CenterX="205"
|
||||
CenterY="205" />
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,22 @@
|
||||
using CompassVO.Model.Messages;
|
||||
using CompassVO.Utils;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace CompassVO.Themes.compass_cardinal
|
||||
{
|
||||
public partial class compass_cardinal_UI : UserControl
|
||||
{
|
||||
public compass_cardinal_UI()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
imgCompass.Source = new BitmapImage(new Uri(PhoneThemeDetect.IsDarkTheme() ? @"images\compass_old_needle.png" : @"images\compass_old_needle_light.png", UriKind.Relative));
|
||||
|
||||
CompassUiUtil.UpdateUI(0, this);
|
||||
Messenger.Default.Register<UpdateCompassUIMessage>(this, (res) => CompassUiUtil.UpdateCompassUI(res, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,88 @@
|
||||
using CompassVO.Utils;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CompassVO.Themes.compass_cardinal
|
||||
{
|
||||
public class theme_compass_cardinal : ICompassTheme
|
||||
{
|
||||
public theme_compass_cardinal()
|
||||
{
|
||||
}
|
||||
|
||||
#region Implementation of ICompassTheme
|
||||
|
||||
public Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhoneThemeDetect.IsDarkTheme() ? PhoneThemeDetect.DarkThemeBackground : PhoneThemeDetect.LightThemeBackground;
|
||||
}
|
||||
}
|
||||
|
||||
public Color ForegroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhoneThemeDetect.IsDarkTheme() ? PhoneThemeDetect.LightThemeBackground : PhoneThemeDetect.DarkThemeBackground;
|
||||
}
|
||||
}
|
||||
|
||||
public int Order
|
||||
{
|
||||
get { return 2; }
|
||||
}
|
||||
|
||||
public bool SupportsDialRotation
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool SupportsBackgroundImages
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsTargets
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Type UIcomponent
|
||||
{
|
||||
get { return typeof(compass_cardinal_UI); }
|
||||
}
|
||||
|
||||
private Point needleCenter = new Point(240, 295);
|
||||
|
||||
public double GetAngle(Point point)
|
||||
{
|
||||
return Angle(needleCenter, point);
|
||||
}
|
||||
|
||||
private const double Rad2Deg = 180.0 / Math.PI;
|
||||
private const double Deg2Rad = Math.PI / 180.0;
|
||||
|
||||
private double Angle(Point start, Point end)
|
||||
{
|
||||
return Math.Atan2(start.Y - end.Y, end.X - start.X) * Rad2Deg;
|
||||
}
|
||||
|
||||
#endregion Implementation of ICompassTheme
|
||||
|
||||
#region ICompassTheme Members
|
||||
|
||||
public string ThemeName
|
||||
{
|
||||
get { return "Cardinal rose"; }
|
||||
}
|
||||
|
||||
public string ThemeImageUrl
|
||||
{
|
||||
get { return "/Themes/compass_cardinal/images/sample_old.png"; }
|
||||
}
|
||||
|
||||
#endregion ICompassTheme Members
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
<UserControl x:Class="CompassVO.Themes.compass_digital.compass_digital_UI"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="480"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="textDigital"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Margin"
|
||||
Value="0,12,0,0" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="FontSize"
|
||||
Value="68" />
|
||||
<Setter Property="FontFamily"
|
||||
Value="{StaticResource Digital}" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid x:Name="LayoutRoot"
|
||||
Background="Transparent">
|
||||
|
||||
<Grid HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Width="416"
|
||||
Height="416"
|
||||
Margin="0,200,0,0.3"
|
||||
Opacity="1">
|
||||
<Image Height="416"
|
||||
x:Name="imgDial"
|
||||
Stretch="None"
|
||||
Width="416"
|
||||
Source="images\compass_digital_dial.png"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
CacheMode="BitmapCache">
|
||||
<Image.RenderTransform>
|
||||
<RotateTransform Angle="{Binding DialAngle, Mode=OneWay}"
|
||||
CenterX="208"
|
||||
CenterY="208" />
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image Height="410"
|
||||
x:Name="imgCompass"
|
||||
Stretch="UniformToFill"
|
||||
Width="410"
|
||||
Source="images\compass_digital_needle.png"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
CacheMode="BitmapCache">
|
||||
<Image.RenderTransform>
|
||||
<RotateTransform x:Name="needleRotation"
|
||||
Angle="0"
|
||||
CenterX="205"
|
||||
CenterY="205" />
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<StackPanel Orientation="Vertical"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<TextBlock Margin="0, 0, 0, 0"
|
||||
Text="{Binding NeedleCardinalDirection, Mode=OneWay}"
|
||||
Style="{StaticResource textDigital}"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}"
|
||||
HorizontalAlignment="Center" />
|
||||
<StackPanel Orientation="Horizontal"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding NeedleAngle, Mode=OneWay, StringFormat='0'}"
|
||||
Style="{StaticResource textDigital}"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}" />
|
||||
<TextBlock Style="{StaticResource textDigital}"
|
||||
Margin="0, 0, 0, 0"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}">°</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Grid Width="120"
|
||||
Height="92"
|
||||
Visibility="{Binding IsDialEditManipulation, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 90, 0, 0">
|
||||
<Border Background="#A5C463"
|
||||
BorderBrush="#505050" BorderThickness="2" CornerRadius="4">
|
||||
<Grid Margin="0">
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="#505050"
|
||||
Style="{StaticResource textDigital}"
|
||||
FontSize="48"
|
||||
Text="{Binding DialAngleHeading, Mode=OneWay, StringFormat='0'}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,16 @@
|
||||
using CompassVO.Model.Messages;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CompassVO.Themes.compass_digital
|
||||
{
|
||||
public partial class compass_digital_UI : UserControl
|
||||
{
|
||||
public compass_digital_UI()
|
||||
{
|
||||
InitializeComponent();
|
||||
CompassUiUtil.UpdateUI(0, this);
|
||||
Messenger.Default.Register<UpdateCompassUIMessage>(this, (res) => CompassUiUtil.UpdateCompassUI(res, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 29 KiB |
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CompassVO.Themes.compass_digital
|
||||
{
|
||||
public class theme_compass_digital : ICompassTheme
|
||||
{
|
||||
public theme_compass_digital()
|
||||
{
|
||||
}
|
||||
|
||||
#region Implementation of ICompassTheme
|
||||
|
||||
public Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Colors.LightGray;
|
||||
}
|
||||
}
|
||||
|
||||
public Color ForegroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Color.FromArgb(255, 80, 80, 80);
|
||||
}
|
||||
}
|
||||
|
||||
public int Order
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
public bool SupportsDialRotation
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsBackgroundImages
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsTargets
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Type UIcomponent
|
||||
{
|
||||
get { return typeof(compass_digital_UI); }
|
||||
}
|
||||
|
||||
private Point needleCenter = new Point(240, 408);
|
||||
|
||||
public double GetAngle(Point point)
|
||||
{
|
||||
return Angle(needleCenter, point);
|
||||
}
|
||||
|
||||
private const double Rad2Deg = 180.0 / Math.PI;
|
||||
private const double Deg2Rad = Math.PI / 180.0;
|
||||
|
||||
private double Angle(Point start, Point end)
|
||||
{
|
||||
return Math.Atan2(start.Y - end.Y, end.X - start.X) * Rad2Deg;
|
||||
}
|
||||
|
||||
#endregion Implementation of ICompassTheme
|
||||
|
||||
#region ICompassTheme Members
|
||||
|
||||
public string ThemeName
|
||||
{
|
||||
get { return "Digital"; }
|
||||
}
|
||||
|
||||
public string ThemeImageUrl
|
||||
{
|
||||
get { return "/Themes/compass_digital/images/sample_digital.png"; }
|
||||
}
|
||||
|
||||
#endregion ICompassTheme Members
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<UserControl x:Class="CompassVO.Themes.compass_orienteering.compass_metro_graphic_UI"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="480"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="textMetroGraphic"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Foreground"
|
||||
Value="{StaticResource PhoneAccentColor}" />
|
||||
<Setter Property="Margin"
|
||||
Value="0,12,0,0" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="FontSize"
|
||||
Value="28" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid x:Name="LayoutRoot"
|
||||
Background="Transparent">
|
||||
<StackPanel Orientation="Vertical"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 100, 0, 0">
|
||||
<TextBlock Style="{StaticResource textMetroGraphic}">compass heading</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock Text="{Binding NeedleAngle, Mode=OneWay, StringFormat='0'}"
|
||||
Style="{StaticResource textMetroGraphic}" />
|
||||
<TextBlock Style="{StaticResource textMetroGraphic}" Margin="0, 12, 0, 0">°</TextBlock>
|
||||
<TextBlock Margin="12, 12, 0, 0"
|
||||
Text="{Binding NeedleCardinalDirection, Mode=OneWay}"
|
||||
Style="{StaticResource textMetroGraphic}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Grid HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Width="410"
|
||||
Height="410"
|
||||
Margin="0,280,0,0.3"
|
||||
Opacity="1">
|
||||
<Canvas Height="410"
|
||||
x:Name="needleCompass"
|
||||
Width="410"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
CacheMode="BitmapCache">
|
||||
<Canvas.RenderTransform>
|
||||
<RotateTransform x:Name="needleRotation" Angle="0"
|
||||
CenterX="205"
|
||||
CenterY="205" />
|
||||
</Canvas.RenderTransform>
|
||||
<Ellipse StrokeThickness="2"
|
||||
Stroke="{StaticResource PhoneAccentBrush}"
|
||||
Width="410"
|
||||
Height="410" />
|
||||
<Line Canvas.Left="205"
|
||||
Canvas.Top="205"
|
||||
Stroke="{StaticResource PhoneAccentBrush}"
|
||||
StrokeThickness="2"
|
||||
X1="0"
|
||||
Y1="0"
|
||||
X2="0"
|
||||
Y2="-170" />
|
||||
<TextBlock Canvas.Top="4"
|
||||
Canvas.Left="197"
|
||||
Foreground="{StaticResource PhoneAccentBrush}"
|
||||
FontWeight="Bold">N</TextBlock>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,16 @@
|
||||
using CompassVO.Model.Messages;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CompassVO.Themes.compass_orienteering
|
||||
{
|
||||
public partial class compass_metro_graphic_UI : UserControl
|
||||
{
|
||||
public compass_metro_graphic_UI()
|
||||
{
|
||||
InitializeComponent();
|
||||
CompassUiUtil.UpdateUI(0, this);
|
||||
Messenger.Default.Register<UpdateCompassUIMessage>(this, (res) => CompassUiUtil.UpdateCompassUI(res, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,89 @@
|
||||
using CompassVO.Themes.compass_orienteering;
|
||||
using CompassVO.Utils;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CompassVO.Themes.compass_metro_graphic
|
||||
{
|
||||
public class theme_compass_metro_graphic : ICompassTheme
|
||||
{
|
||||
public theme_compass_metro_graphic()
|
||||
{
|
||||
}
|
||||
|
||||
#region Implementation of ICompassTheme
|
||||
|
||||
public Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhoneThemeDetect.IsDarkTheme() ? PhoneThemeDetect.DarkThemeBackground : PhoneThemeDetect.LightThemeBackground;
|
||||
}
|
||||
}
|
||||
|
||||
public Color ForegroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return PhoneThemeDetect.IsDarkTheme() ? Color.FromArgb(255, 102, 204, 255) : Colors.Red;
|
||||
}
|
||||
}
|
||||
|
||||
public int Order
|
||||
{
|
||||
get { return 3; }
|
||||
}
|
||||
|
||||
public bool SupportsDialRotation
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool SupportsBackgroundImages
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsTargets
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Type UIcomponent
|
||||
{
|
||||
get { return typeof(compass_metro_graphic_UI); }
|
||||
}
|
||||
|
||||
private Point needleCenter = new Point(240, 500);
|
||||
|
||||
public double GetAngle(Point point)
|
||||
{
|
||||
return Angle(needleCenter, point);
|
||||
}
|
||||
|
||||
private const double Rad2Deg = 180.0 / Math.PI;
|
||||
private const double Deg2Rad = Math.PI / 180.0;
|
||||
|
||||
private double Angle(Point start, Point end)
|
||||
{
|
||||
return Math.Atan2(start.Y - end.Y, end.X - start.X) * Rad2Deg;
|
||||
}
|
||||
|
||||
#endregion Implementation of ICompassTheme
|
||||
|
||||
#region ICompassTheme Members
|
||||
|
||||
public string ThemeName
|
||||
{
|
||||
get { return "Metro graphic"; }
|
||||
}
|
||||
|
||||
public string ThemeImageUrl
|
||||
{
|
||||
get { return "/Themes/compass_metro_graphic/images/sample_metro_graphic.png"; }
|
||||
}
|
||||
|
||||
#endregion ICompassTheme Members
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<UserControl x:Class="CompassVO.Themes.compass_night.compass_night_UI"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="480"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="textNightGraphic"
|
||||
TargetType="TextBlock">
|
||||
<Setter Property="Margin"
|
||||
Value="0,12,0,0" />
|
||||
<Setter Property="HorizontalAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="FontSize"
|
||||
Value="42" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid x:Name="LayoutRoot"
|
||||
Background="Transparent">
|
||||
<StackPanel Orientation="Vertical"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 100, 0, 0">
|
||||
<TextBlock Style="{StaticResource textNightGraphic}"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}">compass heading</TextBlock>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<TextBlock Text="{Binding NeedleAngle, Mode=OneWay, StringFormat='0'}"
|
||||
Style="{StaticResource textNightGraphic}"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}" />
|
||||
<TextBlock Style="{StaticResource textNightGraphic}" Margin="0, 12, 0, 0"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}"
|
||||
>°</TextBlock>
|
||||
<TextBlock Margin="12, 12, 0, 0"
|
||||
Text="{Binding NeedleCardinalDirection, Mode=OneWay}"
|
||||
Style="{StaticResource textNightGraphic}"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Grid HorizontalAlignment="Center"
|
||||
VerticalAlignment="Top"
|
||||
Width="410"
|
||||
Height="410"
|
||||
Margin="0,280,0,0.3"
|
||||
Opacity="1">
|
||||
<Canvas Height="410"
|
||||
x:Name="needleCompass"
|
||||
Width="410"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
CacheMode="BitmapCache">
|
||||
<Canvas.RenderTransform>
|
||||
<RotateTransform x:Name="needleRotation" Angle="0"
|
||||
CenterX="205"
|
||||
CenterY="205" />
|
||||
</Canvas.RenderTransform>
|
||||
<Ellipse StrokeThickness="2"
|
||||
Stroke="{Binding CurrentThemeForegroundColor}"
|
||||
Width="410"
|
||||
Height="410" />
|
||||
<Line Canvas.Left="205"
|
||||
Canvas.Top="205"
|
||||
Stroke="{Binding CurrentThemeForegroundColor}"
|
||||
StrokeThickness="2"
|
||||
X1="0"
|
||||
Y1="0"
|
||||
X2="0"
|
||||
Y2="-170" />
|
||||
<TextBlock Canvas.Top="4"
|
||||
Canvas.Left="197"
|
||||
Foreground="{Binding CurrentThemeForegroundColor}"
|
||||
FontWeight="Bold">N</TextBlock>
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,16 @@
|
||||
using CompassVO.Model.Messages;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CompassVO.Themes.compass_night
|
||||
{
|
||||
public partial class compass_night_UI : UserControl
|
||||
{
|
||||
public compass_night_UI()
|
||||
{
|
||||
InitializeComponent();
|
||||
CompassUiUtil.UpdateUI(0, this);
|
||||
Messenger.Default.Register<UpdateCompassUIMessage>(this, (res) => CompassUiUtil.UpdateCompassUI(res, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CompassVO.Themes.compass_night
|
||||
{
|
||||
public class theme_compass_night : ICompassTheme
|
||||
{
|
||||
public theme_compass_night()
|
||||
{
|
||||
}
|
||||
|
||||
#region Implementation of ICompassTheme
|
||||
|
||||
public Color BackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Colors.Black;
|
||||
}
|
||||
}
|
||||
|
||||
public Color ForegroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Color.FromArgb(255, 139, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public int Order
|
||||
{
|
||||
get { return 4; }
|
||||
}
|
||||
|
||||
public bool SupportsDialRotation
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool SupportsBackgroundImages
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsTargets
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Type UIcomponent
|
||||
{
|
||||
get { return typeof(compass_night_UI); }
|
||||
}
|
||||
|
||||
private Point needleCenter = new Point(240, 500);
|
||||
|
||||
public double GetAngle(Point point)
|
||||
{
|
||||
return Angle(needleCenter, point);
|
||||
}
|
||||
|
||||
private const double Rad2Deg = 180.0 / Math.PI;
|
||||
private const double Deg2Rad = Math.PI / 180.0;
|
||||
|
||||
private double Angle(Point start, Point end)
|
||||
{
|
||||
return Math.Atan2(start.Y - end.Y, end.X - start.X) * Rad2Deg;
|
||||
}
|
||||
|
||||
#endregion Implementation of ICompassTheme
|
||||
|
||||
#region ICompassTheme Members
|
||||
|
||||
public string ThemeName
|
||||
{
|
||||
get { return "Night"; }
|
||||
}
|
||||
|
||||
public string ThemeImageUrl
|
||||
{
|
||||
get { return "/Themes/compass_night/images/sample_night.png"; }
|
||||
}
|
||||
|
||||
#endregion ICompassTheme Members
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<UserControl x:Class="CompassVO.Themes.compass_orienteering.compass_orienteering_UI"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="480"
|
||||
DataContext="{Binding Main, Source={StaticResource Locator}}">
|
||||
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Image Source="images/compass_orienteering_back.png"
|
||||
CacheMode="BitmapCache" />
|
||||
|
||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Top" Width="410" Height="410" Margin="0,300,0,0.3" Opacity="1">
|
||||
<Image Height="410"
|
||||
x:Name="imgDial"
|
||||
Stretch="None"
|
||||
Width="410"
|
||||
Source="images\compass_orienteering_dial.png"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
CacheMode="BitmapCache">
|
||||
<Image.RenderTransform>
|
||||
<RotateTransform Angle="{Binding DialAngle, Mode=OneWay}"
|
||||
CenterX="205"
|
||||
CenterY="205" />
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
<Image Height="410"
|
||||
x:Name="imgDialRotate"
|
||||
Stretch="None"
|
||||
Width="410"
|
||||
Source="images\compass_orienteering_rotate.png"
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding IsDialEdit, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
CacheMode="BitmapCache">
|
||||
</Image>
|
||||
<Image Height="302"
|
||||
x:Name="compassNeedle"
|
||||
Stretch="None"
|
||||
Width="38"
|
||||
Source="images\compass_orienteering_needle.png" Margin="0" VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||
CacheMode="BitmapCache">
|
||||
<Image.RenderTransform>
|
||||
<RotateTransform x:Name="needleRotation"
|
||||
Angle="0"
|
||||
CenterX="19"
|
||||
CenterY="151" />
|
||||
</Image.RenderTransform>
|
||||
</Image>
|
||||
</Grid>
|
||||
|
||||
<Grid Width="100"
|
||||
Height="72"
|
||||
Visibility="{Binding IsDialEditManipulation, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0, 200, 0, 0">
|
||||
<Border Background="DarkRed">
|
||||
<Grid>
|
||||
<TextBlock HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
FontWeight="Bold"
|
||||
FontSize="36"
|
||||
Text="{Binding DialAngleHeading, Mode=OneWay, StringFormat='0'}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,24 @@
|
||||
using CompassVO.Model.Messages;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CompassVO.Themes.compass_orienteering
|
||||
{
|
||||
public partial class compass_orienteering_UI : UserControl, INotifyPropertyChanged
|
||||
{
|
||||
public compass_orienteering_UI()
|
||||
{
|
||||
this.DataContext = this;
|
||||
InitializeComponent();
|
||||
CompassUiUtil.UpdateUI(0, this);
|
||||
Messenger.Default.Register<UpdateCompassUIMessage>(this, (res) => CompassUiUtil.UpdateCompassUI(res, this));
|
||||
}
|
||||
|
||||
#region Implementation of INotifyPropertyChanged
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
#endregion Implementation of INotifyPropertyChanged
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CompassVO.Themes.compass_orienteering
|
||||
{
|
||||
public class theme_compass_orienteering : ICompassTheme
|
||||
{
|
||||
public theme_compass_orienteering()
|
||||
{
|
||||
}
|
||||
|
||||
#region Implementation of ICompassTheme
|
||||
|
||||
public Color BackgroundColor
|
||||
{
|
||||
get { return Colors.White; }
|
||||
}
|
||||
|
||||
public Color ForegroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return Colors.Black;
|
||||
}
|
||||
}
|
||||
|
||||
public int Order
|
||||
{
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public bool SupportsDialRotation
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsBackgroundImages
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool SupportsTargets
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public Type UIcomponent
|
||||
{
|
||||
get { return typeof(compass_orienteering_UI); }
|
||||
}
|
||||
|
||||
private Point needleCenter = new Point(240, 500);
|
||||
|
||||
public double GetAngle(Point point)
|
||||
{
|
||||
return Angle(needleCenter, point);
|
||||
}
|
||||
|
||||
private const double Rad2Deg = 180.0 / Math.PI;
|
||||
private const double Deg2Rad = Math.PI / 180.0;
|
||||
|
||||
private double Angle(Point start, Point end)
|
||||
{
|
||||
return Math.Atan2(start.Y - end.Y, end.X - start.X) * Rad2Deg;
|
||||
}
|
||||
|
||||
#endregion Implementation of ICompassTheme
|
||||
|
||||
#region ICompassTheme Members
|
||||
|
||||
public string ThemeName
|
||||
{
|
||||
get { return "Orienteering"; }
|
||||
}
|
||||
|
||||
public string ThemeImageUrl
|
||||
{
|
||||
get { return "/Themes/compass_orienteering/images/sample_orienteering.png"; }
|
||||
}
|
||||
|
||||
#endregion ICompassTheme Members
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 414 B |
|
After Width: | Height: | Size: 445 B |
|
After Width: | Height: | Size: 863 B |
@@ -0,0 +1,33 @@
|
||||
namespace CompassVO.Utils.Filters
|
||||
{
|
||||
public class SimpleKalman
|
||||
{
|
||||
private double Q = 0.0003;//0.000001;
|
||||
private double R = 0.01;//0.01;
|
||||
private double P = 1, X = 0, K = 0;
|
||||
|
||||
private void measurementUpdate()
|
||||
{
|
||||
K = (P + Q) / (P + Q + R);
|
||||
P = R * (P + Q) / (R + P + Q);
|
||||
}
|
||||
|
||||
public void init(double initX)
|
||||
{
|
||||
X = initX;
|
||||
}
|
||||
|
||||
public double update(double measurement)
|
||||
{
|
||||
measurementUpdate();
|
||||
double result = X + (measurement - X) * K;
|
||||
X = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
public double current()
|
||||
{
|
||||
return X;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
using Microsoft.Phone;
|
||||
using System.IO;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace CompassVO.Utils
|
||||
{
|
||||
public class IsolatedStorageHelper
|
||||
{
|
||||
public static void SaveToLocalStorage(string imageFileName, string imageFolder, byte[] content)
|
||||
{
|
||||
if (content == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
|
||||
if (!isoFile.DirectoryExists(imageFolder))
|
||||
{
|
||||
isoFile.CreateDirectory(imageFolder);
|
||||
}
|
||||
|
||||
string filePath = Path.Combine(imageFolder, imageFileName);
|
||||
using (var stream = isoFile.CreateFile(filePath))
|
||||
{
|
||||
stream.Write(content, 0, content.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public static WriteableBitmap LoadFromLocalStorage(string imageFileName, string imageFolder)
|
||||
{
|
||||
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
|
||||
if (!isoFile.DirectoryExists(imageFolder))
|
||||
{
|
||||
isoFile.CreateDirectory(imageFolder);
|
||||
}
|
||||
string filePath = Path.Combine(imageFolder, imageFileName);
|
||||
if (!isoFile.FileExists(filePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using (var imageStream = isoFile.OpenFile(filePath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
var imageSource = PictureDecoder.DecodeJpeg(imageStream);
|
||||
return imageSource;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] LoadFromLocalStorageArray(string imageFileName, string imageFolder)
|
||||
{
|
||||
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
|
||||
if (!isoFile.DirectoryExists(imageFolder))
|
||||
{
|
||||
isoFile.CreateDirectory(imageFolder);
|
||||
}
|
||||
string filePath = Path.Combine(imageFolder, imageFileName);
|
||||
if (!isoFile.FileExists(filePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using (var imageStream = isoFile.OpenFile(filePath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
byte[] buffer = new byte[imageStream.Length];
|
||||
imageStream.Read(buffer, 0, buffer.Length);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CopyFile(string fileSource, string fileDestination)
|
||||
{
|
||||
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
|
||||
if (!isoFile.FileExists(fileSource))
|
||||
{
|
||||
return;
|
||||
}
|
||||
using (var streamSource = isoFile.OpenFile(fileSource, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
using (var streamDestination = isoFile.CreateFile(fileDestination))
|
||||
{
|
||||
byte[] buffer = new byte[4096];
|
||||
int len = 0;
|
||||
while ((len = streamSource.Read(buffer, 0, buffer.Length)) > 0)
|
||||
{
|
||||
streamDestination.Write(buffer, 0, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DeleteFile(string fileSource)
|
||||
{
|
||||
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
|
||||
if (isoFile.FileExists(fileSource))
|
||||
{
|
||||
isoFile.DeleteFile(fileSource);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool FileExist(string fileSource)
|
||||
{
|
||||
var isoFile = IsolatedStorageFile.GetUserStoreForApplication();
|
||||
return isoFile.FileExists(fileSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using Coding4Fun.Phone.Controls;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CompassVO.Utils.Logging
|
||||
{
|
||||
public class ExceptionPrompt : PopUp<Exception, PopUpResult>
|
||||
{
|
||||
private Button okButton;
|
||||
private CheckBox submitCheckBox;
|
||||
private Exception exception;
|
||||
|
||||
public ExceptionPrompt()
|
||||
{
|
||||
DefaultStyleKey = typeof(ExceptionPrompt);
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
if (okButton != null)
|
||||
okButton.Click -= okButton_Click;
|
||||
|
||||
okButton = GetTemplateChild("okButton") as Button;
|
||||
submitCheckBox = GetTemplateChild("canSubmitCheckBox") as CheckBox;
|
||||
|
||||
if (okButton != null)
|
||||
okButton.Click += okButton_Click;
|
||||
}
|
||||
|
||||
public string To { get; set; }
|
||||
|
||||
private void okButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var message = new StringBuilder();
|
||||
message.Append("Exception type: ");
|
||||
message.Append(exception.GetType());
|
||||
message.Append(Environment.NewLine);
|
||||
message.Append("Message: ");
|
||||
message.Append(exception.Message);
|
||||
message.Append(Environment.NewLine);
|
||||
message.Append("Stack trace: ");
|
||||
message.Append(exception.StackTrace);
|
||||
message.ToString();
|
||||
|
||||
var task = new Microsoft.Phone.Tasks.EmailComposeTask { Body = message.ToString(), Subject = "Compass VO - Error Report", To = To };
|
||||
|
||||
if (submitCheckBox.IsChecked == true)
|
||||
{
|
||||
task.Show();
|
||||
}
|
||||
|
||||
OnCompleted(new PopUpEventArgs<Exception, PopUpResult> { PopUpResult = PopUpResult.Ok });
|
||||
}
|
||||
|
||||
public void Show(Exception exception)
|
||||
{
|
||||
App.CanExit = false;
|
||||
this.exception = exception;
|
||||
base.Show();
|
||||
}
|
||||
|
||||
public override void OnCompleted(PopUpEventArgs<Exception, PopUpResult> result)
|
||||
{
|
||||
App.CanExit = true;
|
||||
base.OnCompleted(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Audio;
|
||||
|
||||
namespace CompassVO.Utils
|
||||
{
|
||||
public class MediaHelper
|
||||
{
|
||||
public static void PlaySound(string soundFile)
|
||||
{
|
||||
using (var stream = TitleContainer.OpenStream(soundFile))
|
||||
{
|
||||
var effect = SoundEffect.FromStream(stream);
|
||||
FrameworkDispatcher.Update();
|
||||
effect.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace CompassVO.Utils
|
||||
{
|
||||
public class PhoneThemeDetect
|
||||
{
|
||||
public static Color LightThemeBackground = Color.FromArgb(255, 255, 255, 255);
|
||||
public static Color DarkThemeBackground = Color.FromArgb(255, 0, 0, 0);
|
||||
|
||||
public static bool IsDarkTheme()
|
||||
{
|
||||
SolidColorBrush backgroundBrush = Application.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush;
|
||||
return (backgroundBrush.Color == DarkThemeBackground);
|
||||
}
|
||||
|
||||
public static bool IsLightTheme()
|
||||
{
|
||||
SolidColorBrush backgroundBrush = Application.Current.Resources["PhoneBackgroundBrush"] as SolidColorBrush;
|
||||
return (backgroundBrush.Color == LightThemeBackground);
|
||||
}
|
||||
|
||||
public static Color AccentColor()
|
||||
{
|
||||
return (Color)Application.Current.Resources["PhoneAccentColor"];
|
||||
}
|
||||
|
||||
public static SolidColorBrush AccentBrush()
|
||||
{
|
||||
return Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using CompassVO.Model;
|
||||
using CompassVO.Service.Navigation;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace CompassVO.ViewModel
|
||||
{
|
||||
[DataContract]
|
||||
public class ViewModelBase : GalaSoft.MvvmLight.ViewModelBase
|
||||
{
|
||||
private object context;
|
||||
|
||||
public object Context
|
||||
{
|
||||
get { return context; }
|
||||
set
|
||||
{
|
||||
if (context == value)
|
||||
return;
|
||||
context = value;
|
||||
RaisePropertyChanged("Context");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets PageNavigation from Container
|
||||
/// </summary>
|
||||
public INavigationService NavigationService
|
||||
{
|
||||
get
|
||||
{
|
||||
INavigationService pageNav = (INavigationService)Container.Instance.Resolve(typeof(NavigationService), "NavigationService");
|
||||
return pageNav;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
In App.xaml:
|
||||
<Application.Resources>
|
||||
<vm:ViewModelLocatorTemplate xmlns:vm="clr-namespace:CompassVO"
|
||||
x:Key="Locator" />
|
||||
</Application.Resources>
|
||||
|
||||
In the View:
|
||||
DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}"
|
||||
|
||||
You can also use Blend to do all this with the tool's support.
|
||||
See http://www.galasoft.ch/mvvm
|
||||
*/
|
||||
|
||||
using CompassVO.Model;
|
||||
using CompassVO.Service.Navigation;
|
||||
|
||||
namespace CompassVO.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains static references to all the view models in the
|
||||
/// application and provides an entry point for the bindings.
|
||||
/// </summary>
|
||||
public class ViewModelLocator
|
||||
{
|
||||
private static MainViewModel _main;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ViewModelLocator class.
|
||||
/// </summary>
|
||||
public ViewModelLocator()
|
||||
{
|
||||
////if (ViewModelBase.IsInDesignModeStatic)
|
||||
////{
|
||||
//// // Create design time services and viewmodels
|
||||
////}
|
||||
////else
|
||||
////{
|
||||
//// // Create run time services and view models
|
||||
////}
|
||||
|
||||
_main = new MainViewModel();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Main property which defines the main viewmodel.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
|
||||
"CA1822:MarkMembersAsStatic",
|
||||
Justification = "This non-static member is needed for data binding purposes.")]
|
||||
public MainViewModel Main
|
||||
{
|
||||
get
|
||||
{
|
||||
return _main;
|
||||
}
|
||||
}
|
||||
|
||||
public void Cleanup()
|
||||
{
|
||||
if (Main != null)
|
||||
Main.Cleanup();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets PageNavigation from Container
|
||||
/// </summary>
|
||||
public INavigationService NavigationService
|
||||
{
|
||||
get
|
||||
{
|
||||
INavigationService pageNav = (INavigationService)Container.Instance.Resolve(typeof(NavigationService), "NavigationService");
|
||||
return pageNav;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<UserControl x:Class="CompassVO.Views.compass_calibration"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
d:DesignHeight="480"
|
||||
d:DesignWidth="480">
|
||||
|
||||
<Grid x:Name="LayoutRoot">
|
||||
<!--Calibration UI-->
|
||||
<StackPanel Name="calibrationStackPanel">
|
||||
<Image Source="/Images/calibrate_compass.png"
|
||||
Opacity=".95"
|
||||
HorizontalAlignment="Center" />
|
||||
<TextBlock FontSize="24" TextWrapping="Wrap"
|
||||
TextAlignment="Center">The compass on your device needs to be calibrated.
|
||||
Hold the device in front of you and sweep it through a figure 8 pattern as shown
|
||||
until the calibration is complete.</TextBlock>
|
||||
<StackPanel Orientation="Horizontal"
|
||||
Margin="0,24"
|
||||
HorizontalAlignment="Center">
|
||||
<TextBlock FontSize="24">heading accuracy:</TextBlock>
|
||||
<TextBlock Name="calibrationTextBlock"
|
||||
FontSize="24"
|
||||
Text="{Binding Path=HeadingAccuracy, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!--End Calibration UI-->
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace CompassVO.Views
|
||||
{
|
||||
public partial class compass_calibration : UserControl
|
||||
{
|
||||
public compass_calibration()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Phone.Controls.Toolkit" publicKeyToken="b772ad94eb9ca604" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Coding4Fun.Phone.Controls.Complete" version="1.4.6" />
|
||||
<package id="microioc" version="1.0" />
|
||||
<package id="MvvmLight" version="3.0.3" />
|
||||
<package id="SilverlightToolkitWP" version="4.2011.8.17" />
|
||||
</packages>
|
||||