mv dispatcher

This commit is contained in:
stubbfel
2013-08-19 11:11:24 +02:00
parent 305737366e
commit cbe5325785
4 changed files with 44 additions and 42 deletions

View File

@@ -427,6 +427,7 @@
<Content Include="Assets\Tiles\kachel_medium.png" />
<Content Include="Assets\Tiles\kachel_small.png" />
<Content Include="README_FIRST.txt" />
<Content Include="Toolkit.Content\ApplicationBar.Add.png" />
<Content Include="Toolkit.Content\ApplicationBar.Cancel.png" />
<Content Include="Toolkit.Content\ApplicationBar.Check.png" />
<Content Include="Toolkit.Content\ApplicationBar.Delete.png" />
@@ -449,8 +450,9 @@
</ItemGroup>
<ItemGroup>
<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.2013.06.11\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
<Reference Include="Microsoft.Phone.Controls.Toolkit, Version=8.0.1.0, Culture=neutral, PublicKeyToken=b772ad94eb9ca604, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\WPtoolkit.4.2013.08.16\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

View File

@@ -9,6 +9,7 @@ namespace CampusAppWP8.Pages.Campusmap
{
using System;
using System.Globalization;
using System.Threading;
using System.Windows;
using System.Windows.Navigation;
using CampusAppWP8.Model.Campusmap;
@@ -16,19 +17,15 @@ namespace CampusAppWP8.Pages.Campusmap
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
/// <summary>
/// Class for the campusMap page
/// </summary>
/// <summary>Class for the campusMap page.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
public partial class CampusMapPage : PhoneApplicationPage
{
/// <summary>
/// Variable for the map model
/// </summary>
/// <summary>Variable for the map model.</summary>
private MapModel map;
/// <summary>
/// Initializes a new instance of the <see cref="CampusMapPage" /> class.
/// </summary>
/// <summary>Initializes a new instance of the <see cref="CampusMapPage" /> class.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
public CampusMapPage()
{
this.InitializeComponent();
@@ -36,31 +33,28 @@ namespace CampusAppWP8.Pages.Campusmap
this.MapCanvas.DataContext = this.map;
}
/// <summary>
/// Methods overrides the OnNavigatedTo-Method
/// </summary>
/// <param name="e">some NavigationEventArgs</param>
/// <summary>Methods overrides the OnNavigatedTo-Method.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="e">some NavigationEventArgs.</param>
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>
/// <summary>Button click method.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="sender">caller object.</param>
/// <param name="e"> some EventArgs.</param>
private void Button_Click(object sender, RoutedEventArgs e)
{
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>
/// <summary>Add Pin to an certain position.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="x">longitude parameter.</param>
/// <param name="y">latitude parameter.</param>
private void AddPin(double x, double y)
{
MapCanvas.Children.Clear();
@@ -74,39 +68,44 @@ namespace CampusAppWP8.Pages.Campusmap
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>
/// <summary>On clicking the update button in the ApplicationBar.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <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>
/// <summary>execute ShowCurrentPosition-Method via Dispatcher.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
private void ShowCurrentPositionDispatcher()
{
ProgressBar.Visibility = Visibility.Visible;
Thread thread = new Thread(new ThreadStart(this.ShowCurrentPosition));
thread.Start();
}
/// <summary>Method add a pin on the at the position of the phone.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
private void ShowCurrentPosition()
{
Utilities.DetermineAndStoreCurrentPositionForce();
if (this.Dispatcher != null)
{
this.Dispatcher.BeginInvoke(new Action(() => this.ShowCurrentPosition()));
this.Dispatcher.BeginInvoke(new Action(() => this.SetPinToCurrentPosition()));
}
else
{
this.ShowCurrentPosition();
}
this.SetPinToCurrentPosition();
}
}
/// <summary>
/// Method add a pin on the at the position of the phone
/// </summary>
private void ShowCurrentPosition()
{
Utilities.DetermineAndStoreCurrentPositionForce();
/// <summary>Sets pin to current position.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
private void SetPinToCurrentPosition()
{
string lat = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Lat);
string log = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Long);
double x;

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="WPtoolkit" version="4.2013.08.16" targetFramework="wp80" />
<package id="WPToolkit" version="4.2013.06.11" targetFramework="wp80" />
</packages>