diff options
author | sr55 <[email protected]> | 2017-01-08 17:51:05 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2017-01-08 17:51:05 +0000 |
commit | d563e79ad6a21fc06e1ca8f23f106704313962fc (patch) | |
tree | a791f6cbf1da08b09e24746b28fb22c8da7949e5 | |
parent | 3e3218dfb1e09f7f2aa851d03c0dfedbf1b53a68 (diff) |
WinGui: Allow the log window to be opened from the Scan Status Overlay.
-rw-r--r-- | win/CS/HandBrakeWPF/Controls/StatusPanel.xaml | 15 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs | 73 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs | 11 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/MainView.xaml | 2 |
4 files changed, 81 insertions, 20 deletions
diff --git a/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml b/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml index bd7bbbbad..97a358a71 100644 --- a/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml +++ b/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml @@ -40,10 +40,17 @@ TextWrapping="WrapWithOverflow"
/>
</StackPanel>
-
- <Button Content="{Binding ActionText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Margin="0,10,0,0"
- x:Name="StatusActionButton" Click="StatusActionButton_OnClick" Padding="8,2" HorizontalAlignment="Right"
- Visibility="{Binding IsActionButtonVisible, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Converter={StaticResource boolTovisibility}}" />
+
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+
+ <Button Content="{Binding SecondaryActionText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Margin="0,10,5,0"
+ x:Name="SecondaryActionCtl" Click="PerformSecondaryAction" Padding="8,2" Visibility="{Binding IsActionButton2Visibile, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Converter={StaticResource boolTovisibility}}" />
+
+ <Button Content="{Binding ActionText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Margin="0,10,0,0"
+ x:Name="StatusActionButton" Click="StatusActionButton_OnClick" Padding="8,2"
+ Visibility="{Binding IsActionButtonVisible, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Converter={StaticResource boolTovisibility}}" />
+
+ </StackPanel>
</StackPanel>
</StackPanel>
diff --git a/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs b/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs index 90afe8e33..64e279517 100644 --- a/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs +++ b/win/CS/HandBrakeWPF/Controls/StatusPanel.xaml.cs @@ -27,36 +27,27 @@ namespace HandBrakeWPF.Controls this.Message = "Message";
}
- /// <summary>
- /// Dependancy Property for the IsLoading Property
- /// </summary>
public static readonly DependencyProperty IsLoadingProperty =
DependencyProperty.Register("IsLoading", typeof(bool), typeof(StatusPanel), new UIPropertyMetadata(false));
- /// <summary>
- /// Dependancy Property for the Message Property
- /// </summary>
public static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(StatusPanel), new UIPropertyMetadata("Loading..."));
- /// <summary>
- /// Dependancy Property for the submessage propery
- /// </summary>
public static readonly DependencyProperty SubMessageProperty =
DependencyProperty.Register("SubMessage", typeof(string), typeof(StatusPanel), new FrameworkPropertyMetadata("Please Wait", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// Dependancy Property for the submessage propery
- /// </summary>
public static readonly DependencyProperty ActionProperty =
DependencyProperty.Register("CancelAction", typeof(Action), typeof(StatusPanel), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.None, OnCancelActionSet));
- /// <summary>
- /// Dependancy Property for the submessage propery
- /// </summary>
+ 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>
@@ -90,7 +81,25 @@ namespace HandBrakeWPF.Controls public Action CancelAction
{
get { return (Action)GetValue(ActionProperty); }
- set { SetValue(SubMessageProperty, value); }
+ 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>
@@ -107,6 +116,19 @@ namespace HandBrakeWPF.Controls }
/// <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
@@ -127,6 +149,17 @@ namespace HandBrakeWPF.Controls }
/// <summary>
+ ///
+ /// </summary>
+ public bool IsActionButton2Visibile
+ {
+ get
+ {
+ return true; //SecondaryAction != null;
+ }
+ }
+
+ /// <summary>
/// The status action button_ on click.
/// </summary>
/// <param name="sender">
@@ -142,5 +175,13 @@ namespace HandBrakeWPF.Controls this.CancelAction();
}
}
+
+ private void PerformSecondaryAction(object sender, RoutedEventArgs e)
+ {
+ if (this.SecondaryAction != null)
+ {
+ this.SecondaryAction();
+ }
+ }
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 39db1a560..4dab47e0d 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -1088,6 +1088,17 @@ namespace HandBrakeWPF.ViewModels }
/// <summary>
+ /// Action for the status window.
+ /// </summary>
+ public Action OpenLogWindowAction
+ {
+ get
+ {
+ return this.OpenLogWindow;
+ }
+ }
+
+ /// <summary>
/// Gets or sets a value indicating whether show alert window.
/// </summary>
public bool ShowAlertWindow
diff --git a/win/CS/HandBrakeWPF/Views/MainView.xaml b/win/CS/HandBrakeWPF/Views/MainView.xaml index e0e1156fd..7d7556c85 100644 --- a/win/CS/HandBrakeWPF/Views/MainView.xaml +++ b/win/CS/HandBrakeWPF/Views/MainView.xaml @@ -695,6 +695,8 @@ Message="Please wait ..."
SubMessage="{Binding StatusLabel}"
ActionText="Cancel"
+ SecondaryActionText="Open Log Window"
+ SecondaryAction="{Binding OpenLogWindowAction}"
CancelAction="{Binding CancelAction}"
/>
|