// --------------------------------------------------------------------------------------------------------------------
//
// 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";
}
public static readonly DependencyProperty IsLoadingProperty =
DependencyProperty.Register("IsLoading", typeof(bool), typeof(StatusPanel), new UIPropertyMetadata(false));
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(StatusPanel), new UIPropertyMetadata("Loading..."));
public static readonly DependencyProperty SubMessageProperty =
DependencyProperty.Register("SubMessage", typeof(string), typeof(StatusPanel), new FrameworkPropertyMetadata("Please Wait", FrameworkPropertyMetadataOptions.AffectsRender));
public static readonly DependencyProperty ActionProperty =
DependencyProperty.Register("CancelAction", typeof(Action), typeof(StatusPanel), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None, OnCancelActionSet));
public static readonly DependencyProperty SecondaryActionProperty =
DependencyProperty.Register("SecondaryAction", typeof(Action), typeof(StatusPanel), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None, OnSecondaryActionSet));
public static readonly DependencyProperty ActionTextProperty =
DependencyProperty.Register("ActionText", typeof(string), typeof(StatusPanel), new UIPropertyMetadata("Cancel"));
public static readonly DependencyProperty SecondaryActionTextProperty =
DependencyProperty.Register("SecondaryActionText", typeof(string), typeof(StatusPanel), new UIPropertyMetadata("Open Log Window"));
///
/// 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(ActionProperty, value); }
}
///
/// Gets or sets the cancel action.
///
public Action SecondaryAction
{
get { return (Action)GetValue(SecondaryActionProperty); }
set { SetValue(SecondaryActionProperty, value); }
}
///
/// Gets or sets SecondaryActionText.
///
public string SecondaryActionText
{
get { return (string)GetValue(SecondaryActionTextProperty); }
set { SetValue(SecondaryActionTextProperty, value); }
}
///
/// The on cancel action set.
///
///
/// The d.
///
///
/// The e.
///
private static void OnCancelActionSet(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
///
/// The on Secondary Action Set.
///
///
/// The d.
///
///
/// The e.
///
private static void OnSecondaryActionSet(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;
}
}
///
/// Gets a value indicating whether is action 2 button visible.
///
public bool IsActionButton2Visibile
{
get
{
return true; // SecondaryAction != 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();
}
}
private void PerformSecondaryAction(object sender, RoutedEventArgs e)
{
if (this.SecondaryAction != null)
{
this.SecondaryAction();
}
}
}
}