1
0
Fork 0
mirror of https://github.com/wagesj45/butterflow-ui.git synced 2024-12-22 01:02:43 -06:00

Fleshing out bindings and values

This commit is contained in:
Jordan Wages 2018-06-24 03:29:34 -05:00
parent d5f58560fd
commit 7fde16539f
3 changed files with 50 additions and 18 deletions

View file

@ -46,26 +46,26 @@
<StackPanel>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.PlaybackRateLabel}">
<StackPanel Orientation="Vertical">
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization._2xLabel}">
<RadioButton GroupName="PlaybackRate" />
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._2xLabel}" Tag="2x" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization._3xLabel}">
<RadioButton GroupName="PlaybackRate" />
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._3xLabel}" Tag="3x" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization._4xLabel}">
<RadioButton GroupName="PlaybackRate" />
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._4xLabel}" Tag="4x" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization._24fpsLabel}">
<RadioButton GroupName="PlaybackRate" />
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._24fpsLabel}" Tag="24"/>
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization._30fpsLabel}">
<RadioButton GroupName="PlaybackRate" />
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._30fpsLabel}" Tag="30" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization._60fpsLabel}">
<RadioButton GroupName="PlaybackRate" />
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._60fpsLabel}" Tag="60" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization._120fpsLabel}">
<RadioButton GroupName="PlaybackRate" />
<butterflow_ui:ButterflowOption LabelValue="">
<RadioButton GroupName="PlaybackRate" Checked="PlaybackRateRadioButton_Checked" Content="{x:Static loc:Localization._120fpsLabel}" Tag="120" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.CustomPlaybackRateLabel}">
<TextBox Text="{Binding OptionsConfiguration.PlaybackRate, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
@ -73,10 +73,10 @@
</StackPanel>
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.KeepAudioLabel}">
<CheckBox />
<CheckBox IsChecked="{Binding OptionsConfiguration.KeepAudio, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.LosslessLabel}">
<CheckBox />
<CheckBox IsChecked="{Binding OptionsConfiguration.LosslessQuality, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption LabelValue="{x:Static loc:Localization.ResolutionLabel}">
<Grid>
@ -85,10 +85,10 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<butterflow_ui:ButterflowOption Grid.Column="0" LabelValue="{x:Static loc:Localization.WidthLabel}">
<TextBox Name="txtWidth" />
<TextBox Text="{Binding OptionsConfiguration.Width, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}, UpdateSourceTrigger=PropertyChanged}" />
</butterflow_ui:ButterflowOption>
<butterflow_ui:ButterflowOption Grid.Column="1" LabelValue="{x:Static loc:Localization.HeightLabel}">
<TextBox Name="txtHeight" Text="" />
<TextBox Text="{Binding OptionsConfiguration.Height, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type butterflow_ui:MainWindow}}}" />
</butterflow_ui:ButterflowOption>
</Grid>
</butterflow_ui:ButterflowOption>

View file

@ -23,6 +23,8 @@ namespace butterflow_ui
{
#region Properties
/// <summary> Gets or sets the butyterflow options configuration. </summary>
/// <value> The options configuration. </value>
public OptionsConfiguration OptionsConfiguration { get; set; } = new OptionsConfiguration();
#endregion
@ -49,5 +51,19 @@ namespace butterflow_ui
mediaPreview.Source = new Uri(ofd.FileName);
}
}
/// <summary> Event handler. Called by PlaybackRate radio buttons for checked events. </summary>
/// <param name="sender"> Source of the event. </param>
/// <param name="e"> Routed event information. </param>
private void PlaybackRateRadioButton_Checked(object sender, RoutedEventArgs e)
{
var typedSender = (RadioButton)sender;
if(typedSender != null)
{
var tag = typedSender.Tag.ToString();
this.OptionsConfiguration.PlaybackRate = tag;
}
}
}
}

View file

@ -24,6 +24,7 @@ namespace butterflow_ui
private bool keepAudio;
private int width;
private int height;
private bool losslessQuality;
#endregion
@ -91,6 +92,21 @@ namespace butterflow_ui
}
}
/// <summary> Gets or sets a value indicating whether the result is rendered in lossless quality. </summary>
/// <value> True if lossless quality is selected, false if not. </value>
public bool LosslessQuality
{
get
{
return this.losslessQuality;
}
set
{
this.losslessQuality = value;
OnPropertyChanged("LosslessQuality");
}
}
#endregion
#region Methods