1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="StatusPanel.xaml.cs" company="HandBrake Project (http://handbrake.fr)">
// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
// </copyright>
// <summary>
// Interaction logic for StatusPanel.xaml
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace HandBrakeWPF.Controls
{
using System;
using System.Windows;
using System.Windows.Controls;
/// <summary>
/// Interaction logic for StatusPanel.xaml
/// </summary>
public partial class StatusPanel : UserControl
{
/// <summary>
/// Initializes a new instance of the <see cref="StatusPanel"/> class.
/// </summary>
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"));
/// <summary>
/// Gets or sets a value indicating whether IsLoading.
/// </summary>
public bool IsLoading
{
get { return (bool)GetValue(IsLoadingProperty); }
set { SetValue(IsLoadingProperty, value); }
}
/// <summary>
/// Gets or sets Message.
/// </summary>
public string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
/// <summary>
/// Gets or sets SubMessage.
/// </summary>
public string SubMessage
{
get { return (string)GetValue(SubMessageProperty); }
set { SetValue(SubMessageProperty, value); }
}
/// <summary>
/// Gets or sets the cancel action.
/// </summary>
public Action CancelAction
{
get { return (Action)GetValue(ActionProperty); }
set { SetValue(ActionProperty, value); }
}
/// <summary>
/// Gets or sets the cancel action.
/// </summary>
public Action SecondaryAction
{
get { return (Action)GetValue(SecondaryActionProperty); }
set { SetValue(SecondaryActionProperty, value); }
}
/// <summary>
/// Gets or sets SecondaryActionText.
/// </summary>
public string SecondaryActionText
{
get { return (string)GetValue(SecondaryActionTextProperty); }
set { SetValue(SecondaryActionTextProperty, value); }
}
/// <summary>
/// The on cancel action set.
/// </summary>
/// <param name="d">
/// The d.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private static void OnCancelActionSet(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
/// <summary>
/// The on Secondary Action Set.
/// </summary>
/// <param name="d">
/// The d.
/// </param>
/// <param name="e">
/// The e.
/// </param>
private static void OnSecondaryActionSet(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
}
/// <summary>
/// Gets or sets the action text.
/// </summary>
public string ActionText
{
get { return (string)GetValue(ActionTextProperty); }
set { SetValue(ActionTextProperty, value); }
}
/// <summary>
/// Gets a value indicating whether is action button visible.
/// </summary>
public bool IsActionButtonVisible
{
get
{
return true; // this.CancelAction != null;
}
}
/// <summary>
///
/// </summary>
public bool IsActionButton2Visibile
{
get
{
return true; //SecondaryAction != null;
}
}
/// <summary>
/// The status action button_ on click.
/// </summary>
/// <param name="sender">
/// The sender.
/// </param>
/// <param name="e">
/// The e.
/// </param>
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();
}
}
}
}
|