// --------------------------------------------------------------------------------------------------------------------
//
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
//
//
// Interaction logic for StatusPanel.xaml
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Controls
{
using System;
using System.Windows;
using System.Windows.Controls;
///
/// Interaction logic for StatusPanel.xaml
///
public partial class StatusPanel : UserControl
{
///
/// Initializes a new instance of the class.
///
public StatusPanel()
{
InitializeComponent();
this.Message = "Message";
}
///
/// Dependancy Property for the IsLoading Property
///
public static readonly DependencyProperty IsLoadingProperty =
DependencyProperty.Register("IsLoading", typeof(bool), typeof(StatusPanel), new UIPropertyMetadata(false));
///
/// Dependancy Property for the Message Property
///
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(StatusPanel), new UIPropertyMetadata("Loading..."));
///
/// Dependancy Property for the submessage propery
///
public static readonly DependencyProperty SubMessageProperty =
DependencyProperty.Register("SubMessage", typeof(string), typeof(StatusPanel), new FrameworkPropertyMetadata("Please Wait", FrameworkPropertyMetadataOptions.AffectsRender));
///
/// Dependancy Property for the submessage propery
///
public static readonly DependencyProperty ActionProperty =
DependencyProperty.Register("CancelAction", typeof(Action), typeof(StatusPanel), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None, OnCancelActionSet));
///
/// Dependancy Property for the submessage propery
///
public static readonly DependencyProperty ActionTextProperty =
DependencyProperty.Register("ActionText", typeof(string), typeof(StatusPanel), new UIPropertyMetadata("Cancel"));
///
/// Gets or sets a value indicating whether IsLoading.
///
public bool IsLoading
{
get { return (bool)GetValue(IsLoadingProperty); }
set { SetValue(IsLoadingProperty, value); }
}
///
/// Gets or sets Message.
///
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
///
/// Gets or sets SubMessage.
///
public string SubMessage
{
get { return (string)GetValue(SubMessageProperty); }
set { SetValue(SubMessageProperty, value); }
}
///
/// Gets or sets the cancel action.
///
public Action CancelAction
{
get { return (Action)GetValue(ActionProperty); }
set { SetValue(SubMessageProperty, value); }
}
///
/// The on cancel action set.
///
///
/// The d.
///
///
/// The e.
///
private static void OnCancelActionSet(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
///
/// Gets or sets the action text.
///
public string ActionText
{
get { return (string)GetValue(ActionTextProperty); }
set { SetValue(ActionTextProperty, value); }
}
///
/// Gets a value indicating whether is action button visible.
///
public bool IsActionButtonVisible
{
get
{
return true; // this.CancelAction != null;
}
}
///
/// The status action button_ on click.
///
///
/// The sender.
///
///
/// The e.
///
private void StatusActionButton_OnClick(object sender, RoutedEventArgs e)
{
if (this.CancelAction != null)
{
this.CancelAction();
}
}
}
}