Merge branch 'release/r#147' into develmaster

This commit is contained in:
stubbfel
2013-08-13 15:55:17 +02:00
16 changed files with 229 additions and 63 deletions

View File

@@ -141,8 +141,11 @@ namespace CampusAppWP8
private void LoadSettings()
{
this.UserSettingsLoaded();
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
thread.Start();
if (Settings.AppSetting.GeoWatchEnable)
{
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
thread.Start();
}
}
/// <summary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

@@ -104,6 +104,7 @@
<Compile Include="Feed\Mensa\MensaFeedCBSouth.cs" />
<Compile Include="Feed\Mensa\MensaFeedCBNorth.cs" />
<Compile Include="Feed\Mensa\MensaFeedCBMain.cs" />
<Compile Include="Model\Campusmap\CBMainMapModel.cs" />
<Compile Include="Model\GeoDb\PlaceModel.cs" />
<Compile Include="Model\GeoDb\SpsModel.cs" />
<Compile Include="Model\Mensa\MealModel.cs" />
@@ -358,6 +359,7 @@
<Content Include="Assets\ApplicationIcon.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\campusmap.png" />
<Content Include="Assets\Icons\DarkTheme\add_159.png" />
<Content Include="Assets\Icons\DarkTheme\btulogo_159.png" />
<Content Include="Assets\Icons\DarkTheme\campus_159.png" />
@@ -437,29 +439,10 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Reference Include="AsyncCtpLibrary_Phone">
<HintPath>..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\AsyncCtpLibrary_Phone.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
<Aliases>global</Aliases>
</Reference>
<Reference Include="BuiltToRoam.Core.Agent">
<HintPath>..\packages\BuiltToRoam.Core.Agent.1.0.1.5\lib\sl4-wp71\BuiltToRoam.Core.Agent.dll</HintPath>
<Aliases>global</Aliases>
</Reference>
<Reference Include="BuiltToRoam.GeoWatcher">
<HintPath>..\packages\BuiltToRoam.GeoWatcher.1.0.1.5\lib\sl4-wp71\BuiltToRoam.GeoWatcher.dll</HintPath>
<Aliases>global</Aliases>
</Reference>
<Reference Include="Microsoft.Phone.Controls, Version=8.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Phone.Controls.Toolkit">
<HintPath>..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\sl4-windowsphone71\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SharpZipLib.WindowsPhone7">
<HintPath>..\packages\SharpZipLib-WP7.0.86.0.518\lib\sl4-windowsphone71\SharpZipLib.WindowsPhone7.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Folder Include="File\" />

View File

@@ -0,0 +1,34 @@
//-----------------------------------------------------------------------------
// <copyright file="CBMainMapModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>13.08.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
{
using System.Windows;
/// <summary>
/// Class for the MapModel of the mainCampus of cottbus
/// </summary>
public class CBMainMapModel : MapModel
{
/// <summary>
/// Initializes a new instance of the <see cref="CBMainMapModel" /> class.
/// </summary>
public CBMainMapModel()
{
this.ImageSource = "/Assets/campusmap.png";
this.ImageWidth = 2000;
this.ImageHeight = 1425;
this.MapImageOffsetX = -228;
this.MapImageOffsetY = -300;
this.RefPoint = new Point(1365, 800);
this.ScaleX = 129483.4123222749;
this.ScaleY = 197648.8919266073;
this.GeoOffsetX = 14.327159;
this.GeoOffsetY = 51.766548;
}
}
}

View File

@@ -68,7 +68,12 @@ namespace CampusAppWP8.Model.Campusmap
/// <summary>
/// Gets or sets the Scale (to pixel) of the map
/// </summary>
public double Scale { get; set; }
public double ScaleX { get; set; }
/// <summary>
/// Gets or sets the Scale (to pixel) of the map
/// </summary>
public double ScaleY { get; set; }
/// <summary>
/// Gets or sets the reference point
@@ -159,19 +164,41 @@ namespace CampusAppWP8.Model.Campusmap
/// <returns>Point in pixel-size</returns>
public Point ConverToPixelPoint(double x, double y)
{
return new Point { X = this.Scale * x, Y = this.Scale * y };
Point p = new Point { X = this.ScaleX * x, Y = this.ScaleY * y };
return p;
}
/// <summary>
/// Convert a coordinates to coordinates which address pixels
/// </summary>
/// <param name="point">not scaled point</param>
/// <param name="point">not scaled point</param>d
/// <returns>Point in pixel-size</returns>
public Point ConverToPixelPoint(Point point)
{
return this.ConverToPixelPoint(point.X, point.Y);
}
/// <summary>
/// Convert a coordinates to coordinates which address mapPoint
/// </summary>
/// <param name="x">the x-coordinate</param>
/// <param name="y">the y-coordinate</param>
/// <returns>Point in pixel-size</returns>
public Point ConverToMapPoint(double x, double y)
{
return new Point { X = x - this.GeoOffsetX, Y = y - this.GeoOffsetY };
}
/// <summary>
/// Convert a coordinates to coordinates which address mapPoint
/// </summary>
/// <param name="point">not scaled point</param>
/// <returns>Point in pixel-size</returns>
public Point ConverToMapPoint(Point point)
{
return this.ConverToMapPoint(point.X, point.Y);
}
#endregion
}
}

View File

@@ -8,6 +8,7 @@
namespace CampusAppWP8.Model.Campusmap
{
using System.Windows;
using CampusAppWP8.Resources;
/// <summary>
/// This Class manage the properties of a MapPin
@@ -22,17 +23,18 @@ namespace CampusAppWP8.Model.Campusmap
private Point position;
#endregion
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="MapPinModel" /> class.
/// </summary>
public MapPinModel()
{
this.ImageSource = "/Assets/icons/search_159_light.png";
this.ImageSource = Icons.Search;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -24;
this.PinImageOffsetY = -24;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
}
#endregion

View File

@@ -7,11 +7,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Location="clr-namespace:System.Device.Location;assembly=System.Device"
x:Class="CampusAppWP8.Pages.Campusmap.CampusMapPage"
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
OrientationChanged="PhoneApplicationPage_OrientationChanged"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
@@ -21,7 +21,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ProgressBar Name="ProgressBar" Visibility="Collapsed" IsIndeterminate="True"/>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
@@ -39,8 +39,14 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox Name="XPoint" Grid.Column="0" Text="0" />
<TextBox Name="YPoint" Grid.Column="1" Text="0"/>
<StackPanel Grid.Column="0">
<TextBlock Text="Lat:" />
<TextBox Name="YPoint" Text="51,767747" InputScope="Number" />
</StackPanel>
<StackPanel Grid.Column="1">
<TextBlock Text="Long:" />
<TextBox Name="XPoint" Text="14,327545" InputScope="Number" />
</StackPanel>
<Button Grid.Column="2" Click="Button_Click">
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="60"/>
</Button>
@@ -56,5 +62,9 @@
</ScrollViewer>
</Grid>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" >
<lui:UpdateButtonAppBar Click="UpdateButtonAppBar_Click"/>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -1,43 +1,123 @@
using CampusAppWP8.Model.Campusmap;
using Microsoft.Phone.Controls;
using System.Windows;
using System.Windows.Navigation;
//-----------------------------------------------------------------------------
// <copyright file="CampusMapPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>13.08.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Pages.Campusmap
{
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Model.Campusmap;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
/// <summary>
/// Class for the campusMap page
/// </summary>
public partial class CampusMapPage : PhoneApplicationPage
{
/// <summary>
/// Variable for the map model
/// </summary>
private MapModel map;
/// <summary>
/// Initializes a new instance of the <see cref="CampusMapPage" /> class.
/// </summary>
public CampusMapPage()
{
InitializeComponent();
this.map = new MapModel() { ImageSource = "/Assets/testmap.png", ImageWidth = 2000, ImageHeight = 2000, MapImageOffsetX = -228, MapImageOffsetY = -300, RefPoint = new Point(1000, 1000), Scale = 20};
this.MapCanvas.DataContext = map;
}
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
this.InitializeComponent();
this.map = new CBMainMapModel();
this.MapCanvas.DataContext = this.map;
}
/// <summary>
/// Methods overrides the OnNavigatedTo-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
this.ShowCurrentPositionDispatcher();
}
/// <summary>
/// Button click method
/// </summary>
/// <param name="sender">caller object</param>
/// <param name="e">some EventArgs</param>
private void Button_Click(object sender, RoutedEventArgs e)
{
MapCanvas.Children.Clear();
Point scrollPoint = map.GetScrollPoint(map.ConverToPixelPoint(double.Parse(XPoint.Text), double.Parse(YPoint.Text)));
MapCanvas.Children.Add(map.AddPinFromRefPoint(map.ConverToPixelPoint(double.Parse(XPoint.Text), double.Parse(YPoint.Text))));
this.AddPin(double.Parse(XPoint.Text), double.Parse(YPoint.Text));
}
/// <summary>
/// Add Pin to an certain position
/// </summary>
/// <param name="x">longitude parameter</param>
/// <param name="y">latitude parameter</param>
private void AddPin(double x, double y)
{
MapCanvas.Children.Clear();
Point scrollPoint = this.map.GetScrollPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y)));
MapCanvas.Children.Add(this.map.AddPinFromRefPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y))));
MapScroller.UpdateLayout();
MapScroller.ScrollToVerticalOffset(scrollPoint.Y);
MapScroller.ScrollToHorizontalOffset(scrollPoint.X);
MapScroller.ScrollToHorizontalOffset(scrollPoint.X);
XPoint.Text = x.ToString();
YPoint.Text = y.ToString();
}
/// <summary>
/// On clicking the update button in the ApplicationBar.
/// </summary>
/// <param name="sender">caller object</param>
/// <param name="e">some EventArgs</param>
private void UpdateButtonAppBar_Click(object sender, System.EventArgs e)
{
this.ShowCurrentPositionDispatcher();
}
/// <summary>
/// execute ShowCurrentPosition-Method via Dispatcher
/// </summary>
private void ShowCurrentPositionDispatcher()
{
ProgressBar.Visibility = Visibility.Visible;
if (this.Dispatcher != null)
{
this.Dispatcher.BeginInvoke(new Action(() => this.ShowCurrentPosition()));
}
else
{
this.ShowCurrentPosition();
}
}
/// <summary>
/// Method add a pin on the at the position of the phone
/// </summary>
private void ShowCurrentPosition()
{
Utilities.DetermineAndStoreCurrentPositionForce();
string lat = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Lat);
string log = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Long);
double x;
double y;
if (!double.TryParse(log, NumberStyles.Any, CultureInfo.InvariantCulture, out x) || !double.TryParse(lat, NumberStyles.Any, CultureInfo.InvariantCulture, out y))
{
return;
}
this.AddPin(x, y);
ProgressBar.Visibility = Visibility.Collapsed;
}
}
}

View File

@@ -77,7 +77,7 @@ namespace CampusAppWP8.Pages.Mensa
base.OnNavigatedTo(e);
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
this.InitializeFeed();
}
}
/// <summary>
/// Override the OnNavigatedFrom method
@@ -138,7 +138,14 @@ namespace CampusAppWP8.Pages.Mensa
{
if (Settings.AppSetting.GeoWatchEnable)
{
this.DeterminCurrentCampusAndLoadFeed();
if (this.Dispatcher != null)
{
this.Dispatcher.BeginInvoke(new Action(() => this.DeterminCurrentCampusAndLoadFeed()));
}
else
{
this.DeterminCurrentCampusAndLoadFeed();
}
}
else
{

View File

@@ -80,7 +80,7 @@
</StackPanel>
</lui:NavigateButton>
<lui:NavigateButton Name="CampusMapAppButton" Grid.Row="1" Grid.Column="2" Style="{StaticResource StartPageButton}" IsEnabled="False">
<lui:NavigateButton Name="CampusMapAppButton" Grid.Row="1" Grid.Column="2" Style="{StaticResource StartPageButton}" Url="{Binding Path=Constants.PathCampusmap_Campusmap, Source={StaticResource Const}}">
<StackPanel Style="{StaticResource StartPageStackPanelStyle}">
<Image Source="{Binding Path=ThemelizedIcon.Campus, Source={StaticResource ThemelizedIcons}}" Style="{StaticResource StartPageButtonImg}"/>
<TextBlock Text="{Binding Path=LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}" Style="{StaticResource StartPageButtonText}"/>

View File

@@ -15,6 +15,7 @@ namespace CampusAppWP8.Pages
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System.Threading;
/// <summary>
/// Class for the StartPage
@@ -46,6 +47,15 @@ namespace CampusAppWP8.Pages
}
}
/// <summary>
/// Methods overrides the OnNavigatedTo-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
}
/// <summary>
/// Method handle OrientationPage
/// </summary>
@@ -150,7 +160,8 @@ namespace CampusAppWP8.Pages
if (result == MessageBoxResult.OK)
{
Settings.AppSetting.GeoWatchEnable = true;
Utilities.DetermineAndStoreCurrentPosition();
Thread thread = new Thread(new ThreadStart(Utilities.DetermineAndStoreCurrentPosition));
thread.Start();
}
else
{

View File

@@ -14,7 +14,7 @@
<Capability Name="ID_CAP_PHONEDIALER" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="pages/StartPage.xaml" />
<DefaultTask Name="_default" NavigationPage="Pages/StartPage.xaml" />
</Tasks>
<Tokens>
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">

View File

@@ -465,6 +465,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Campusmap/CampusMapPage.xaml ähnelt.
/// </summary>
public static string PathCampusmap_Campusmap {
get {
return ResourceManager.GetString("PathCampusmap_Campusmap", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Departments/DepartmentFavoritePage.xaml ähnelt.
/// </summary>

View File

@@ -405,4 +405,7 @@
<data name="SpsApi_LongitudeParaKey" xml:space="preserve">
<value>longitude</value>
</data>
<data name="PathCampusmap_Campusmap" xml:space="preserve">
<value>/Pages/Campusmap/CampusMapPage.xaml</value>
</data>
</root>

View File

@@ -6,7 +6,7 @@
// <sience>16.07.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Utility
{
{
using System;
using System.Collections.Generic;
using System.Device.Location;
@@ -209,11 +209,11 @@ namespace CampusAppWP8.Utility
{
if (!Settings.AppSetting.GeoWatchEnable)
{
return null;
return null;
}
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
bool success = watcher.TryStart(false, TimeSpan.FromMilliseconds(1000));
bool success = watcher.TryStart(false, TimeSpan.FromMilliseconds(10000));
GeoPosition<GeoCoordinate> geoposition = null;
if (success)
{
@@ -236,6 +236,7 @@ namespace CampusAppWP8.Utility
public static void DetermineAndStoreCurrentPositionForce()
{
GeoPosition<GeoCoordinate> geoposition = Utilities.DetermineCurrentPosition();
if (geoposition != null)
{
string lat = geoposition.Location.Latitude.ToString(CultureInfo.InvariantCulture);

View File

@@ -1,8 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="BuiltToRoam.Core.Agent" version="1.0.1.5" targetFramework="wp80" />
<package id="BuiltToRoam.GeoWatcher" version="1.0.1.5" targetFramework="wp80" />
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="wp80" />
<package id="SharpZipLib-WP7" version="0.86.0.518" targetFramework="wp80" />
<package id="WPtoolkit" version="4.2012.10.30" targetFramework="wp80" />
</packages>