finish ResultDetailPage

This commit is contained in:
stubbfel
2013-06-11 13:42:20 +02:00
parent 1bf0531e34
commit 4b41d8b764
14 changed files with 410 additions and 24 deletions

View File

@@ -125,6 +125,9 @@
<Compile Include="Pages\Lecture\ModulWebPage.xaml.cs">
<DependentUpon>ModulWebPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Lecture\ResultDetailPage.xaml.cs">
<DependentUpon>ResultDetailPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Lecture\ResultPage.xaml.cs">
<DependentUpon>ResultPage.xaml</DependentUpon>
</Compile>
@@ -186,6 +189,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Lecture\ResultDetailPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Lecture\ResultPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@@ -1,4 +1,5 @@
using System;
using CampusAppWP8.Utility;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
@@ -10,6 +11,12 @@ namespace CampusAppWP8.Model.Lecture
{
public class LectureActivity
{
#region
private ObservableCollection<LectureLecturer> lecturer;
private string lecturerString;
private string courseString;
private string topic;
#endregion
#region Constructor
/// <summary>
@@ -24,7 +31,10 @@ namespace CampusAppWP8.Model.Lecture
#region Proberty
[XmlElement("art")]
public string Type{ get; set; }
public string Type { get; set; }
[XmlAttribute("id")]
public int Id { get; set; }
[XmlElement("semester")]
public int Semester { get; set; }
@@ -36,7 +46,49 @@ namespace CampusAppWP8.Model.Lecture
public LectureModul Modul { get; set; }
[XmlElement("lehrperson")]
public ObservableCollection<LectureLecturer> Lecturer { get; set; }
public ObservableCollection<LectureLecturer> Lecturer {
get
{
return lecturer;
}
set
{
if (value != lecturer)
{
lecturer = value;
}
}
}
public string LecturerString {
get
{
return this.lecturerString;
}
set
{
if (value != this.lecturerString)
{
this.lecturerString = value;
}
}
}
public string CourseString
{
get
{
return this.courseString;
}
set
{
if (value != this.courseString)
{
this.courseString = value;
}
}
}
[XmlElement("studiengang")]
public ObservableCollection<LectureCourse> Course { get; set; }
@@ -44,6 +96,45 @@ namespace CampusAppWP8.Model.Lecture
[XmlElement("termin")]
public ObservableCollection<LectureDate> Dates { get; set; }
[XmlElement("zugeordnete_einrichtung")]
public string Department { get; set; }
[XmlElement("lehrinhalt")]
public string Topic
{
get
{
return topic;
}
set
{
if (value != topic)
{
topic = StringManager.StripHTML(value);
}
}
}
#endregion
public void createLectureString()
{
string result = string.Empty;
foreach (LectureLecturer tmpLecturer in Lecturer)
{
result += tmpLecturer.ToString() + "\n";
}
this.LecturerString = result.TrimEnd('\n');
}
public void createCourseString()
{
string result = string.Empty;
foreach (LectureCourse course in Course)
{
result += course.Title + "\n";
}
this.CourseString = result.TrimEnd('\n');
}
}
}

View File

@@ -23,5 +23,24 @@ namespace CampusAppWP8.Model.Lecture
[XmlAttribute("zustaendigkeit")]
public string Responsibility { get; set; }
public override string ToString()
{
string result = string.Empty;
if (!Title.Equals(string.Empty))
{
result += Title + " ";
}
result += FirstName + " ";
result += LastName + " ";
if (!Responsibility.Equals(string.Empty))
{
result += "(" + Responsibility + ") ";
}
return result;
}
}
}

View File

@@ -7,8 +7,11 @@
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Lecture
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using System.Linq;
[XmlRoot("lsf_auszug")]
public class LectureList
{
@@ -32,5 +35,14 @@ namespace CampusAppWP8.Model.Lecture
#endregion
#region Methods
public LectureActivity GetActivity(int id)
{
LectureActivity activity = Activities.Where(p => p.Id == id).First();
return activity;
}
#endregion
}
}

View File

@@ -24,5 +24,4 @@
<phone:WebBrowser x:Name="WebmailBrowser" IsScriptEnabled="True"/>
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -1,32 +1,42 @@
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 System.Threading.Tasks;
//-----------------------------------------------------------------------
// <copyright file="ModulWebPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>11.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Lecture
{
using System;
using System.Windows.Navigation;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
/// <summary>
/// Class for the page which shows Webpages from the BaseAddress <see cref="Constants.UrlLectureModulBaseAddr" />
/// </summary>
public partial class ModulWebPage : PhoneApplicationPage
{
/// <summary>
/// Initializes a new instance of the <see cref="ModulWebPage" /> class.
/// </summary>
public ModulWebPage()
{
InitializeComponent();
this.InitializeComponent();
}
/// <summary>
/// Override the OnNavigatedTo method
/// </summary>
/// <param name="e">Arguments of navigation</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (NavigationContext.QueryString.ContainsKey("URL"))
if (NavigationContext.QueryString.ContainsKey(Constants.ParamLectureModulNumber))
{
string url = NavigationContext.QueryString["URL"];
this.WebmailBrowser.Navigate(new Uri(url, UriKind.Absolute));
string number = NavigationContext.QueryString[Constants.ParamLectureModulNumber];
this.WebmailBrowser.Navigate(new Uri(Constants.UrlLectureModulBaseAddr + number, UriKind.Absolute));
}
base.OnNavigatedTo(e);
}
}

View File

@@ -0,0 +1,73 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.Lecture.ResultDetailPage"
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"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.LectureDetails_Header, Source={StaticResource LocalizedStrings}}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ScrollViewer>
<StackPanel>
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,0,0,0" Padding="0,12,0,12">
<StackPanel>
<TextBlock Text="Art" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="0,0,0,0"/>
<TextBlock Text="{Binding Type}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<StackPanel>
<TextBlock Text="Veranstaltung" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="0,0,0,0"/>
<TextBlock Text="{Binding Modul.Title}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<StackPanel>
<TextBlock Text="Verantwortlicher" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="0,0,0,0"/>
<TextBlock Text="{Binding LecturerString}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<StackPanel>
<TextBlock Text="Studiengang" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="0,0,0,0"/>
<TextBlock Text="{Binding CourseString}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<StackPanel>
<TextBlock Text="Lehrstuhl" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="0,0,0,0"/>
<TextBlock Text="{Binding Department}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneInverseInactiveBrush}" BorderThickness="0,1,0,0" Padding="0,12,0,12">
<StackPanel>
<TextBlock Text="Veranstaltungsinhalt" Style="{StaticResource PhoneTextGroupHeaderStyle}" Margin="0,0,0,0"/>
<TextBlock Text="{Binding Topic}" TextWrapping="Wrap"/>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,59 @@
//-----------------------------------------------------------------------
// <copyright file="ResultDetailPage.xaml.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>11.06.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Lecture
{
using System.Windows.Navigation;
using CampusAppWP8.Model.Lecture;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
/// <summary>
/// Class for the page which shows details of an activity
/// </summary>
public partial class ResultDetailPage : PhoneApplicationPage
{
/// <summary>
/// Initializes a new instance of the <see cref="ResultDetailPage" /> class.
/// </summary>
public ResultDetailPage()
{
this.InitializeComponent();
}
/// <summary>
/// Override the OnNavigatedTo method
/// </summary>
/// <param name="e">Arguments of navigation</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (NavigationContext.QueryString.ContainsKey(Constants.ParamLectureActivityId))
{
string activityId = NavigationContext.QueryString[Constants.ParamLectureActivityId];
this.LoadActivity(int.Parse(activityId));
}
base.OnNavigatedTo(e);
}
/// <summary>
/// Method load a certain Activity from the model
/// </summary>
/// <param name="activityId">id of the activity</param>
private void LoadActivity(int activityId)
{
LectureList list = App.LoadFromIsolatedStorage<LectureList>(Constants.IsolatedStorageLectureModel);
if (list != null)
{
LectureActivity activity = list.GetActivity(activityId);
activity.createLectureString();
activity.createCourseString();
this.ContentPanel.DataContext = activity;
}
}
}
}

View File

@@ -32,8 +32,8 @@
<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" >
<Button Name="Link" Visibility="Collapsed" Content="Link" Tag="{Binding Modul.Url}" Click="ShowModulWebPage"/>
<Button Name="Details" Visibility="Collapsed" Content="Details" Tag="foo" Click="ShowDetailPage"/>
<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>
</Border>

View File

@@ -8,6 +8,9 @@ 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;
namespace CampusAppWP8.Pages.Lecture
{
@@ -28,6 +31,7 @@ namespace CampusAppWP8.Pages.Lecture
private void FeedIsReady()
{
ResultList.ItemsSource = feed.Model.Activities;
App.SaveToIsolatedStorage<LectureList>("LectureModel", feed.Model);
}
private void ShowOptions(object sender, RoutedEventArgs e)
@@ -55,10 +59,14 @@ namespace CampusAppWP8.Pages.Lecture
private void ShowModulWebPage(object sender, RoutedEventArgs e)
{
Button btn = (Button)sender;
NavigationService.Navigate(new Uri("/Pages/Lecture/ModulWebPage.xaml?URL="+btn.Tag, UriKind.Relative));
Uri url = new Uri(Constants.PathLectureModulWebPage + Constants.Paramseparator + Constants.ParamLectureModulNumber + "=" + btn.Tag, UriKind.Relative);
NavigationService.Navigate(url);
}
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);
NavigationService.Navigate(url);
}
}

View File

@@ -177,6 +177,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Vorlesungen - Details ähnelt.
/// </summary>
public static string LectureDetails_Header {
get {
return ResourceManager.GetString("LectureDetails_Header", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Links ähnelt.
/// </summary>

View File

@@ -233,4 +233,7 @@
<data name="MensaApp_DinnerLabelW" xml:space="preserve">
<value>84</value>
</data>
<data name="LectureDetails_Header" xml:space="preserve">
<value>Vorlesungen - Details</value>
</data>
</root>

View File

@@ -60,6 +60,78 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die LectureModel ähnelt.
/// </summary>
internal static string IsolatedStorageLectureModel {
get {
return ResourceManager.GetString("IsolatedStorageLectureModel", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ActivityId ähnelt.
/// </summary>
internal static string ParamLectureActivityId {
get {
return ResourceManager.GetString("ParamLectureActivityId", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ModulNumber ähnelt.
/// </summary>
internal static string ParamLectureModulNumber {
get {
return ResourceManager.GetString("ParamLectureModulNumber", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die ? ähnelt.
/// </summary>
internal static string Paramseparator {
get {
return ResourceManager.GetString("Paramseparator", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Url ähnelt.
/// </summary>
internal static string ParamUrl {
get {
return ResourceManager.GetString("ParamUrl", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ModulWebPage.xaml ähnelt.
/// </summary>
internal static string PathLectureModulWebPage {
get {
return ResourceManager.GetString("PathLectureModulWebPage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ResultDetailPage.xaml ähnelt.
/// </summary>
internal static string PathResultDetailWebPage {
get {
return ResourceManager.GetString("PathResultDetailWebPage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die https://www.tu-cottbus.de/modul/ ähnelt.
/// </summary>
internal static string UrlLectureModulBaseAddr {
get {
return ResourceManager.GetString("UrlLectureModulBaseAddr", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die root ähnelt.
/// </summary>

View File

@@ -117,6 +117,30 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="IsolatedStorageLectureModel" xml:space="preserve">
<value>LectureModel</value>
</data>
<data name="ParamLectureActivityId" xml:space="preserve">
<value>ActivityId</value>
</data>
<data name="ParamLectureModulNumber" xml:space="preserve">
<value>ModulNumber</value>
</data>
<data name="Paramseparator" xml:space="preserve">
<value>?</value>
</data>
<data name="ParamUrl" xml:space="preserve">
<value>Url</value>
</data>
<data name="PathLectureModulWebPage" xml:space="preserve">
<value>/Pages/Lecture/ModulWebPage.xaml</value>
</data>
<data name="PathResultDetailWebPage" xml:space="preserve">
<value>/Pages/Lecture/ResultDetailPage.xaml</value>
</data>
<data name="UrlLectureModulBaseAddr" xml:space="preserve">
<value>https://www.tu-cottbus.de/modul/</value>
</data>
<data name="XMLRootElementName" xml:space="preserve">
<value>root</value>
</data>