lecture sendrequest and shows result

This commit is contained in:
stubbfel
2013-06-12 13:07:24 +02:00
parent 72495a5bc5
commit 6071f96b3b
7 changed files with 86 additions and 58 deletions

View File

@@ -10,8 +10,8 @@ namespace CampusAppWP8.Pages.Lecture
{
public class LectureFeed : XmlFeed<LectureList>
{
public LectureFeed()
: base(new Uri("http://www.zv.tu-cottbus.de/LSFveranst/LSF4?Semester=20112&Abschluss=82&Studiengang=079&Von=1&Bis=2"), "Lecture.xml")
public LectureFeed(Uri url)
: base(url, "Lecture.xml")
{
this.validRootName = "lsf_auszug";
}
@@ -31,7 +31,12 @@ namespace CampusAppWP8.Pages.Lecture
/// <returns>true, if file is up-to-date, otherwise false</returns>
protected override bool CheckIsFileUpToDate()
{
return true;
return false;
}
public static Uri createFeedUrl(string semester, string degree, string course, string from, string to)
{
return new Uri("http://www.zv.tu-cottbus.de/LSFveranst/LSF4?Semester="+semester+"&Abschluss="+degree+"&Studiengang="+course+"&Von="+from+"&Bis="+to);
}
}
}

View File

@@ -48,26 +48,26 @@
<StackPanel Grid.Row="0" >
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_LectureName, Source={StaticResource LocalizedStrings}}"/>
<TextBox />
<TextBox Name="ActivtyName"/>
</StackPanel>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="1">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Course, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker>
<toolkit:ListPickerItem Content="aaa" />
<toolkit:ListPickerItem Content="bbb" />
<toolkit:ListPickerItem Content="ccc" />
<toolkit:ListPicker Name="Course">
<toolkit:ListPickerItem Content="Architektur" Tag="013"/>
<toolkit:ListPickerItem Content="Bauingenieurwesen" Tag="017"/>
<toolkit:ListPickerItem Content="Betriebswirtschaftslehre" Tag="021" />
</toolkit:ListPicker>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="2">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Degree, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker>
<toolkit:ListPickerItem Content="Bachelor" />
<toolkit:ListPickerItem Content="Master" />
<toolkit:ListPickerItem Content="Diplom" />
<toolkit:ListPicker Name="Degree">
<toolkit:ListPickerItem Content="Bachelor" Tag="82" />
<toolkit:ListPickerItem Content="Master" Tag="88"/>
<toolkit:ListPickerItem Content="Diplom" Tag="11" />
</toolkit:ListPicker>
</StackPanel>
</Border>
@@ -75,16 +75,18 @@
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Term, Source={StaticResource LocalizedStrings}}"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<toolkit:ListPicker Width="60">
<toolkit:ListPickerItem Content="1" />
<toolkit:ListPickerItem Content="2" />
<toolkit:ListPickerItem Content="3" />
<toolkit:ListPicker Width="60" Name="From" >
<toolkit:ListPickerItem Content="1" Tag="1" />
<toolkit:ListPickerItem Content="2" Tag="2"/>
<toolkit:ListPickerItem Content="3" Tag="3" />
<toolkit:ListPickerItem Content="4" Tag="4"/>
</toolkit:ListPicker>
<TextBlock Text="bis" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<toolkit:ListPicker Width="60">
<toolkit:ListPickerItem Content="1" />
<toolkit:ListPickerItem Content="2" />
<toolkit:ListPickerItem Content="3" />
<toolkit:ListPicker Width="60" Name="To">
<toolkit:ListPickerItem Content="1" Tag="1" />
<toolkit:ListPickerItem Content="2" Tag="3" />
<toolkit:ListPickerItem Content="3" Tag="3" />
<toolkit:ListPickerItem Content="4" Tag="4" />
</toolkit:ListPicker>
</StackPanel>
</StackPanel>
@@ -92,15 +94,15 @@
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="4">
<StackPanel>
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Semester, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker>
<toolkit:ListPickerItem Content="SoSe 13" />
<toolkit:ListPickerItem Content="WiSe 13/14" />
<toolkit:ListPickerItem Content="SoSe 14" />
<toolkit:ListPicker Name="Semester">
<toolkit:ListPickerItem Content="SoSe 13" Tag="20131"/>
<toolkit:ListPickerItem Content="WiSe 13/14" Tag="20132"/>
<toolkit:ListPickerItem Content="SoSe 14" Tag="2014"/>
</toolkit:ListPicker>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="5">
<Button Name="SearchButton">
<Button Name="SearchButton" Click="SendRequest">
<Image Source="/Toolkit.Content/ApplicationBar.Select.png" Width="100">
</Image>
</Button>

View File

@@ -9,20 +9,48 @@ using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CampusAppWP8.Pages.Lecture;
using CampusAppWP8.Utility;
using CampusAppWP8.Model.Lecture;
using CampusAppWP8.Resources;
namespace CampusAppWP8.Pages.lecture
{
public partial class Lecture : PhoneApplicationPage
{
/// <summary>
/// actual LectureFeed
/// </summary>
private LectureFeed feed;
public Lecture()
{
InitializeComponent();
LectureFeed test = new LectureFeed();
test.LoadFeed();
}
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
private void SendRequest(object sender, RoutedEventArgs e)
{
ListPickerItem semester = (ListPickerItem)this.Semester.SelectedItem;
ListPickerItem degree= (ListPickerItem)this.Degree.SelectedItem;
ListPickerItem course = (ListPickerItem)this.Course.SelectedItem;
ListPickerItem from = (ListPickerItem)this.From.SelectedItem;
ListPickerItem to = (ListPickerItem)this.To.SelectedItem;
Uri request = LectureFeed.createFeedUrl(semester.Tag.ToString(), degree.Tag.ToString(), course.Tag.ToString(), from.Tag.ToString(), to.Tag.ToString());
this.feed = new LectureFeed(request);
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
this.feed.LoadFeed();
}
/// <summary>
/// Method will be execute if the feed is ready
/// </summary>
private void FeedIsReady()
{
App.SaveToIsolatedStorage<LectureList>(Constants.IsolatedStorageLectureModel, this.feed.Model);
Uri url = new Uri(Constants.PathResultPage, UriKind.Relative);
NavigationService.Navigate(url);
}
}
}

View File

@@ -13,7 +13,6 @@ namespace CampusAppWP8.Pages.Lecture
using System.Windows.Navigation;
using CampusAppWP8.Model.Lecture;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using Microsoft.Phone.Controls;
/// <summary>
@@ -21,11 +20,6 @@ namespace CampusAppWP8.Pages.Lecture
/// </summary>
public partial class ResultPage : PhoneApplicationPage
{
/// <summary>
/// actual LectureFeed
/// </summary>
private LectureFeed feed;
/// <summary>
/// Reference of the button which was lastClicked
/// </summary>
@@ -37,18 +31,17 @@ namespace CampusAppWP8.Pages.Lecture
public ResultPage()
{
this.InitializeComponent();
this.feed = new LectureFeed();
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
this.feed.LoadFeed();
}
/// <summary>
/// Method will be execute if the feed is ready
/// Override the OnNavigatedTo method
/// </summary>
private void FeedIsReady()
/// <param name="e">Arguments of navigation</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.ResultList.ItemsSource = this.feed.Model.Activities;
App.SaveToIsolatedStorage<LectureList>(Constants.IsolatedStorageLectureModel, this.feed.Model);
LectureList list = App.LoadFromIsolatedStorage<LectureList>(Constants.IsolatedStorageLectureModel);
this.ResultList.ItemsSource = list.Activities;
base.OnNavigatedTo(e);
}
/// <summary>
@@ -139,7 +132,7 @@ namespace CampusAppWP8.Pages.Lecture
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);
Uri url = new Uri(Constants.PathLectureModulWebPage + "?" + Constants.ParamLectureModulNumber + "=" + btn.Tag, UriKind.Relative);
NavigationService.Navigate(url);
}
@@ -151,7 +144,7 @@ namespace CampusAppWP8.Pages.Lecture
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.PathResultDetailPage + "?" + Constants.ParamLectureActivityId + "=" + btn.Tag, UriKind.Relative);
NavigationService.Navigate(url);
}
}

View File

@@ -13,7 +13,7 @@
<Capability Name="ID_CAP_ISV_CAMERA" />
</Capabilities>
<Tasks>
<DefaultTask Name="_default" NavigationPage="pages/StartPage.xaml" />
<DefaultTask Name="_default" NavigationPage="pages/Lecture/LecturePage.xaml" />
</Tasks>
<Tokens>
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">

View File

@@ -87,15 +87,6 @@ namespace CampusAppWP8.Resources {
}
}
/// <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>
@@ -117,9 +108,18 @@ namespace CampusAppWP8.Resources {
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ResultDetailPage.xaml ähnelt.
/// </summary>
internal static string PathResultDetailWebPage {
internal static string PathResultDetailPage {
get {
return ResourceManager.GetString("PathResultDetailWebPage", resourceCulture);
return ResourceManager.GetString("PathResultDetailPage", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Lecture/ResultPage.xaml ähnelt.
/// </summary>
internal static string PathResultPage {
get {
return ResourceManager.GetString("PathResultPage", resourceCulture);
}
}

View File

@@ -126,16 +126,13 @@
<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">
<data name="PathResultDetailPage" xml:space="preserve">
<value>/Pages/Lecture/ResultDetailPage.xaml</value>
</data>
<data name="UrlLectureModulBaseAddr" xml:space="preserve">
@@ -147,4 +144,7 @@
<data name="UrlWebMailAddr" xml:space="preserve">
<value>https://webmail.tu-cottbus.de</value>
</data>
<data name="PathResultPage" xml:space="preserve">
<value>/Pages/Lecture/ResultPage.xaml</value>
</data>
</root>