finish ResultPage

This commit is contained in:
stubbfel
2013-06-11 15:15:49 +02:00
parent d935b7c2d9
commit a71a67cd06
4 changed files with 208 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.Lecture.Results"
x:Class="CampusAppWP8.Pages.Lecture.ResultPage"
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"
@@ -15,27 +15,33 @@
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="LectureItemTemplate">
<Border Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button Click="ShowOptions">
<TextBlock Text="{Binding Type}" Grid.Column="0" Grid.Row="0"/>
</Button>
<TextBlock Text=" : " Grid.Column="1" Grid.Row="0"/>
<TextBlock Text="{Binding Modul.Title}" TextWrapping="Wrap" Grid.Column="2" Grid.Row="0"/>
<StackPanel Orientation="Horizontal" Grid.Column="2" Grid.Row="1" >
<Border Background="{x:Null}" BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,0,0,0">
<StackPanel>
<Button Click="ToggleOptions" BorderBrush="{x:Null}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding Type}" Grid.Column="0" Grid.Row="0"/>
<TextBlock Text=" : " Grid.Column="1" Grid.Row="0"/>
<TextBlock Text="{Binding Modul.Title}" TextWrapping="Wrap" Grid.Column="2" Grid.Row="0"/>
</Grid>
</Button>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Name="Link" Visibility="Collapsed" Content="Link" Tag="{Binding Modul.Number}" Click="ShowModulWebPage"/>
<Button Name="Details" Visibility="Collapsed" Content="Details" Tag="{Binding Id}" Click="ShowDetailPage"/>
</StackPanel>
</Grid>
</StackPanel>
</Border>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>

View File

@@ -1,28 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Utility;
using CampusAppWP8.Resources;
using System.IO.IsolatedStorage;
using CampusAppWP8.Model.Lecture;
//-----------------------------------------------------------------------
// <copyright file="ResultPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>11.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Lecture
{
public partial class Results : PhoneApplicationPage
{
LectureFeed feed = new LectureFeed();
public Results()
{
InitializeComponent();
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CampusAppWP8.Model.Lecture;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
/// <summary>
/// Class for the page which shows the results of an LectureRequest
/// </summary>
public partial class ResultPage : PhoneApplicationPage
{
/// <summary>
/// actual LectureFeed
/// </summary>
private LectureFeed feed;
/// <summary>
/// Reference of the button which was lastClicked
/// </summary>
private Button lastClickedButton;
/// <summary>
/// Initializes a new instance of the <see cref="ResultPage" /> class.
/// </summary>
public ResultPage()
{
this.InitializeComponent();
this.feed = new LectureFeed();
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
feed.LoadFeed();
this.feed.LoadFeed();
}
/// <summary>
@@ -30,44 +47,112 @@ namespace CampusAppWP8.Pages.Lecture
/// </summary>
private void FeedIsReady()
{
ResultList.ItemsSource = feed.Model.Activities;
App.SaveToIsolatedStorage<LectureList>("LectureModel", feed.Model);
this.ResultList.ItemsSource = this.feed.Model.Activities;
App.SaveToIsolatedStorage<LectureList>(Constants.IsolatedStorageLectureModel, this.feed.Model);
}
private void ShowOptions(object sender, RoutedEventArgs e)
/// <summary>
/// Method toggle the Visibility of the Link- and Details-Buttons
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ToggleOptions(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
Grid test = (Grid)btn.Parent;
Button link = (Button)test.FindName("Link");
Button details = (Button)test.FindName("Details");
Button button = (Button)sender;
StackPanel parent = (StackPanel)button.Parent;
if (this.lastClickedButton != null && !this.lastClickedButton.Equals(button))
{
this.HideOptions(parent);
}
this.lastClickedButton = button;
Button link = (Button)parent.FindName("Link");
Button details = (Button)parent.FindName("Details");
this.ToogleVisibility(link);
this.ToogleVisibility(details);
}
/// <summary>
/// Method shows the Link- and Details-Buttons
/// </summary>
/// <param name="parent">Reference of the StackPanel which include the buttons </param>
private void ShowOptions(StackPanel parent)
{
Button link = (Button)parent.FindName("Link");
Button details = (Button)parent.FindName("Details");
this.ShowVisibility(link);
this.ShowVisibility(details);
}
/// <summary>
/// Method hide the Link- and Details-Buttons
/// </summary>
/// <param name="parent">Reference of the StackPanel which include the buttons </param>
private void HideOptions(StackPanel parent)
{
Button link = (Button)parent.FindName("Link");
Button details = (Button)parent.FindName("Details");
this.HideVisibility(link);
this.HideVisibility(details);
}
/// <summary>
/// Method toggle the Visibility of an UIElement
/// </summary>
/// <param name="element">UIElement which Visibility has to be toggle</param>
private void ToogleVisibility(UIElement element)
{
if (System.Windows.Visibility.Visible.Equals(element.Visibility))
{
element.Visibility = System.Windows.Visibility.Collapsed;
this.HideVisibility(element);
}
else
{
element.Visibility = System.Windows.Visibility.Visible;
this.ShowVisibility(element);
}
}
/// <summary>
/// Method set the Visibility=true of an UIElement
/// </summary>
/// <param name="element">UIElement which Visibility has to been true</param>
private void ShowVisibility(UIElement element)
{
element.Visibility = System.Windows.Visibility.Visible;
}
/// <summary>
/// Method set the Visibility=false of an UIElement
/// </summary>
/// <param name="element">UIElement which Visibility has to been false</param>
private void HideVisibility(UIElement element)
{
element.Visibility = System.Windows.Visibility.Collapsed;
}
/// <summary>
/// Method navigate to ModuleWebPage
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ShowModulWebPage(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
Uri url = new Uri(Constants.PathLectureModulWebPage + Constants.Paramseparator + Constants.ParamLectureModulNumber + "=" + btn.Tag, UriKind.Relative);
NavigationService.Navigate(url);
}
/// <summary>
/// Method navigate to DetailPage
/// </summary>
/// <param name="sender">Caller of the function</param>
/// <param name="e">some EventArgs</param>
private void ShowDetailPage(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
Uri url = new Uri(Constants.PathResultDetailWebPage + Constants.Paramseparator + Constants.ParamLectureActivityId+ "=" + btn.Tag, UriKind.Relative);
Uri url = new Uri(Constants.PathResultDetailWebPage + Constants.Paramseparator + Constants.ParamLectureActivityId + "=" + btn.Tag, UriKind.Relative);
NavigationService.Navigate(url);
}
}
}

View File

@@ -132,6 +132,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studiengänge ähnelt.
/// </summary>
public static string LectureApp_Courses {
get {
return ResourceManager.GetString("LectureApp_Courses", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Abschluss ähnelt.
/// </summary>
@@ -142,7 +151,25 @@ namespace CampusAppWP8.Resources {
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Vorlesungsname ähnelt.
/// Sucht eine lokalisierte Zeichenfolge, die Lehrstuhl ähnelt.
/// </summary>
public static string LectureApp_Department {
get {
return ResourceManager.GetString("LectureApp_Department", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Vorlesungen - Details ähnelt.
/// </summary>
public static string LectureApp_DetailsHeader {
get {
return ResourceManager.GetString("LectureApp_DetailsHeader", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Veranstaltungsname ähnelt.
/// </summary>
public static string LectureApp_LectureName {
get {
@@ -150,6 +177,24 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Lehrinhalt ähnelt.
/// </summary>
public static string LectureApp_LectureTopic {
get {
return ResourceManager.GetString("LectureApp_LectureTopic", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Verantwortlicher ähnelt.
/// </summary>
public static string LectureApp_Officer {
get {
return ResourceManager.GetString("LectureApp_Officer", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Semester ähnelt.
/// </summary>
@@ -178,11 +223,11 @@ namespace CampusAppWP8.Resources {
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Vorlesungen - Details ähnelt.
/// Sucht eine lokalisierte Zeichenfolge, die Veranstaltungsart ähnelt.
/// </summary>
public static string LectureDetails_Header {
public static string LectureApp_Type {
get {
return ResourceManager.GetString("LectureDetails_Header", resourceCulture);
return ResourceManager.GetString("LectureApp_Type", resourceCulture);
}
}

View File

@@ -183,7 +183,7 @@
<value>Abschluss</value>
</data>
<data name="LectureApp_LectureName" xml:space="preserve">
<value>Vorlesungsname</value>
<value>Veranstaltungsname</value>
</data>
<data name="LectureApp_Semester" xml:space="preserve">
<value>Semester</value>
@@ -233,7 +233,22 @@
<data name="MensaApp_DinnerLabelW" xml:space="preserve">
<value>84</value>
</data>
<data name="LectureDetails_Header" xml:space="preserve">
<data name="LectureApp_Courses" xml:space="preserve">
<value>Studiengänge</value>
</data>
<data name="LectureApp_Department" xml:space="preserve">
<value>Lehrstuhl</value>
</data>
<data name="LectureApp_DetailsHeader" xml:space="preserve">
<value>Vorlesungen - Details</value>
</data>
<data name="LectureApp_LectureTopic" xml:space="preserve">
<value>Lehrinhalt</value>
</data>
<data name="LectureApp_Officer" xml:space="preserve">
<value>Verantwortlicher</value>
</data>
<data name="LectureApp_Type" xml:space="preserve">
<value>Veranstaltungsart</value>
</data>
</root>