finish #74
This commit is contained in:
@@ -176,6 +176,9 @@
|
||||
<Compile Include="pages\StartPage.xaml.cs">
|
||||
<DependentUpon>StartPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\StudentCouncil\StudentCouncilPage.xaml.cs">
|
||||
<DependentUpon>StudentCouncilPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pages\Webmail\WebmailPage.xaml.cs">
|
||||
<DependentUpon>WebmailPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -272,6 +275,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\StudentCouncil\StudentCouncilPage.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Pages\Webmail\WebmailPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
namespace CampusAppWP8.Model.StudentCouncil
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
@@ -34,7 +36,7 @@ namespace CampusAppWP8.Model.StudentCouncil
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Proberty
|
||||
/// <summary>
|
||||
/// Gets or sets the StudentCouncils
|
||||
@@ -55,5 +57,24 @@ namespace CampusAppWP8.Model.StudentCouncil
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
/// <summary>
|
||||
/// Method group the StudentCouncilList by Faculty
|
||||
/// </summary>
|
||||
/// <returns>a Dictionary, where the Key is name of the Faculty und the value is a List of StudentCouncil</returns>
|
||||
public Dictionary<string, List<StudentCouncilModel>> GetStudentCouncilsGroupByFaculty()
|
||||
{
|
||||
List<IGrouping<string, StudentCouncilModel>> tmpList = this.StudentCouncils.GroupBy(p => p.Faculty).ToList();
|
||||
Dictionary<string, List<StudentCouncilModel>> itemMap = new Dictionary<string, List<StudentCouncilModel>>();
|
||||
foreach (IGrouping<string, StudentCouncilModel> group in tmpList)
|
||||
{
|
||||
Dictionary<string, List<StudentCouncilModel>> tempDic = new Dictionary<string, List<StudentCouncilModel>>();
|
||||
itemMap.Add(group.Key, group.ToList());
|
||||
}
|
||||
|
||||
return itemMap;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
namespace CampusAppWP8.Model.StudentCouncil
|
||||
{
|
||||
using System.Globalization;
|
||||
using System.Xml.Serialization;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
/// <summary>
|
||||
/// Model for menu
|
||||
@@ -19,24 +19,9 @@ namespace CampusAppWP8.Model.StudentCouncil
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// German version of the link title.
|
||||
/// name of the faculty.
|
||||
/// </summary>
|
||||
private string titleDE = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// English version of the link title.
|
||||
/// </summary>
|
||||
private string titleEN = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// German version of the link.
|
||||
/// </summary>
|
||||
private string linkDE = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// English version of the link.
|
||||
/// </summary>
|
||||
private string linkEN = string.Empty;
|
||||
private string faculty;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -57,7 +42,26 @@ namespace CampusAppWP8.Model.StudentCouncil
|
||||
/// Gets or sets the faculty of the StudentCouncil.
|
||||
/// </summary>
|
||||
[XmlAttribute("faculty")]
|
||||
public string Faculty { get; set; }
|
||||
public string Faculty
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.faculty;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != this.faculty)
|
||||
{
|
||||
this.faculty = value;
|
||||
int num;
|
||||
if (int.TryParse(this.faculty, out num))
|
||||
{
|
||||
this.faculty = AppResources.Faculty + " " + num;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the StudentCouncil.
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.StudentCouncil.StudentCouncilPage"
|
||||
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"
|
||||
mc:Ignorable="d"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<ProgressBar Name="ProgressBar" Visibility="Collapsed" IsIndeterminate="True"/>
|
||||
<phone:Pivot Name="StudentCouncilPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ListBox x:Name="ListPanel" ItemsSource="{Binding Value}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
<Button Content="{Binding Name}" Background="Gray" BorderBrush="Gray" Foreground="Black" Margin="-10,-10,-10,-10" Click="ToggleOptions"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Visibility="Collapsed">
|
||||
<Button Name="Link" Tag="{Binding Url}" Click="ShowWebpage" Height="75">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Link, Source={StaticResource ThemelizedIcons}}" />
|
||||
</Button>
|
||||
<Button Name="Email" Tag="{Binding Email}" Click="ShowEmail" Height="75">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.WebMail, Source={StaticResource ThemelizedIcons}}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -0,0 +1,170 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="StudentCouncilPage.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>03.07.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.StudentCouncil
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.StudentCouncil;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Class for the StudentCouncilPage
|
||||
/// </summary>
|
||||
public partial class StudentCouncilPage : PhoneApplicationPage
|
||||
{
|
||||
#region Members
|
||||
|
||||
/// <summary>
|
||||
/// the feed of the StudentCouncil
|
||||
/// </summary>
|
||||
private StudentCouncilFeed feed;
|
||||
|
||||
/// <summary>
|
||||
/// last visible UI element.
|
||||
/// </summary>
|
||||
private UIElement lastOpenUIElem = null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StudentCouncilPage" /> class.
|
||||
/// </summary>
|
||||
public StudentCouncilPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.InitializeFeed();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Method
|
||||
|
||||
#region protected
|
||||
|
||||
/// <summary>
|
||||
/// Override the OnNavigatedTo method
|
||||
/// </summary>
|
||||
/// <param name="e">Arguments of navigation</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
if (this.feed == null)
|
||||
{
|
||||
this.InitializeFeed();
|
||||
}
|
||||
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.feed.LoadFeed();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region private
|
||||
|
||||
/// <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)
|
||||
{
|
||||
if (this.lastOpenUIElem != null)
|
||||
{
|
||||
this.lastOpenUIElem.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
FrameworkElement btn = sender as FrameworkElement;
|
||||
StackPanel parent = btn.Parent as StackPanel;
|
||||
|
||||
if (parent.Children.Count() >= 2)
|
||||
{
|
||||
if (!parent.Children[1].Equals(this.lastOpenUIElem))
|
||||
{
|
||||
this.lastOpenUIElem = parent.Children[1];
|
||||
this.lastOpenUIElem.Visibility = Visibility.Visible;
|
||||
this.ProgressBar.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.lastOpenUIElem = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method navigate to StudentCouncilWebPage
|
||||
/// </summary>
|
||||
/// <param name="sender">Caller of the function</param>
|
||||
/// <param name="e">some EventArgs</param>
|
||||
private void ShowWebpage(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FrameworkElement linkBtn = sender as FrameworkElement;
|
||||
if (linkBtn.Tag == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Uri linkUrl = new Uri(linkBtn.Tag as string, UriKind.Absolute);
|
||||
WebBrowserTask webBrowserTask = new WebBrowserTask();
|
||||
webBrowserTask.Uri = linkUrl;
|
||||
webBrowserTask.Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method initialize the Feed
|
||||
/// </summary>
|
||||
private void InitializeFeed()
|
||||
{
|
||||
this.feed = new StudentCouncilFeed();
|
||||
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the feed is ready
|
||||
/// </summary>
|
||||
private void FeedIsReady()
|
||||
{
|
||||
this.SetupStudentCouncilPivot();
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method set ItemSource
|
||||
/// </summary>
|
||||
private void SetupStudentCouncilPivot()
|
||||
{
|
||||
this.StudentCouncilPivot.ItemsSource = this.feed.Model.GetStudentCouncilsGroupByFaculty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called on clicking on a mail button.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void ShowEmail(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FrameworkElement tempUIElem = sender as FrameworkElement;
|
||||
|
||||
string info = tempUIElem.Tag.ToString();
|
||||
|
||||
EmailComposeTask emailTask = new EmailComposeTask();
|
||||
emailTask.To = "mailto:" + info;
|
||||
emailTask.Show();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@
|
||||
<Capability Name="ID_CAP_PHONEDIALER" />
|
||||
</Capabilities>
|
||||
<Tasks>
|
||||
<DefaultTask Name="_default" NavigationPage="pages/StartPage.xaml" />
|
||||
<DefaultTask Name="_default" NavigationPage="pages/StudentCouncil/StudentCouncilPage.xaml" />
|
||||
</Tasks>
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
this.ProgressBar.Visibility = System.Windows.Visibility.Visible;
|
||||
this.feed.LoadFeed();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region private
|
||||
|
||||
/// <summary>
|
||||
@@ -80,7 +80,7 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
this.feed.EventHandler.FeedIsReadyEvent += new FeedEventHandler.FeedReadyHandler(this.FeedIsReady);
|
||||
this.CalcSelectedIndex();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Method will be execute if the feed is ready
|
||||
@@ -132,7 +132,6 @@ namespace CampusAppWP8.Pages.Mensa
|
||||
this.selectedIndex = todayIndex;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,7 @@ namespace CampusAppWP8.Utility
|
||||
{
|
||||
if (this.IsModelUpToDate())
|
||||
{
|
||||
this.EventHandler.FireFeedReadyevent();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user