add userprofil

This commit is contained in:
stubbfel
2013-07-23 15:35:41 +02:00
parent 3874f2ef06
commit 6338caea9c
12 changed files with 532 additions and 6 deletions

View File

@@ -98,7 +98,13 @@
</Compile>
<Compile Include="Feed\Departments\DepartmentFavoriteFeed.cs" />
<Compile Include="Const.cs" />
<Compile Include="File\UserProfil\UserProfilFile.cs" />
<Compile Include="Model\UserProfil\UserProfilModel.cs" />
<Compile Include="Pages\Setting\UserProfil.xaml.cs">
<DependentUpon>UserProfil.xaml</DependentUpon>
</Compile>
<Compile Include="Resources\Icons.Designer.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Utility\Lui\Button\EmailButton.cs" />
<Compile Include="Feed\Link\CommonLinkFeed.cs" />
<Compile Include="Feed\Link\ClubLinkFeed.cs" />
@@ -290,6 +296,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Pages\Setting\UserProfil.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="pages\StartPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@@ -0,0 +1,75 @@
//-----------------------------------------------------------------------
// <copyright file="UserProfilFile.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>23.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.File.UserProfil
{
using CampusAppWP8.Model;
using CampusAppWP8.Model.UserProfil;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class UserProfilFile : XmlModel<UserProfilModel>
{
#region Constructor
/// <summary>
/// Initializes a new instance of the <see cref="DepartmentFeed" /> class.
/// </summary>
/// <param name="autoLoad">automatic loading of the data</param>
public UserProfilFile(bool autoload = false) : base(ModelType.File, Constants.FileProfil_User)
{
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
if (autoload)
{
this.LoadData();
}
}
// Constructor
#endregion
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
/// </summary>
/// <param name="model">model object</param>
/// <param name="info">file info object</param>
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDateOnLoad(UserProfilModel model, FileInfo info)
{
if (this.Model == null)
{
return true;
}
return false;
}
/// <summary>
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>.
/// </summary>
/// <param name="model">model object</param>
/// <param name="info">file info object</param>
/// <returns>true, if file is up-to-date, otherwise false</returns>
private bool CheckIsFileUpToDateOnSave(UserProfilModel model, FileInfo info)
{
if (model != null && model.HasChanged())
{
return true;
}
return false;
}
}
}

View File

@@ -0,0 +1,161 @@
//-----------------------------------------------------------------------
// <copyright file="UserProfilModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>23.07.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.UserProfil
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
/// <summary>
/// Model for the profil of an user
/// </summary>
[XmlRoot("root")]
public class UserProfilModel
{
private bool changed = false;
/// <summary>
/// Gets or Sets the course of the user
/// </summary>
private string course;
/// <summary>
/// Gets or Sets the role of the user
/// </summary>
private int role;
/// <summary>
/// Gets or Sets the degree of the user
/// </summary>
private string degree;
/// <summary>
/// Gets or Sets the semester of the user
/// </summary>
private string semester;
/// <summary>
/// Gets or Sets the course of the user
/// </summary>
[XmlElement("Course")]
public string Course
{
get
{
return this.course;
}
set
{
if (value != this.course)
{
this.course = value;
this.changed = true;
}
}
}
/// <summary>
/// Gets or Sets the role of the user
/// </summary>
[XmlElement("Role")]
public int Role
{
get
{
return this.role;
}
set
{
if (value != this.role)
{
this.role = value;
this.changed = true;
}
}
}
/// <summary>
/// Gets or Sets the degree of the user
/// </summary>
[XmlElement("Degere")]
public string Degree
{
get
{
return this.degree;
}
set
{
if (value != this.degree)
{
this.degree = value;
this.changed = true;
}
}
}
/// <summary>
/// Gets or Sets the semester of the user
/// </summary>
[XmlElement("Semseter")]
public string Semester
{
get
{
return this.semester;
}
set
{
if (value != this.semester)
{
this.semester = value;
this.changed = true;
}
}
}
/// <summary>
/// Specifies the role of the user.
/// </summary>
public enum RoleType
{
/// <summary>
/// Invalid/unset state.
/// </summary>
INVALID = 0,
/// <summary>
/// for students (01).
/// </summary>
Student = 1,
/// <summary>
/// for staffs (10).
/// </summary>
Staff = 2,
}
public bool HasChanged(bool reset = true)
{
bool result = this.changed;
if (reset)
{
changed = false;
}
return result;
}
}
}

View File

@@ -0,0 +1,134 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.Pages.Setting.UserProfil"
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"
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
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-->
<ProgressBar Name="ProgressBar" Grid.Row="1" Visibility="Collapsed" IsIndeterminate="True"/>
<StackPanel Grid.Row="0" Margin="12,17,0,28">
<TextBlock Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Path=LocalizedResources.Setting_User, Source={StaticResource LocalizedStrings}}" Style="{StaticResource PhoneTextTitle2Style}"/>
</StackPanel>
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="0">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserCourse, Source={StaticResource LocalizedStrings}}"/>
<!-- Listpicket of courses -->
<toolkit:ListPicker Name="Course" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.LectureApp_ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Text}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="1">
<StackPanel >
<!-- Listpicket of degree-->
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserDegree, Source={StaticResource LocalizedStrings}}"/>
<toolkit:ListPicker Name="Degree" ExpansionMode="FullScreenOnly">
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Text}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="2">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserSemester, Source={StaticResource LocalizedStrings}}"/>
<!-- Listpicket of courses -->
<toolkit:ListPicker Name="Semster" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.LectureApp_ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Text}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
</StackPanel>
</Border>
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="3">
<StackPanel >
<TextBlock Text="{Binding Path=LocalizedResources.Setting_UserRole, Source={StaticResource LocalizedStrings}}"/>
<!-- Listpicket of courses -->
<toolkit:ListPicker Name="Role" ExpansionMode="FullScreenOnly" FullModeHeader="{Binding Path=LocalizedResources.LectureApp_ListPickerHeaderCourse, Source={StaticResource LocalizedStrings}}" >
<toolkit:ListPicker.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Text}"/>
</StackPanel>
</DataTemplate>
</toolkit:ListPicker.ItemTemplate>
<toolkit:ListPicker.FullModeItemTemplate>
<DataTemplate>
<Border BorderBrush="{StaticResource PhoneAccentBrush}" BorderThickness="12,0,0,0" Margin="0,0,0,6">
<TextBlock Text="{Binding Text}" Style="{StaticResource PhoneTextGroupHeaderStyle}" TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</toolkit:ListPicker.FullModeItemTemplate>
</toolkit:ListPicker>
</StackPanel>
</Border>
</Grid>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,20 @@
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;
namespace CampusAppWP8.Pages.Setting
{
public partial class UserProfil : PhoneApplicationPage
{
public UserProfil()
{
InitializeComponent();
}
}
}

View File

@@ -137,5 +137,11 @@
<!-- <Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" /> -->
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True" Mode="Minimized" Opacity="0.75" >
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="Setting" Click="ApplicationBarMenuItem_Click"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>

View File

@@ -13,6 +13,7 @@ namespace CampusAppWP8.Pages
using System.Windows.Navigation;
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
/// <summary>
/// Class for the StartPage
@@ -25,6 +26,11 @@ namespace CampusAppWP8.Pages
public StartPage()
{
this.InitializeComponent();
ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem;
if (menuItem1 != null)
{
menuItem1.Text = AppResources.Setting_UserProfilAppBarTitle;
}
}
/// <summary>
@@ -74,9 +80,9 @@ namespace CampusAppWP8.Pages
}
}
private void OpenDepartmentApp(object sender, RoutedEventArgs e)
private void ApplicationBarMenuItem_Click(object sender, EventArgs e)
{
Uri url = new Uri(Constants.PathDepartment_DepartmentIndexPage, UriKind.Relative);
Uri url = new Uri(Constants.PathSetting_User, UriKind.Relative);
NavigationService.Navigate(url);
}
}

View File

@@ -573,6 +573,60 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt.
/// </summary>
public static string Setting_User {
get {
return ResourceManager.GetString("Setting_User", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Studiengang ähnelt.
/// </summary>
public static string Setting_UserCourse {
get {
return ResourceManager.GetString("Setting_UserCourse", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Abschluss ähnelt.
/// </summary>
public static string Setting_UserDegree {
get {
return ResourceManager.GetString("Setting_UserDegree", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Profileinstellungen ähnelt.
/// </summary>
public static string Setting_UserProfilAppBarTitle {
get {
return ResourceManager.GetString("Setting_UserProfilAppBarTitle", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Rolle ähnelt.
/// </summary>
public static string Setting_UserRole {
get {
return ResourceManager.GetString("Setting_UserRole", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Semster ähnelt.
/// </summary>
public static string Setting_UserSemester {
get {
return ResourceManager.GetString("Setting_UserSemester", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Freitag ähnelt.
/// </summary>

View File

@@ -320,4 +320,22 @@
<data name="UpdateBtn" xml:space="preserve">
<value>Aktualisieren</value>
</data>
<data name="Setting_User" xml:space="preserve">
<value>Profileinstellungen</value>
</data>
<data name="Setting_UserCourse" xml:space="preserve">
<value>Studiengang</value>
</data>
<data name="Setting_UserDegree" xml:space="preserve">
<value>Abschluss</value>
</data>
<data name="Setting_UserProfilAppBarTitle" xml:space="preserve">
<value>Profileinstellungen</value>
</data>
<data name="Setting_UserRole" xml:space="preserve">
<value>Rolle</value>
</data>
<data name="Setting_UserSemester" xml:space="preserve">
<value>Semster</value>
</data>
</root>

View File

@@ -132,6 +132,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die user.xml ähnelt.
/// </summary>
public static string FileProfil_User {
get {
return ResourceManager.GetString("FileProfil_User", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die StudentCouncils.xml ähnelt.
/// </summary>
@@ -402,6 +411,15 @@ namespace CampusAppWP8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/Setting/UserProfil.xaml ähnelt.
/// </summary>
public static string PathSetting_User {
get {
return ResourceManager.GetString("PathSetting_User", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die /Pages/StudentCouncil/StudentCouncilPage.xaml ähnelt.
/// </summary>

View File

@@ -251,9 +251,6 @@
</data>
<data name="FileMensa_Shedule" xml:space="preserve">
<value>MensaFeed.xml</value>
</data>
<data name="FileEvents_Name" xml:space="preserve">
<value>EventsFeed.xml</value>
</data>
<data name="FileEvents_Name" xml:space="preserve">
<value>EventsFeed.xml</value>
@@ -276,4 +273,10 @@
<data name="UrlNews_Addr" xml:space="preserve">
<value>http://www.tu-cottbus.de/oracle-gateway/php/rss2feed_aktuelles.php</value>
</data>
<data name="FileProfil_User" xml:space="preserve">
<value>user.xml</value>
</data>
<data name="PathSetting_User" xml:space="preserve">
<value>/Pages/Setting/UserProfil.xaml</value>
</data>
</root>

View File

@@ -0,0 +1,21 @@
using CampusAppWP8.File.UserProfil;
namespace CampusAppWP8
{
public class Settings
{
private static UserProfilFile userProfil = new UserProfilFile(true);
public static UserProfilFile UserProfil
{
get
{
return UserProfil;
}
set
{
UserProfil = value;
}
}
}
}