Merge branch 'release/r#119' into develmaster
This commit is contained in:
@@ -40,9 +40,39 @@ namespace CampusAppWP8.Model.Lecture
|
|||||||
private List<ListPickerItemModel> semesterList;
|
private List<ListPickerItemModel> semesterList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List for the number of semester
|
/// List for the number of semester (from)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<ListPickerItemModel> numberList;
|
private List<ListPickerItemModel> fromNumberList;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List for the number of semester (to)
|
||||||
|
/// </summary>
|
||||||
|
private List<ListPickerItemModel> toNumberList;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Variable for the courseIndex
|
||||||
|
/// </summary>
|
||||||
|
private int selectCourseIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Variable for the degreeIndex
|
||||||
|
/// </summary>
|
||||||
|
private int selectDegreeIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Variable for the semesterIndex
|
||||||
|
/// </summary>
|
||||||
|
private int selectSemesterIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Variable for the fromIndex
|
||||||
|
/// </summary>
|
||||||
|
private int selectFromIndex;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Variable for the toIndex
|
||||||
|
/// </summary>
|
||||||
|
private int selectToIndex;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -62,31 +92,101 @@ namespace CampusAppWP8.Model.Lecture
|
|||||||
/// Gets or sets the selected course index
|
/// Gets or sets the selected course index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public int SelectCourseIndex { get; set; }
|
public int SelectCourseIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.selectCourseIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this.selectCourseIndex && this.courseList != null && value < this.courseList.Count)
|
||||||
|
{
|
||||||
|
this.selectCourseIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the selected degree index
|
/// Gets or sets the selected degree index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public int SelectDegreeIndex { get; set; }
|
public int SelectDegreeIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.selectDegreeIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this.selectDegreeIndex && this.degreeList != null && value < this.degreeList.Count)
|
||||||
|
{
|
||||||
|
this.selectDegreeIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the selected semester-index
|
/// Gets or sets the selected semester-index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public int SelectSemesterIndex { get; set; }
|
public int SelectSemesterIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.selectSemesterIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this.selectSemesterIndex && this.semesterList != null && value < this.semesterList.Count)
|
||||||
|
{
|
||||||
|
this.selectSemesterIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the selected from-index
|
/// Gets or sets the selected from-index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public int SelectFromIndex { get; set; }
|
public int SelectFromIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.selectFromIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this.selectFromIndex && this.fromNumberList != null && value < this.fromNumberList.Count)
|
||||||
|
{
|
||||||
|
this.selectFromIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the selected to-index
|
/// Gets or sets the selected to-index
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public int SelectToIndex { get; set; }
|
public int SelectToIndex
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.selectToIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value != this.selectToIndex && this.toNumberList != null && value < this.toNumberList.Count)
|
||||||
|
{
|
||||||
|
this.selectToIndex = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets List for the courses of the BTU
|
/// Gets List for the courses of the BTU
|
||||||
@@ -124,11 +224,22 @@ namespace CampusAppWP8.Model.Lecture
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets List for the number of semester
|
/// Gets List for the number of semester
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ListPickerItemModel> NumberList
|
public List<ListPickerItemModel> FromNumberList
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.numberList;
|
return this.fromNumberList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the NumberList
|
||||||
|
/// </summary>
|
||||||
|
public List<ListPickerItemModel> ToNumberList
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.toNumberList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -144,7 +255,8 @@ namespace CampusAppWP8.Model.Lecture
|
|||||||
{
|
{
|
||||||
this.LoadCourseList();
|
this.LoadCourseList();
|
||||||
this.LoadDegreeList();
|
this.LoadDegreeList();
|
||||||
this.LoadNumberList();
|
this.LoadFromNumberList();
|
||||||
|
this.LoadToNumberList();
|
||||||
this.LoadSemesterList();
|
this.LoadSemesterList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,20 +267,55 @@ namespace CampusAppWP8.Model.Lecture
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load the NumberList
|
/// Load the NumberList
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void LoadNumberList()
|
public void LoadFromNumberList()
|
||||||
{
|
{
|
||||||
this.numberList = new List<ListPickerItemModel>();
|
string selectValue = null;
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "1", Value = "1" });
|
if (this.fromNumberList != null)
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "2", Value = "2" });
|
{
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "3", Value = "3" });
|
selectValue = this.fromNumberList[this.SelectFromIndex].Value;
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "4", Value = "4" });
|
}
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "5" });
|
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "5", Value = "6" });
|
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "7", Value = "7" });
|
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "8", Value = "8" });
|
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "9", Value = "9" });
|
|
||||||
this.numberList.Add(new ListPickerItemModel() { Text = "10", Value = "10" });
|
|
||||||
|
|
||||||
|
this.fromNumberList = this.CreateNumberList(1, 10);
|
||||||
|
this.SelectFromIndex = this.GetIndexOrDefault(this.fromNumberList, selectValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load the NumberList
|
||||||
|
/// </summary>
|
||||||
|
public void LoadToNumberList()
|
||||||
|
{
|
||||||
|
string selectValue = null;
|
||||||
|
if (this.toNumberList != null)
|
||||||
|
{
|
||||||
|
selectValue = this.toNumberList[this.SelectToIndex].Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.toNumberList = this.CreateNumberList(this.SelectFromIndex + 1, 10);
|
||||||
|
this.SelectToIndex = this.GetIndexOrDefault(this.toNumberList, selectValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Method create a NumberList
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="startvalue">startValue of the list</param>
|
||||||
|
/// <param name="endvalue">endValue of the list</param>
|
||||||
|
/// <returns>return list</returns>
|
||||||
|
private List<ListPickerItemModel> CreateNumberList(int startvalue, int endvalue)
|
||||||
|
{
|
||||||
|
List<ListPickerItemModel> list = new List<ListPickerItemModel>();
|
||||||
|
string degree = this.DegreeList[this.SelectDegreeIndex].Value;
|
||||||
|
|
||||||
|
for (int i = startvalue; i <= endvalue; i++)
|
||||||
|
{
|
||||||
|
if ((i > 4 && "88".Equals(degree)) || (i > 6 && "82".Equals(degree)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.Add(new ListPickerItemModel() { Text = i.ToString(), Value = i.ToString() });
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -244,6 +391,29 @@ namespace CampusAppWP8.Model.Lecture
|
|||||||
this.courseList = this.courseList.OrderBy(o => o.Text).ToList();
|
this.courseList = this.courseList.OrderBy(o => o.Text).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Method return a the Index of an item which has a certain value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="list">list for items</param>
|
||||||
|
/// <param name="value">a certain value</param>
|
||||||
|
/// <returns>return index of value or default(0)</returns>
|
||||||
|
private int GetIndexOrDefault(List<ListPickerItemModel> list, string value)
|
||||||
|
{
|
||||||
|
int index = 0;
|
||||||
|
int i = 0;
|
||||||
|
foreach (ListPickerItemModel item in list)
|
||||||
|
{
|
||||||
|
if (item.Value.Equals(value))
|
||||||
|
{
|
||||||
|
index = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return index;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
<StackPanel >
|
<StackPanel >
|
||||||
<!-- Listpicket of degree-->
|
<!-- Listpicket of degree-->
|
||||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Degree, Source={StaticResource LocalizedStrings}}"/>
|
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Degree, Source={StaticResource LocalizedStrings}}"/>
|
||||||
<toolkit:ListPicker Name="Degree" ExpansionMode="FullScreenOnly">
|
<toolkit:ListPicker Name="Degree" ExpansionMode="FullScreenOnly" SelectionChanged="DegreeSelectionChanged">
|
||||||
<toolkit:ListPicker.ItemTemplate>
|
<toolkit:ListPicker.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
<!-- Listpicket of semesters(from to) -->
|
<!-- Listpicket of semesters(from to) -->
|
||||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Term, Source={StaticResource LocalizedStrings}}"/>
|
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Term, Source={StaticResource LocalizedStrings}}"/>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<toolkit:ListPicker Width="60" Name="From" ExpansionMode="FullScreenOnly">
|
<toolkit:ListPicker Width="60" Name="From" ExpansionMode="FullScreenOnly" SelectionChanged="FromSelectionChanged">
|
||||||
<toolkit:ListPicker.ItemTemplate>
|
<toolkit:ListPicker.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ namespace CampusAppWP8.Pages.Lecture
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
private LecturePageModel pageModel;
|
private LecturePageModel pageModel;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// flag for initialed page
|
||||||
|
/// </summary>
|
||||||
|
private bool init;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
@@ -48,8 +53,10 @@ namespace CampusAppWP8.Pages.Lecture
|
|||||||
public LecturePage()
|
public LecturePage()
|
||||||
{
|
{
|
||||||
this.InitializeComponent();
|
this.InitializeComponent();
|
||||||
|
this.init = false;
|
||||||
this.LoadPageModel();
|
this.LoadPageModel();
|
||||||
this.SetupListPickers();
|
this.SetupListPickers();
|
||||||
|
this.init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -98,8 +105,8 @@ namespace CampusAppWP8.Pages.Lecture
|
|||||||
{
|
{
|
||||||
this.Course.ItemsSource = this.pageModel.CourseList;
|
this.Course.ItemsSource = this.pageModel.CourseList;
|
||||||
this.Degree.ItemsSource = this.pageModel.DegreeList;
|
this.Degree.ItemsSource = this.pageModel.DegreeList;
|
||||||
this.From.ItemsSource = this.pageModel.NumberList;
|
this.From.ItemsSource = this.pageModel.FromNumberList;
|
||||||
this.To.ItemsSource = this.pageModel.NumberList;
|
this.To.ItemsSource = this.pageModel.ToNumberList;
|
||||||
this.Semester.ItemsSource = this.pageModel.SemesterList;
|
this.Semester.ItemsSource = this.pageModel.SemesterList;
|
||||||
|
|
||||||
// load values from last request
|
// load values from last request
|
||||||
@@ -198,6 +205,41 @@ namespace CampusAppWP8.Pages.Lecture
|
|||||||
NavigationService.Navigate(url);
|
NavigationService.Navigate(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventHandler for changed degree selection
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">sender object</param>
|
||||||
|
/// <param name="e">some args</param>
|
||||||
|
private void DegreeSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!this.init)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex;
|
||||||
|
this.pageModel.LoadFromNumberList();
|
||||||
|
this.From.ItemsSource = this.pageModel.FromNumberList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// EventHandler for changed from selection
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender">sender object</param>
|
||||||
|
/// <param name="e">some args</param>
|
||||||
|
private void FromSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!this.init)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pageModel.SelectDegreeIndex = this.Degree.SelectedIndex;
|
||||||
|
this.pageModel.SelectFromIndex = this.From.SelectedIndex;
|
||||||
|
this.pageModel.LoadToNumberList();
|
||||||
|
this.To.ItemsSource = this.pageModel.ToNumberList;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user