// --------------------------------------------------------------------------------------------------------------------
//
// 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 AlertPanel.xaml
//
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Controls
{
using System;
using System.Windows;
using System.Windows.Controls;
///
/// Interaction logic for AlertPanel.xaml
///
public partial class AlertPanel : UserControl
{
///
/// Initializes a new instance of the class.
///
public AlertPanel()
{
InitializeComponent();
this.Message = "Message";
}
///
/// Dependency Property for the Message Property
///
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(AlertPanel), new UIPropertyMetadata("Loading..."));
///
/// Dependency Property for the submessage property
///
public static readonly DependencyProperty SubMessageProperty =
DependencyProperty.Register("SubMessage", typeof(string), typeof(AlertPanel), new FrameworkPropertyMetadata("Please Wait", FrameworkPropertyMetadataOptions.AffectsRender));
///
/// Dependency Property for the submessage property
///
public static readonly DependencyProperty DefaultActionProperty =
DependencyProperty.Register("DefaultAction", typeof(Action), typeof(AlertPanel), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None, DefaultActionSet));
///
/// Dependency Property for the submessage property
///
public static readonly DependencyProperty ActionTextProperty =
DependencyProperty.Register("ActionText", typeof(string), typeof(AlertPanel), new UIPropertyMetadata("Cancel"));
///
/// 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 DefaultAction
{
get { return (Action)GetValue(DefaultActionProperty); }
set { SetValue(DefaultActionProperty, value); }
}
///
/// The on cancel action set.
///
///
/// The d.
///
///
/// The e.
///
private static void DefaultActionSet(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.DefaultAction != null)
{
this.DefaultAction();
}
}
}
}