Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43cfeea2d7 | ||
|
|
d17b4b7e33 | ||
|
|
b78250401c | ||
|
|
d167dbfb9e | ||
|
|
0072df1186 | ||
|
|
218353393e | ||
|
|
de91ac2d76 | ||
|
|
74224a4fc5 | ||
|
|
0ceb0584d1 | ||
|
|
88b664284f | ||
|
|
92614e7128 | ||
|
|
9eff5be228 | ||
|
|
9ebeaa8147 | ||
|
|
b9f268d594 |
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_large.png
Normal file
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_large.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_medium.png
Normal file
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_medium.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_small.png
Normal file
BIN
CampusAppWP8/CampusAppWP8/Assets/Tiles/kachel_small.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.5 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/update_159.png
Normal file
BIN
CampusAppWP8/CampusAppWP8/Assets/icons/DarkTheme/update_159.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.8 KiB |
BIN
CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/update_159.png
Normal file
BIN
CampusAppWP8/CampusAppWP8/Assets/icons/LightTheme/update_159.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
@@ -98,6 +98,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Feed\Departments\DepartmentFavoriteFeed.cs" />
|
||||
<Compile Include="Const.cs" />
|
||||
<Compile Include="Resources\Icons.Designer.cs" />
|
||||
<Compile Include="Utility\Lui\Button\EmailButton.cs" />
|
||||
<Compile Include="Feed\Link\CommonLinkFeed.cs" />
|
||||
<Compile Include="Feed\Link\ClubLinkFeed.cs" />
|
||||
@@ -204,11 +205,6 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Constants.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Resources\Icons.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Icons.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ThemelizedIcons.cs" />
|
||||
<Compile Include="Utility\Api.cs" />
|
||||
<Compile Include="Utility\ApiEventHandler.cs" />
|
||||
@@ -338,6 +334,7 @@
|
||||
<Content Include="Assets\Icons\DarkTheme\favorite_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\info_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\phone_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\update_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\add_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\btulogo_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\campus_159.png" />
|
||||
@@ -366,6 +363,7 @@
|
||||
<Content Include="Assets\Icons\DarkTheme\student_council_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\student_council_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\webmail_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\update_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\webmail_159.png" />
|
||||
<Content Include="Assets\testmap.png" />
|
||||
<Content Include="Assets\Tiles\FlipCycleTileLarge.png">
|
||||
@@ -383,6 +381,9 @@
|
||||
<Content Include="Assets\Tiles\IconicTileSmall.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Assets\Tiles\kachel_large.png" />
|
||||
<Content Include="Assets\Tiles\kachel_medium.png" />
|
||||
<Content Include="Assets\Tiles\kachel_small.png" />
|
||||
<Content Include="README_FIRST.txt" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Cancel.png" />
|
||||
<Content Include="Toolkit.Content\ApplicationBar.Check.png" />
|
||||
@@ -401,8 +402,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Resources\Icons.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Icons.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -28,7 +28,8 @@ namespace CampusAppWP8.Feed.Departments
|
||||
public DepartmentFavoriteFeed(bool autoLoad = true)
|
||||
: base(ModelType.File, Constants.FileDepartment_Favorite_Name, string.Empty)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
@@ -68,7 +69,7 @@ namespace CampusAppWP8.Feed.Departments
|
||||
/// <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 CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
|
||||
private bool CheckIsFileUpToDateOnLoad(DepartmentModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
@@ -76,11 +77,22 @@ namespace CampusAppWP8.Feed.Departments
|
||||
{
|
||||
retValue = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue = (model.HasChanged() == false) ? true : false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <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(DepartmentModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
retValue = (model.HasChanged() == false) ? true : false;
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@ namespace CampusAppWP8.Feed.Departments
|
||||
public DepartmentFeed(bool autoLoad = true)
|
||||
: base(ModelType.FileAndFeed, Constants.FileDepartment_Name, Constants.UrlDepartment_Addr)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
@@ -70,7 +71,7 @@ namespace CampusAppWP8.Feed.Departments
|
||||
/// <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 CheckIsFileUpToDate(DepartmentModel model, FileInfo info)
|
||||
private bool CheckIsFileUpToDateOnLoad(DepartmentModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
@@ -82,19 +83,30 @@ namespace CampusAppWP8.Feed.Departments
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// at saving
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <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(DepartmentModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
// at saving
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
// Protedted
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace CampusAppWP8.Feed.Events
|
||||
public EventFeed(bool autoLoad = true)
|
||||
: base(ModelType.FileAndFeed, Constants.FileEvents_Name, Constants.UrlEvents_Addr)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
@@ -61,7 +62,7 @@ namespace CampusAppWP8.Feed.Events
|
||||
/// <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 CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
|
||||
private bool CheckIsFileUpToDateOnLoad(RSSViewModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
@@ -73,16 +74,26 @@ namespace CampusAppWP8.Feed.Events
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// at saving
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <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(RSSViewModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,9 @@ namespace CampusAppWP8.Feed.News
|
||||
public NewsFeed(bool autoLoad = true)
|
||||
: base(ModelType.FileAndFeed, Constants.FileNews_Name, Constants.UrlNews_Addr)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
|
||||
if (autoLoad == true)
|
||||
{
|
||||
@@ -61,28 +62,37 @@ namespace CampusAppWP8.Feed.News
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">info object of the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(RSSViewModel model, FileInfo info)
|
||||
private bool CheckIsFileUpToDateOnLoad(RSSViewModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
// at loading
|
||||
if (info.Exists == true)
|
||||
{
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 1.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// at saving
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method implement CheckIsFileUpToDate()-Method <see cref="Pages"/>
|
||||
/// </summary>
|
||||
/// <param name="model">model object</param>
|
||||
/// <param name="info">info object of the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(RSSViewModel model, FileInfo info)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
using CampusAppWP8.Model;
|
||||
using CampusAppWP8.Model.Openinghours;
|
||||
using CampusAppWP8.Resources;
|
||||
|
||||
using CampusAppWP8.Utility;
|
||||
|
||||
/// <summary>
|
||||
/// This Class is for MesaFeeds
|
||||
/// </summary>
|
||||
@@ -26,8 +27,9 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
public OpeninghoursFeed()
|
||||
: base(ModelType.FileAndFeed, Constants.FileOpeningHours_OpeningHours, Constants.UrlOpeningHours_OpeningHours)
|
||||
{
|
||||
this.isFileUpToDate += new IsFileUpToDate(this.CheckIsFileUpToDate);
|
||||
this.isModelUpToDate += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
this.isFileUpToDateOnLoad += new IsFileUpToDate(this.CheckIsFileUpToDateOnLoad);
|
||||
this.isFileUpToDateOnSave += new IsFileUpToDate(this.CheckIsFileUpToDateOnSave);
|
||||
this.isModelUpToDateOnLoad += new IsModelUpToDate(this.CheckIsModelUpToDate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -43,35 +45,58 @@ namespace CampusAppWP8.Feed.Openinghours
|
||||
/// <returns>true, if model is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsModelUpToDate(OpeninghoursModel model)
|
||||
{
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
return false;
|
||||
retValue = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, model.CreateTime, 7.0);
|
||||
}
|
||||
|
||||
DateTime lastModified = model.CreateTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="fileInfo">info about the file</param>
|
||||
/// <param name="info">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDate(OpeninghoursModel model, FileInfo fileInfo)
|
||||
private bool CheckIsFileUpToDateOnLoad(OpeninghoursModel model, FileInfo info)
|
||||
{
|
||||
DateTime lastModified = fileInfo.LastWriteTime;
|
||||
return this.CheckIsUpToDate(lastModified);
|
||||
bool retValue = true;
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
if (info.Exists == true)
|
||||
{
|
||||
retValue = Utilities.DayDifference(Utilities.DifferenceType.Less, info.LastWriteTime, 7.0);
|
||||
}
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the model or file is up-to-date.
|
||||
/// Method check if the FeedFile is up-to-date
|
||||
/// </summary>
|
||||
/// <param name="lastModified">Date of the last modification</param>
|
||||
/// <returns>true, if is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsUpToDate(DateTime lastModified)
|
||||
/// <param name="model">reference of the FeedModel</param>
|
||||
/// <param name="info">info about the file</param>
|
||||
/// <returns>true, if file is up-to-date, otherwise false</returns>
|
||||
private bool CheckIsFileUpToDateOnSave(OpeninghoursModel model, FileInfo info)
|
||||
{
|
||||
return true;
|
||||
bool retValue = true;
|
||||
|
||||
if ((info.Exists == false)
|
||||
|| (info.Length == 0))
|
||||
{
|
||||
retValue = false;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace CampusAppWP8.Model.Departments
|
||||
/// Check if the content of the faculty lists hast changed since the
|
||||
/// last call of this function.
|
||||
/// </summary>
|
||||
/// <returns>true, if changes happend since last request, otherwise false</returns>
|
||||
/// <returns>true, if changes happen since last request, otherwise false</returns>
|
||||
public bool HasChanged()
|
||||
{
|
||||
bool retValue = false;
|
||||
|
||||
@@ -221,7 +221,7 @@ namespace CampusAppWP8.Model.Departments
|
||||
/// <summary>
|
||||
/// Return true if there were changes in the chair list, otherwise false.
|
||||
/// </summary>
|
||||
/// <param name="reset">when true, the hasChanged flag will be reseted</param>
|
||||
/// <param name="reset">when true, the hasChanged flag will be reset</param>
|
||||
/// <returns>true, when changed, otherwise false</returns>
|
||||
public bool HasChanged(bool reset = true)
|
||||
{
|
||||
|
||||
@@ -40,9 +40,39 @@ namespace CampusAppWP8.Model.Lecture
|
||||
private List<ListPickerItemModel> semesterList;
|
||||
|
||||
/// <summary>
|
||||
/// List for the number of semester
|
||||
/// List for the number of semester (from)
|
||||
/// </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
|
||||
|
||||
@@ -62,31 +92,101 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// Gets or sets the selected course index
|
||||
/// </summary>
|
||||
[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>
|
||||
/// Gets or sets the selected degree index
|
||||
/// </summary>
|
||||
[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>
|
||||
/// Gets or sets the selected semester-index
|
||||
/// </summary>
|
||||
[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>
|
||||
/// Gets or sets the selected from-index
|
||||
/// </summary>
|
||||
[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>
|
||||
/// Gets or sets the selected to-index
|
||||
/// </summary>
|
||||
[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>
|
||||
/// Gets List for the courses of the BTU
|
||||
@@ -124,11 +224,22 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <summary>
|
||||
/// Gets List for the number of semester
|
||||
/// </summary>
|
||||
public List<ListPickerItemModel> NumberList
|
||||
public List<ListPickerItemModel> FromNumberList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.numberList;
|
||||
return this.fromNumberList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the NumberList
|
||||
/// </summary>
|
||||
public List<ListPickerItemModel> ToNumberList
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.toNumberList;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -144,7 +255,8 @@ namespace CampusAppWP8.Model.Lecture
|
||||
{
|
||||
this.LoadCourseList();
|
||||
this.LoadDegreeList();
|
||||
this.LoadNumberList();
|
||||
this.LoadFromNumberList();
|
||||
this.LoadToNumberList();
|
||||
this.LoadSemesterList();
|
||||
}
|
||||
|
||||
@@ -155,20 +267,55 @@ namespace CampusAppWP8.Model.Lecture
|
||||
/// <summary>
|
||||
/// Load the NumberList
|
||||
/// </summary>
|
||||
private void LoadNumberList()
|
||||
public void LoadFromNumberList()
|
||||
{
|
||||
this.numberList = new List<ListPickerItemModel>();
|
||||
this.numberList.Add(new ListPickerItemModel() { Text = "1", Value = "1" });
|
||||
this.numberList.Add(new ListPickerItemModel() { Text = "2", Value = "2" });
|
||||
this.numberList.Add(new ListPickerItemModel() { Text = "3", Value = "3" });
|
||||
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" });
|
||||
string selectValue = null;
|
||||
if (this.fromNumberList != null)
|
||||
{
|
||||
selectValue = this.fromNumberList[this.SelectFromIndex].Value;
|
||||
}
|
||||
|
||||
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>
|
||||
@@ -244,6 +391,29 @@ namespace CampusAppWP8.Model.Lecture
|
||||
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
|
||||
|
||||
@@ -143,14 +143,25 @@ namespace CampusAppWP8
|
||||
public event OnSaved onSaved = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if file is up to date.
|
||||
/// Callback pointer, for checking if file is up to date at loading.
|
||||
/// </summary>
|
||||
public event IsFileUpToDate isFileUpToDate = null;
|
||||
public event IsFileUpToDate isFileUpToDateOnLoad = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if model is up to date.
|
||||
/// Callback pointer, for checking if file is up to date at saving.
|
||||
/// </summary>
|
||||
public event IsModelUpToDate isModelUpToDate = null;
|
||||
public event IsFileUpToDate isFileUpToDateOnSave = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if model is up to date at loading.
|
||||
/// </summary>
|
||||
public event IsModelUpToDate isModelUpToDateOnLoad = null;
|
||||
|
||||
/// <summary>
|
||||
/// Callback pointer, for checking if model is up to date at saving.
|
||||
/// (currently unused)
|
||||
/// </summary>
|
||||
public event IsModelUpToDate isModelUpToDateOnSave = null;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the I/O type of the model.
|
||||
@@ -216,7 +227,6 @@ namespace CampusAppWP8
|
||||
|
||||
this.api.HttpGet(this.httpApiUri, this.OnLoadDataComplete);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -232,8 +242,8 @@ namespace CampusAppWP8
|
||||
this.onLoading();
|
||||
}
|
||||
|
||||
if (((this.isModelUpToDate == null)
|
||||
|| (this.isModelUpToDate(this.model) == false))
|
||||
if (((this.isModelUpToDateOnLoad == null)
|
||||
|| (this.isModelUpToDateOnLoad(this.model) == false))
|
||||
&& ((this.file != null) || this.api != null))
|
||||
{
|
||||
if (this.file != null)
|
||||
@@ -244,8 +254,8 @@ namespace CampusAppWP8
|
||||
loadFromFile = false;
|
||||
}
|
||||
|
||||
if (((this.isFileUpToDate != null) && (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false))
|
||||
|| (this.isFileUpToDate == null))
|
||||
if (((this.isFileUpToDateOnLoad != null) && (this.isFileUpToDateOnLoad(this.model, this.file.GetFileInfo()) == false))
|
||||
|| (this.isFileUpToDateOnLoad == null))
|
||||
{
|
||||
loadFromFile = false;
|
||||
}
|
||||
@@ -290,7 +300,7 @@ namespace CampusAppWP8
|
||||
public void SaveData()
|
||||
{
|
||||
if ((this.file != null)
|
||||
&& ((this.isFileUpToDate == null) || (this.isFileUpToDate(this.model, this.file.GetFileInfo()) == false)))
|
||||
&& ((this.isFileUpToDateOnSave == null) || (this.isFileUpToDateOnSave(this.model, this.file.GetFileInfo()) == false)))
|
||||
{
|
||||
if (this.onSaving != null)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
namespace CampusAppWP8.Model.RSS
|
||||
{
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
/// <summary>
|
||||
@@ -26,6 +27,7 @@ namespace CampusAppWP8.Model.RSS
|
||||
public RSSChannelModel()
|
||||
{
|
||||
this.item = new ObservableCollection<RSSModel>();
|
||||
this.item.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnListChanged);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,13 +46,25 @@ namespace CampusAppWP8.Model.RSS
|
||||
if (value != this.item)
|
||||
{
|
||||
this.item = value;
|
||||
int i = 0;
|
||||
foreach (RSSModel rssItem in this.item)
|
||||
{
|
||||
rssItem.Index = i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is called when the item list has changed.
|
||||
/// Here used for the add event.
|
||||
/// Set the index of the last list element.
|
||||
/// </summary>
|
||||
/// <param name="sender">item list</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void OnListChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
ObservableCollection<RSSModel> list = sender as ObservableCollection<RSSModel>;
|
||||
|
||||
list[list.Count - 1].Index = list.Count - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,9 @@
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -7,11 +7,14 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.Events
|
||||
{
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.Events;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Overview page of all events.
|
||||
@@ -30,6 +33,12 @@ namespace CampusAppWP8.Pages.Events
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
ApplicationBarIconButton updateBtn = new ApplicationBarIconButton();
|
||||
updateBtn.IconUri = new Uri(Icons.Update, UriKind.Relative);
|
||||
updateBtn.Text = AppResources.UpdateBtn;
|
||||
updateBtn.Click += new EventHandler(this.EventForceUpdate_Click);
|
||||
ApplicationBar.Buttons.Add(updateBtn);
|
||||
|
||||
if (EventIndexPage.eventFeed == null)
|
||||
{
|
||||
EventIndexPage.eventFeed = new EventFeed(false);
|
||||
@@ -66,5 +75,16 @@ namespace CampusAppWP8.Pages.Events
|
||||
{
|
||||
this.EventList.ItemsSource = EventIndexPage.eventFeed.Model.Channel[0].Item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void EventForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
EventIndexPage.eventFeed.ForceWebUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@
|
||||
<!-- LayoutRoot -->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!-- Pivotpage -->
|
||||
<phone:Pivot x:Name="EventPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot x:Name="EventPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" SelectionChanged="OnPivotSelectionChange">
|
||||
<!-- Pivotitem template -->
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
@@ -29,11 +29,10 @@
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid x:Name="EventParentGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<!--<RowDefinition Height="100"/>-->
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="90"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid x:Name="EventTextGrid" Grid.Row="0">
|
||||
@@ -47,14 +46,16 @@
|
||||
<TextBlock x:Name="EventText" Text="{Binding Path=Text, Mode=OneWay}" Height="Auto" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="24" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<phone:WebBrowser x:Name="WebBrowser" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
|
||||
<Button Name="EventHome" Content="{Binding Path=LocalizedResources.NewsHomeBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="EventHome_Click"/>
|
||||
<Button Name="EventLink" Tag="{Binding Path=Link, Mode=OneWay}" Content="{Binding Path=LocalizedResources.NewsLinkBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="EventLink_Click"/>
|
||||
<phone:WebBrowser x:Name="EventWebBrowser" Source="{Binding Path=Link, Mode=OneWay}" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Default" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -8,11 +8,15 @@
|
||||
namespace CampusAppWP8.Pages.Events
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// EventPage, where every event fees has his own PivotItem.
|
||||
@@ -20,16 +24,27 @@ namespace CampusAppWP8.Pages.Events
|
||||
public partial class EventPage : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>
|
||||
/// for checking if the feed source is already set or not.
|
||||
/// To checking if the feed source is already set or not.
|
||||
/// </summary>
|
||||
private bool isSourceSet = false;
|
||||
|
||||
/// <summary>
|
||||
/// To store the last selected pivot index.
|
||||
/// </summary>
|
||||
private int lastSelectedIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="EventPage" /> class.
|
||||
/// </summary>
|
||||
public EventPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
ApplicationBarIconButton linkBtn = new ApplicationBarIconButton();
|
||||
linkBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
|
||||
linkBtn.Text = AppResources.NewsLinkBtn;
|
||||
linkBtn.Click += new EventHandler(this.EventLink_Click);
|
||||
ApplicationBar.Buttons.Add(linkBtn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -52,7 +67,7 @@ namespace CampusAppWP8.Pages.Events
|
||||
string pivotIndex = string.Empty;
|
||||
|
||||
// Navigate to the selected pivotitem
|
||||
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
|
||||
if (NavigationContext.QueryString.TryGetValue(Constants.ParamPivotIndex, out pivotIndex))
|
||||
{
|
||||
int pivotIndexInt = int.Parse(pivotIndex);
|
||||
|
||||
@@ -63,21 +78,35 @@ namespace CampusAppWP8.Pages.Events
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("ERROR: pivotIndex out of range!!!");
|
||||
string o = string.Empty;
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in NavigationContext.QueryString)
|
||||
{
|
||||
o += string.Format("Key = {0}, Value = {1}", kvp.Key, kvp.Value) + "\n";
|
||||
}
|
||||
|
||||
MessageBox.Show("ERROR: pivotIndex out of range!!! (" + o + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the home button (lower left).
|
||||
/// Navigate back to the event index page.
|
||||
/// Called when the index of the selected PivotItem is changed.
|
||||
/// Set the text Grid to visible and the WebBrowser to collapsed.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="sender">parent pivot object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void EventHome_Click(object sender, RoutedEventArgs e)
|
||||
private void OnPivotSelectionChange(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// Navigate back to the event index page
|
||||
NavigationService.GoBack();
|
||||
int selIndex = (sender as Pivot).SelectedIndex;
|
||||
|
||||
if (this.lastSelectedIndex > -1)
|
||||
{
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventWebBrowser", Visibility.Collapsed, this.lastSelectedIndex);
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Visible, this.lastSelectedIndex);
|
||||
}
|
||||
|
||||
this.lastSelectedIndex = selIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -87,41 +116,17 @@ namespace CampusAppWP8.Pages.Events
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void EventLink_Click(object sender, RoutedEventArgs e)
|
||||
private void EventLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
FrameworkElement fe = sender as FrameworkElement;
|
||||
|
||||
// Open the webbrowser
|
||||
Grid grfe = fe.Parent as Grid;
|
||||
FrameworkElement eventTextGrid = null;
|
||||
FrameworkElement eventWeb = null;
|
||||
|
||||
foreach (FrameworkElement tempElem in grfe.Children)
|
||||
if (Visibility.Visible == Utilities.GetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", this.EventPivot.SelectedIndex))
|
||||
{
|
||||
if (tempElem.Name == "EventTextGrid")
|
||||
{
|
||||
eventTextGrid = tempElem;
|
||||
}
|
||||
else if (tempElem.Name == "WebBrowser")
|
||||
{
|
||||
eventWeb = tempElem;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Collapsed, this.EventPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventWebBrowser", Visibility.Visible, this.EventPivot.SelectedIndex);
|
||||
}
|
||||
|
||||
if ((eventTextGrid != null)
|
||||
&& (eventWeb != null))
|
||||
else
|
||||
{
|
||||
if (eventTextGrid.Visibility == Visibility.Visible)
|
||||
{
|
||||
eventTextGrid.Visibility = Visibility.Collapsed;
|
||||
eventWeb.Visibility = Visibility.Visible;
|
||||
(eventWeb as WebBrowser).Navigate(new Uri(fe.Tag.ToString(), UriKind.Absolute));
|
||||
}
|
||||
else
|
||||
{
|
||||
eventWeb.Visibility = Visibility.Collapsed;
|
||||
eventTextGrid.Visibility = Visibility.Visible;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventWebBrowser", Visibility.Collapsed, this.EventPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.EventPivot, "EventParentGrid", "EventTextGrid", Visibility.Visible, this.EventPivot.SelectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<StackPanel >
|
||||
<!-- Listpicket of degree-->
|
||||
<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>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
@@ -100,7 +100,7 @@
|
||||
<!-- Listpicket of semesters(from to) -->
|
||||
<TextBlock Text="{Binding Path=LocalizedResources.LectureApp_Term, Source={StaticResource LocalizedStrings}}"/>
|
||||
<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>
|
||||
<DataTemplate>
|
||||
<StackPanel>
|
||||
|
||||
@@ -39,6 +39,11 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
/// </remarks>
|
||||
private LecturePageModel pageModel;
|
||||
|
||||
/// <summary>
|
||||
/// flag for initialed page
|
||||
/// </summary>
|
||||
private bool init;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@@ -48,8 +53,10 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
public LecturePage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.init = false;
|
||||
this.LoadPageModel();
|
||||
this.SetupListPickers();
|
||||
this.init = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -98,8 +105,8 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
{
|
||||
this.Course.ItemsSource = this.pageModel.CourseList;
|
||||
this.Degree.ItemsSource = this.pageModel.DegreeList;
|
||||
this.From.ItemsSource = this.pageModel.NumberList;
|
||||
this.To.ItemsSource = this.pageModel.NumberList;
|
||||
this.From.ItemsSource = this.pageModel.FromNumberList;
|
||||
this.To.ItemsSource = this.pageModel.ToNumberList;
|
||||
this.Semester.ItemsSource = this.pageModel.SemesterList;
|
||||
|
||||
// load values from last request
|
||||
@@ -198,6 +205,41 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
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
|
||||
|
||||
@@ -44,4 +44,8 @@
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Minimized" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -7,11 +7,12 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Pages.News
|
||||
{
|
||||
using System.Linq;
|
||||
using System;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Feed.News;
|
||||
using CampusAppWP8.Utility;
|
||||
using CampusAppWP8.Resources;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Overview page of all news.
|
||||
@@ -30,6 +31,12 @@ namespace CampusAppWP8.Pages.News
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
ApplicationBarIconButton updateBtn = new ApplicationBarIconButton();
|
||||
updateBtn.IconUri = new Uri(Icons.Update, UriKind.Relative);
|
||||
updateBtn.Text = AppResources.UpdateBtn;
|
||||
updateBtn.Click += new EventHandler(this.NewsForceUpdate_Click);
|
||||
ApplicationBar.Buttons.Add(updateBtn);
|
||||
|
||||
if (NewsIndexPage.newsFeed == null)
|
||||
{
|
||||
NewsIndexPage.newsFeed = new NewsFeed(false);
|
||||
@@ -66,5 +73,16 @@ namespace CampusAppWP8.Pages.News
|
||||
{
|
||||
this.NewsList.ItemsSource = NewsIndexPage.newsFeed.Model.Channel[0].Item;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the update button in the ApplicationBar.
|
||||
/// Force a data update from the web.
|
||||
/// </summary>
|
||||
/// <param name="sender">button object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void NewsForceUpdate_Click(object sender, EventArgs e)
|
||||
{
|
||||
NewsIndexPage.newsFeed.ForceWebUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<!-- LayoutRoot -->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<!-- Pivotpage -->
|
||||
<phone:Pivot x:Name="NewsPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}">
|
||||
<phone:Pivot x:Name="NewsPivot" Title="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" SelectionChanged="OnPivotSelectionChange">
|
||||
<!-- Pivotitem template -->
|
||||
<phone:Pivot.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
@@ -29,10 +29,9 @@
|
||||
</phone:Pivot.HeaderTemplate>
|
||||
<phone:Pivot.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<Grid x:Name="NewsParentGrid">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="90"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Grid x:Name="NewsTextGrid" Grid.Row="0">
|
||||
@@ -47,13 +46,15 @@
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<phone:WebBrowser x:Name="WebBrowser" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
|
||||
<Button Name="NewsHome" Content="{Binding Path=LocalizedResources.NewsHomeBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Click="NewsHome_Click"/>
|
||||
<Button Name="NewsLink" Tag="{Binding Path=Link, Mode=OneWay}" Content="{Binding Path=LocalizedResources.NewsLinkBtn, Source={StaticResource LocalizedStrings}}" Grid.Row="1" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="NewsLink_Click"/>
|
||||
<phone:WebBrowser x:Name="NewsWebBrowser" Source="{Binding Path=Link, Mode=OneWay}" Grid.Row="0" IsScriptEnabled="True" Visibility="Collapsed"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</phone:Pivot.ItemTemplate>
|
||||
</phone:Pivot>
|
||||
</Grid>
|
||||
|
||||
<phone:PhoneApplicationPage.ApplicationBar>
|
||||
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="False" Mode="Default" Opacity="1.0" >
|
||||
</shell:ApplicationBar>
|
||||
</phone:PhoneApplicationPage.ApplicationBar>
|
||||
</phone:PhoneApplicationPage>
|
||||
|
||||
@@ -13,8 +13,11 @@ namespace CampusAppWP8.Pages.News
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWP8.Utility;
|
||||
using Microsoft.Phone.Controls;
|
||||
|
||||
using Microsoft.Phone.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// EventPage, where every news fees has his own PivotItem.
|
||||
/// </summary>
|
||||
@@ -25,12 +28,23 @@ namespace CampusAppWP8.Pages.News
|
||||
/// </summary>
|
||||
private bool isSourceSet = false;
|
||||
|
||||
/// <summary>
|
||||
/// To store the index of the last selected PivotItem.
|
||||
/// </summary>
|
||||
private int lastSelectedIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewsPage" /> class.
|
||||
/// </summary>
|
||||
public NewsPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
ApplicationBarIconButton linkBtn = new ApplicationBarIconButton();
|
||||
linkBtn.IconUri = new Uri(Icons.Link, UriKind.Relative);
|
||||
linkBtn.Text = AppResources.NewsLinkBtn;
|
||||
linkBtn.Click += new EventHandler(this.NewsLink_Click);
|
||||
ApplicationBar.Buttons.Add(linkBtn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,7 +67,7 @@ namespace CampusAppWP8.Pages.News
|
||||
string pivotIndex = string.Empty;
|
||||
|
||||
// Navigate to the selected pivotitem
|
||||
if (NavigationContext.QueryString.TryGetValue("pivotindex", out pivotIndex))
|
||||
if (NavigationContext.QueryString.TryGetValue(Constants.ParamPivotIndex, out pivotIndex))
|
||||
{
|
||||
int pivotIndexInt = int.Parse(pivotIndex);
|
||||
|
||||
@@ -70,15 +84,22 @@ namespace CampusAppWP8.Pages.News
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// On clicking the home button (lower left).
|
||||
/// Navigate back to the news index page.
|
||||
/// Called when the index of the selected PivotItem is changed.
|
||||
/// Set the text Grid to visible and the WebBrowser to collapsed.
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="sender">parent pivot object</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void NewsHome_Click(object sender, RoutedEventArgs e)
|
||||
private void OnPivotSelectionChange(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
// Navigate back to the news index page
|
||||
NavigationService.GoBack();
|
||||
int selIndex = (sender as Pivot).SelectedIndex;
|
||||
|
||||
if (this.lastSelectedIndex > -1)
|
||||
{
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsWebBrowser", Visibility.Collapsed, this.lastSelectedIndex);
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", Visibility.Visible, this.lastSelectedIndex);
|
||||
}
|
||||
|
||||
this.lastSelectedIndex = selIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -88,41 +109,17 @@ namespace CampusAppWP8.Pages.News
|
||||
/// </summary>
|
||||
/// <param name="sender">clicked button</param>
|
||||
/// <param name="e">event args</param>
|
||||
private void NewsLink_Click(object sender, RoutedEventArgs e)
|
||||
private void NewsLink_Click(object sender, EventArgs e)
|
||||
{
|
||||
FrameworkElement fe = sender as FrameworkElement;
|
||||
|
||||
// Open the webbrowser
|
||||
Grid grfe = fe.Parent as Grid;
|
||||
FrameworkElement newsTextGrid = null;
|
||||
FrameworkElement newsWeb = null;
|
||||
|
||||
foreach (FrameworkElement tempElem in grfe.Children)
|
||||
if (Visibility.Visible == Utilities.GetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", this.NewsPivot.SelectedIndex))
|
||||
{
|
||||
if (tempElem.Name == "NewsTextGrid")
|
||||
{
|
||||
newsTextGrid = tempElem;
|
||||
}
|
||||
else if (tempElem.Name == "WebBrowser")
|
||||
{
|
||||
newsWeb = tempElem;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", Visibility.Collapsed, this.NewsPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsWebBrowser", Visibility.Visible, this.NewsPivot.SelectedIndex);
|
||||
}
|
||||
|
||||
if ((newsTextGrid != null)
|
||||
&& (newsWeb != null))
|
||||
else
|
||||
{
|
||||
if (newsTextGrid.Visibility == Visibility.Visible)
|
||||
{
|
||||
newsTextGrid.Visibility = Visibility.Collapsed;
|
||||
newsWeb.Visibility = Visibility.Visible;
|
||||
(newsWeb as WebBrowser).Navigate(new Uri(fe.Tag.ToString(), UriKind.Absolute));
|
||||
}
|
||||
else
|
||||
{
|
||||
newsWeb.Visibility = Visibility.Collapsed;
|
||||
newsTextGrid.Visibility = Visibility.Visible;
|
||||
}
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsWebBrowser", Visibility.Collapsed, this.NewsPivot.SelectedIndex);
|
||||
Utilities.SetElementVisibility(this.NewsPivot, "NewsParentGrid", "NewsTextGrid", Visibility.Visible, this.NewsPivot.SelectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
<Tokens>
|
||||
<PrimaryToken TokenID="CampusAppWP8Token" TaskName="_default">
|
||||
<TemplateFlip>
|
||||
<SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileSmall.png</SmallImageURI>
|
||||
<SmallImageURI IsRelative="true" IsResource="false">Assets\Tiles\kachel_small.png</SmallImageURI>
|
||||
<Count>0</Count>
|
||||
<BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\FlipCycleTileMedium.png</BackgroundImageURI>
|
||||
<BackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\kachel_medium.png</BackgroundImageURI>
|
||||
<Title>CampusAppWP8</Title>
|
||||
<BackContent>
|
||||
</BackContent>
|
||||
@@ -29,10 +29,13 @@
|
||||
</BackBackgroundImageURI>
|
||||
<BackTitle>
|
||||
</BackTitle>
|
||||
<LargeBackgroundImageURI IsRelative="true" IsResource="false">Assets\Tiles\kachel_large.png</LargeBackgroundImageURI>
|
||||
<LargeBackContent />
|
||||
<LargeBackBackgroundImageURI IsRelative="true" IsResource="false">
|
||||
</LargeBackBackgroundImageURI>
|
||||
<DeviceLockImageURI>
|
||||
</DeviceLockImageURI>
|
||||
<HasLarge>
|
||||
</HasLarge>
|
||||
<HasLarge>True</HasLarge>
|
||||
</TemplateFlip>
|
||||
</PrimaryToken>
|
||||
</Tokens>
|
||||
|
||||
@@ -645,6 +645,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Aktualisieren ähnelt.
|
||||
/// </summary>
|
||||
public static string UpdateBtn {
|
||||
get {
|
||||
return ResourceManager.GetString("UpdateBtn", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die Willkommen zur BTU-CampusApp WP8 ähnelt.
|
||||
/// </summary>
|
||||
|
||||
@@ -317,4 +317,7 @@
|
||||
<data name="LinkApp_CommonLinks" xml:space="preserve">
|
||||
<value>allg. Links</value>
|
||||
</data>
|
||||
<data name="UpdateBtn" xml:space="preserve">
|
||||
<value>Aktualisieren</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -255,6 +255,17 @@ namespace CampusAppWP8.Resources
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the uri string of the update icon.
|
||||
/// </summary>
|
||||
public static string Update
|
||||
{
|
||||
get
|
||||
{
|
||||
return Themerize("Update");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the theme depending string of a icon.
|
||||
/// </summary>
|
||||
|
||||
@@ -165,6 +165,9 @@
|
||||
<data name="StudentCouncil" xml:space="preserve">
|
||||
<value>student_council_159.png</value>
|
||||
</data>
|
||||
<data name="Update" xml:space="preserve">
|
||||
<value>update_159.png</value>
|
||||
</data>
|
||||
<data name="WebMail" xml:space="preserve">
|
||||
<value>webmail_159.png</value>
|
||||
</data>
|
||||
|
||||
@@ -8,19 +8,61 @@
|
||||
namespace CampusAppWP8.Utility
|
||||
{
|
||||
using System;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
|
||||
/// <summary>
|
||||
/// Collection of utility functions.
|
||||
/// </summary>
|
||||
public static class Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Comparison types.
|
||||
/// </summary>
|
||||
public enum DifferenceType
|
||||
{
|
||||
/// <summary>
|
||||
/// Compare Equality.
|
||||
/// </summary>
|
||||
Equal,
|
||||
|
||||
/// <summary>
|
||||
/// Compare if less.
|
||||
/// </summary>
|
||||
Less,
|
||||
|
||||
/// <summary>
|
||||
/// Compare equality or less.
|
||||
/// </summary>
|
||||
LessEqual,
|
||||
|
||||
/// <summary>
|
||||
/// Compare greater.
|
||||
/// </summary>
|
||||
Greater,
|
||||
|
||||
/// <summary>
|
||||
/// Compare equality or greater.
|
||||
/// </summary>
|
||||
GreaterEqual
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares the difference between a specified DateTime and Now
|
||||
/// and the specified time difference (in Days).
|
||||
/// <example>
|
||||
/// When type is DifferenceType.Less, the timespan between Now and date
|
||||
/// is 5.0 (days) and totalDiff is 7.0, the function will return true,
|
||||
/// because the timespan is Less then 7.0 .
|
||||
/// </example>
|
||||
/// </summary>
|
||||
/// <param name="type">comparison type</param>
|
||||
/// <param name="date">date to check</param>
|
||||
/// <param name="totalDiff">difference to check</param>
|
||||
/// <returns>true, if the comparison condition do not fail</returns>
|
||||
public static bool DayDifference(DifferenceType type, DateTime date, double totalDiff)
|
||||
{
|
||||
bool retValue = false;
|
||||
@@ -53,5 +95,95 @@ namespace CampusAppWP8.Utility
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a list of child UIElements of the root object with the specified element name.
|
||||
/// </summary>
|
||||
/// <param name="rootObj">root object</param>
|
||||
/// <param name="elemName">name of the element(s)</param>
|
||||
/// <returns>list of elements</returns>
|
||||
public static List<DependencyObject> GetChild(DependencyObject rootObj, string elemName)
|
||||
{
|
||||
List<DependencyObject> retValue = new List<DependencyObject>();
|
||||
|
||||
for (int k = 0; k < VisualTreeHelper.GetChildrenCount(rootObj); k++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(rootObj, k);
|
||||
|
||||
if ((child as FrameworkElement).Name.Equals(elemName))
|
||||
{
|
||||
retValue.Add(child);
|
||||
}
|
||||
|
||||
var ret = retValue.Concat<DependencyObject>(GetChild(child as DependencyObject, elemName));
|
||||
retValue = ret.ToList<DependencyObject>();
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Search for a UIElement with the specified name in the parent Grid and set its visibility.
|
||||
/// </summary>
|
||||
/// <param name="rootObj">root object</param>
|
||||
/// <param name="parentGridName">name of the parent grid</param>
|
||||
/// <param name="elemName">name of the UIElement</param>
|
||||
/// <param name="vis">new visibility property state</param>
|
||||
/// <param name="index">index of the element in the parent child list</param>
|
||||
public static void SetElementVisibility(DependencyObject rootObj, string parentGridName, string elemName, Visibility vis, int index = 0)
|
||||
{
|
||||
List<DependencyObject> l = Utilities.GetChild(rootObj, parentGridName);
|
||||
Grid parentGrid = l[index] as Grid;
|
||||
FrameworkElement elem = null;
|
||||
|
||||
foreach (FrameworkElement tempElem in parentGrid.Children)
|
||||
{
|
||||
if (tempElem.Name == elemName)
|
||||
{
|
||||
elem = tempElem;
|
||||
}
|
||||
}
|
||||
|
||||
if (elem != null)
|
||||
{
|
||||
elem.Visibility = vis;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the visibility property of a UIElement which is a child object of the specified parent grid element.
|
||||
/// </summary>
|
||||
/// <param name="rootObj">root object</param>
|
||||
/// <param name="parentGridName">name of the parent grid</param>
|
||||
/// <param name="elemName">name of the element</param>
|
||||
/// <param name="index">index of the element in the child list of the parent</param>
|
||||
/// <returns>visibility state</returns>
|
||||
public static Visibility GetElementVisibility(DependencyObject rootObj, string parentGridName, string elemName, int index = 0)
|
||||
{
|
||||
Visibility retValue;
|
||||
|
||||
List<DependencyObject> l = Utilities.GetChild(rootObj, parentGridName);
|
||||
Grid parentGrid = l[index] as Grid;
|
||||
FrameworkElement elem = null;
|
||||
|
||||
foreach (FrameworkElement tempElem in parentGrid.Children)
|
||||
{
|
||||
if (tempElem.Name == elemName)
|
||||
{
|
||||
elem = tempElem;
|
||||
}
|
||||
}
|
||||
|
||||
if (elem != null)
|
||||
{
|
||||
retValue = elem.Visibility;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException("Could not find a UIElement with name (" + elemName + ")");
|
||||
}
|
||||
|
||||
return retValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user