This commit is contained in:
Christian Fiedler
2013-11-19 13:17:24 +01:00
parent d9b732c27b
commit 5605491ea9
6 changed files with 143 additions and 27 deletions

View File

@@ -9,6 +9,7 @@
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
xmlns:lu="clr-namespace:CampusAppWP8.Utility.Lui"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
@@ -22,22 +23,46 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<header:DefaultHeader Name="DefHeader" HeaderName="{Binding Path=LocalizedResources.CampusMapApp_RoomListTitle, Source={StaticResource LocalizedStrings}}"/>
</StackPanel>
<Grid Grid.Row="1">
<Grid Grid.Row="1" Margin="24,-12,24,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{Binding Path=LocalizedResources.LayerListPicker_Label, Source={StaticResource LocalizedStrings}}" Margin="24,0,24,0"/>
<TextBlock x:Name="LayerTag" Grid.Column="1" Text="" HorizontalAlignment="Center" />
<TextBlock
Grid.Column="0"
Text="{Binding Path=LocalizedResources.LayerListPicker_Label, Source={StaticResource LocalizedStrings}}"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="0,0,24,0"/>
<TextBlock
x:Name="LayerTag"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<Button Grid.Column="2" Click="SearchRoom">
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="20"/>
</Button>
</Grid>
<Canvas Grid.Row="2" x:Name="MainCanvas" Margin="12">
<toolkit:ListPicker x:Name="RoomPicker" Grid.Row="2" SelectionChanged="RoomPicker_SelectionChanged">
<toolkit:ListPicker.FullModeHeader>
<TextBlock Text="RAUM"/>
</toolkit:ListPicker.FullModeHeader>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<lu:MultiValueTextBlock Value1="{Binding }"
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
<Canvas Grid.Row="3" x:Name="MainCanvas" Margin="12">
<ViewportControl Name="VPC" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Bounds="0,-200,720,1200" Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay}" Height="{Binding ActualHeight, ElementName=MainCanvas, Mode=OneWay}">
<Canvas Name="MapCanvas" Height="800" Width="480" VerticalAlignment="Top" HorizontalAlignment="Left" ManipulationDelta="MapCanvas_ManipulationDelta" ManipulationStarted="MapCanvas_ManipulationStarted" ManipulationCompleted="MapCanvas_ManipulationCompleted" Margin="-188,-200,-188,-200">
<Image Name="imgMap" Height="{Binding ImageHeigh}" Width="{Binding ImageWidth}" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top"/>
@@ -46,24 +71,10 @@
</Canvas.RenderTransform>
</Canvas>
</ViewportControl>
<Grid x:Name="BtnGrid" Width="{Binding ActualWidth, ElementName=MainCanvas, Mode=OneWay}" Height="60">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderThickness="2" BorderBrush="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Text="ZoomIn" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}" Tap="ZoomIn_Tap"/>
</Border>
<Border Grid.Column="1" BorderThickness="2" BorderBrush="{StaticResource PhoneAccentBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<TextBlock Text="ZoomOut" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{StaticResource PhoneAccentBrush}" Tap="ZoomOut_Tap"/>
</Border>
</Grid>
</Canvas>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" />
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Default" />
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -62,6 +62,19 @@ namespace CampusAppWP8.Pages.Campusmap
public RoomListPage()
{
this.InitializeComponent();
ApplicationBarIconButton btnZoomIn = new ApplicationBarIconButton();
btnZoomIn.IconUri = new Uri(Icons.Info, UriKind.Relative);
btnZoomIn.Text = AppResources.ZoomIn;
btnZoomIn.Click += this.BtnZoomIn_Click;
ApplicationBarIconButton btnZoomOut = new ApplicationBarIconButton();
btnZoomOut.IconUri = new Uri(Icons.Info, UriKind.Relative);
btnZoomOut.Text = AppResources.ZoomOut;
btnZoomOut.Click += this.BtnZoomOut_Click;
this.ApplicationBar.Buttons.Add(btnZoomIn);
this.ApplicationBar.Buttons.Add(btnZoomOut);
}
#endregion
@@ -75,8 +88,12 @@ namespace CampusAppWP8.Pages.Campusmap
set
{
this.selectedLayer = value;
this.LayerTag.Text = value;
if (this.selectedLayer != value)
{
this.selectedLayer = value;
this.LayerTag.Text = value;
this.UpdateRoomList(value);
}
}
}
@@ -380,6 +397,10 @@ namespace CampusAppWP8.Pages.Campusmap
Canvas.SetZIndex(this.imgMap, 0);
}
/// <summary> Raises the system. event. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Event information to send to registered event handlers. </param>
private void OnMenuItemClicked(object sender, System.EventArgs e)
{
if (this.SelectedLayer.Equals((sender as ApplicationBarMenuItem).Text) == false)
@@ -423,10 +444,9 @@ namespace CampusAppWP8.Pages.Campusmap
/// <summary> Event handler. Called by ZoomIn for tap events. </summary>
/// <remarks> Fiedler, 15.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Gesture event information. </param>
private void ZoomIn_Tap(object sender, System.Windows.Input.GestureEventArgs e)
/// <param name="e"> Event information. </param>
private void BtnZoomIn_Click(object sender, EventArgs e)
{
//throw new NotImplementedException("TODO");
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX *= 1.5;
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY *= 1.5;
}
@@ -434,14 +454,63 @@ namespace CampusAppWP8.Pages.Campusmap
/// <summary> Event handler. Called by ZoomOut for tap events. </summary>
/// <remarks> Fiedler, 15.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Gesture event information. </param>
private void ZoomOut_Tap(object sender, System.Windows.Input.GestureEventArgs e)
/// <param name="e"> Event information. </param>
private void BtnZoomOut_Click(object sender, EventArgs e)
{
//throw new NotImplementedException("TODO");
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleX /= 1.5;
(this.MapCanvas.RenderTransform as ScaleTransform).ScaleY /= 1.5;
}
/// <summary> Searches for the first room. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Event information. </param>
private void SearchRoom(object sender, EventArgs e)
{
this.RoomPicker.Open();
}
/// <summary> Updates the room list described by level. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="level"> The level. </param>
private void UpdateRoomList(string level)
{
CampusBuildingLayerModel layer = this.building.Layers[level];
this.RoomPicker.Items.Clear();
foreach (PlaceModel room in layer.Rooms.Places)
{
if(room.GetInformationsValue(Constants.PisInformationName_Typ).Equals(Constants.PisInformationValue_Entrance) == false)
{
if (room.GetInformationsValue(Constants.PisInformationName_Room).Equals(room.GetInformationsValue(Constants.PisInformationName_Name)) == false)
{
string newStr = room.GetInformationsValue(Constants.PisInformationName_Room) + ", " + room.GetInformationsValue(Constants.PisInformationName_Name);
this.RoomPicker.Items.Add(newStr);
}
else
{
this.RoomPicker.Items.Add(room.GetInformationsValue(Constants.PisInformationName_Room));
}
}
}
}
#endregion
/// <summary> Event handler. Called by RoomPicker for selection changed events. </summary>
/// <remarks> Fiedler, 18.11.2013. </remarks>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Selection changed event information. </param>
private void RoomPicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
MapPoint pos = new MapPoint();
pos.X = room.GeoRefPoint.Longitude;
pos.Y = room.GeoRefPoint.Latitude;
MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint;
MapCanvas.Children.Add(this.buildingMap.AddPin(pos, PinType.SearchPlace));
}
}
}

View File

@@ -1553,5 +1553,23 @@ namespace CampusAppWP8.Resources {
return ResourceManager.GetString("When", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Zoom + ähnelt.
/// </summary>
public static string ZoomIn {
get {
return ResourceManager.GetString("ZoomIn", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Zoom - ähnelt.
/// </summary>
public static string ZoomOut {
get {
return ResourceManager.GetString("ZoomOut", resourceCulture);
}
}
}
}

View File

@@ -617,4 +617,10 @@
<data name="MensaApp_Weekplan" xml:space="preserve">
<value>Wochenplan</value>
</data>
<data name="ZoomIn" xml:space="preserve">
<value>Zoom +</value>
</data>
<data name="ZoomOut" xml:space="preserve">
<value>Zoom -</value>
</data>
</root>

View File

@@ -609,4 +609,7 @@
<data name="UrlMensaPrice" xml:space="preserve">
<value>http://www.tu-cottbus.de/campusapp-data/canteens.php?v=1</value>
</data>
<data name="PisInformationValue_Entrance" xml:space="preserve">
<value>Zugangsbereich</value>
</data>
</root>

View File

@@ -1239,6 +1239,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Zugangsbereich ähnelt.
/// </summary>
public static string PisInformationValue_Entrance {
get {
return ResourceManager.GetString("PisInformationValue_Entrance", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die pid ähnelt.
/// </summary>