add todefault button and refreshpage interface

This commit is contained in:
stubbfel
2013-11-25 16:34:51 +01:00
parent 3a7be7d754
commit 8e5d761748
5 changed files with 101 additions and 4 deletions

View File

@@ -147,7 +147,8 @@
<Compile Include="Pages\Setting\FunctionSettingPage.xaml.cs">
<DependentUpon>FunctionSettingPage.xaml</DependentUpon>
</Compile>
<Compile Include="Pages\Setting\MensaSetting.cs" />
<Compile Include="Pages\Setting\IRefreshingPage.cs" />
<Compile Include="Model\Setting\MensaSetting.cs" />
<Compile Include="Pages\TimeTable\Appointment.xaml.cs">
<DependentUpon>Appointment.xaml</DependentUpon>
</Compile>
@@ -259,6 +260,7 @@
<Compile Include="Utility\Lui\Button\AddButton.cs" />
<Compile Include="Utility\Lui\Button\AddPersonButton.cs" />
<Compile Include="Utility\Lui\Button\DelButton.cs" />
<Compile Include="Utility\Lui\Button\ToDefaultButton.cs" />
<Compile Include="Utility\Lui\Header\DefaultHeader.xaml.cs">
<DependentUpon>DefaultHeader.xaml</DependentUpon>
</Compile>

View File

@@ -8,7 +8,6 @@
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Setting
{
using CampusAppWP8.Pages.Setting;
/// <summary> A function settings. </summary>
/// <remarks> Stubbfel, 25.11.2013. </remarks>

View File

@@ -6,9 +6,8 @@
// <date>25.11.2013</date>
// <summary>Implements the mensa setting class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Setting
namespace CampusAppWP8.Model.Setting
{
using CampusAppWP8.Model.Setting;
using CampusAppWP8.Resources;
/// <summary> A mensa setting. </summary>

View File

@@ -0,0 +1,18 @@
//-----------------------------------------------------------------------
// <copyright file="IRefreshingPage.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>25.11.2013</date>
// <summary>Declares the IRefreshingPage interface</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Setting
{
/// <summary> Interface for refreshing page. </summary>
/// <remarks> Stubbfel, 25.11.2013. </remarks>
public interface IRefreshingPage
{
/// <summary> Refresh page. </summary>
void RefreshPage();
}
}

View File

@@ -0,0 +1,79 @@
//-----------------------------------------------------------------------
// <copyright file="ToDefaultButton.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>25.11.2013</date>
// <summary>Implements to default button class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Utility.Lui.Button
{
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using CampusAppWP8.Resources;
using CampusAppWP8.Pages.Setting;
/// <summary> Add person button. </summary>
/// <remarks> Stubbfel, 12.09.2013. </remarks>
/// <seealso cref="T:System.Windows.Controls.Button"/>
public class ToDefaultButton : System.Windows.Controls.Button
{
#region Member
/// <summary> The person identifier property. </summary>
public static readonly DependencyProperty SettingTypeProperty = DependencyProperty.Register("SettingType", typeof(object), typeof(ToDefaultButton), new PropertyMetadata(false));
/// <summary> The icon. </summary>
private static BitmapImage icon = new BitmapImage(new Uri(Icons.Link, UriKind.Relative));
#endregion
#region Constructor
/// <summary> Initializes a new instance of the ToDefaultButton class. </summary>
/// <remarks> Stubbfel, 25.11.2013. </remarks>
public ToDefaultButton()
: base()
{
this.Content = new Image
{
Source = icon
};
}
#endregion
#region Property
/// <summary> Gets or sets the type of the setting. </summary>
/// <value> The type of the setting. </value>
public object SettingType
{
get { return (object)this.GetValue(SettingTypeProperty); }
set { this.SetValue(SettingTypeProperty, value); }
}
/// <summary>
/// Löst das <see cref="E:System.Windows.Controls.Primitives.ButtonBase.Click" />-Ereignis
/// aus.
/// </summary>
/// <remarks> Stubbfel, 25.11.2013. </remarks>
/// <seealso cref="M:System.Windows.Controls.Button.OnClick()"/>
protected override void OnClick()
{
if (this.SettingType != null)
{
Settings.SetSettingToDefault(this.SettingType.ToString());
Page page = App.RootFrame.Content as Page;
if (page.GetType().IsAssignableFrom(typeof(IRefreshingPage)))
{
((IRefreshingPage)page).RefreshPage();
}
}
}
#endregion
}
}