add departmentpage and modell

This commit is contained in:
stubbfel
2013-05-28 14:00:22 +02:00
parent 787e0dcab0
commit 3c8fb4781b
8 changed files with 312 additions and 1 deletions

View File

@@ -98,9 +98,16 @@
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="model\departments\ChairModel.cs" />
<Compile Include="model\departments\DepartmentModel.cs" />
<Compile Include="model\departments\DepartmentViewModel.cs" />
<Compile Include="model\departments\FacultyModel.cs" />
<Compile Include="pages\campusmap\CampusMapPage.xaml.cs">
<DependentUpon>CampusMapPage.xaml</DependentUpon>
</Compile>
<Compile Include="pages\departments\DepartmentPage.xaml.cs">
<DependentUpon>DepartmentPage.xaml</DependentUpon>
</Compile>
<Compile Include="pages\lecture\LecturePage.xaml.cs">
<DependentUpon>LecturePage.xaml</DependentUpon>
</Compile>
@@ -145,6 +152,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="pages\departments\DepartmentPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="pages\lecture\LecturePage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -202,10 +213,12 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Phone.Controls, Version=8.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e, processorArchitecture=MSIL" />
<Reference Include="Microsoft.Phone.Controls.Toolkit">
<HintPath>..\packages\WPtoolkit.4.2012.10.30\lib\wp8\Microsoft.Phone.Controls.Toolkit.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).$(TargetFrameworkVersion).Overrides.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

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/departments/DepartmentPage.xaml" />
</Tasks>
<Tokens>
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CampusAppWP8.model.departments
{
public class ChairModel : BaseModel
{
private string _name;
public ChairModel()
{
_name = String.Empty;
}
public ChairModel(string name)
{
_name = name;
}
public string Name
{
get
{
return _name;
}
set
{
if (value != _name)
{
_name = value;
NotifyPropertyChanged("chair");
}
}
}
}
}

View File

@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
namespace CampusAppWP8.model.departments
{
public class DepartmentModel : BaseModel
{
private ObservableCollection<ChairModel> _chairs = null;
private string _name;
public DepartmentModel()
{
this.Chairs = new ObservableCollection<ChairModel>();
this.LoadData();
}
public DepartmentModel(string name)
{
_name = name;
this.Chairs = new ObservableCollection<ChairModel>();
this.LoadData();
}
public void LoadData()
{
this.Chairs.Add(new ChairModel("LS 1"));
this.Chairs.Add(new ChairModel("LS 2"));
this.Chairs.Add(new ChairModel("LS 3"));
this.Chairs.Add(new ChairModel("LS 4"));
}
public ObservableCollection<ChairModel> Chairs
{
get
{
return _chairs;
}
set
{
if (value != _chairs)
{
_chairs = value;
NotifyPropertyChanged("department");
}
}
}
public string Name
{
get
{
return _name;
}
set
{
if (value != _name)
{
_name = value;
NotifyPropertyChanged("chair");
}
}
}
}
}

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWP8.model.departments
{
public class DepartmentViewModel : BaseViewModel
{
private ObservableCollection<FacultyModel> _faculties = null;
public DepartmentViewModel()
{
this.Faculties = new ObservableCollection<FacultyModel>();
this.LoadData();
}
public void LoadData()
{
this.Faculties.Add(new FacultyModel("Fakultät 1"));
this.Faculties.Add(new FacultyModel("Fakultät 2"));
this.Faculties.Add(new FacultyModel("Fakultät 3"));
this.Faculties.Add(new FacultyModel("Fakultät 4"));
this.Faculties.Add(new FacultyModel("Favoriten"));
}
public ObservableCollection<FacultyModel> Faculties
{
get
{
return _faculties;
}
set
{
if (value != _faculties)
{
_faculties = value;
NotifyPropertyChanged("foodDays");
}
}
}
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
namespace CampusAppWP8.model.departments
{
public class FacultyModel : BaseModel
{
private ObservableCollection<DepartmentModel> _faculties = null;
private string _name;
public FacultyModel()
{
this.Faculties = new ObservableCollection<DepartmentModel>();
this.LoadData();
}
public FacultyModel(string name)
{
_name = name;
this.Faculties = new ObservableCollection<DepartmentModel>();
this.LoadData();
}
public void LoadData()
{
this.Faculties.Add(new DepartmentModel("Institut 1"));
this.Faculties.Add(new DepartmentModel("Institut 2"));
this.Faculties.Add(new DepartmentModel("Institut 3"));
this.Faculties.Add(new DepartmentModel("Institut 4"));
}
public ObservableCollection<DepartmentModel> Faculties
{
get
{
return _faculties;
}
set
{
if (value != _faculties)
{
_faculties = value;
NotifyPropertyChanged("faculty");
}
}
}
public string Name
{
get
{
return _name;
}
set
{
if (value != _name)
{
_name = value;
NotifyPropertyChanged("chair");
}
}
}
}
}

View File

@@ -0,0 +1,58 @@
<phone:PhoneApplicationPage
x:Class="CampusAppWP8.pages.departments.DepartmentPage"
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:viewModel="clr-namespace:CampusAppWP8.model.departments"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
OrientationChanged="PhoneApplicationPage_OrientationChanged"
shell:SystemTray.IsVisible="True">
<phone:PhoneApplicationPage.Resources>
<viewModel:DepartmentViewModel x:Key="DepartmentViewModel" />
</phone:PhoneApplicationPage.Resources>
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.DataContext>
<viewModel:DepartmentViewModel/>
</Grid.DataContext>
<!--Pivotsteuerelement-->
<phone:Pivot Title="{Binding Path=LocalizedResources.DepartmentApp_Title, Source={StaticResource LocalizedStrings}}" ItemsSource="{Binding Faculties}">
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:Pivot.ItemTemplate>
<DataTemplate>
<ScrollViewer>
<phone:LongListSelector ItemsSource="{Binding Faculties}">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Name}" Style="{StaticResource PhoneTextTitle2Style}" />
<phone:LongListSelector ItemsSource="{Binding Chairs}">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</StackPanel>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
</ScrollViewer>
</DataTemplate>
</phone:Pivot.ItemTemplate>
</phone:Pivot>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -0,0 +1,24 @@
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.departments
{
public partial class DepartmentPage : PhoneApplicationPage
{
public DepartmentPage()
{
InitializeComponent();
}
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
{
}
}
}