Add custom sound theme support
This commit is contained in:
@@ -49,6 +49,7 @@ namespace Filtration
|
||||
cfg.CreateMap<ColorThemeComponent, ColorThemeComponentViewModel>().ReverseMap();
|
||||
cfg.CreateMap<IntegerThemeComponent, IntegerThemeComponentViewModel>().ReverseMap();
|
||||
cfg.CreateMap<StrIntThemeComponent, StrIntThemeComponentViewModel>().ReverseMap();
|
||||
cfg.CreateMap<StringThemeComponent, StringThemeComponentViewModel>().ReverseMap();
|
||||
cfg.CreateMap<IThemeEditorViewModel, Theme>();
|
||||
});
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ namespace Filtration.Converters
|
||||
{
|
||||
themeComponentType = ThemeComponentType.AlertSound;
|
||||
}
|
||||
else if (blockItem.GetType() == typeof(CustomSoundBlockItem))
|
||||
{
|
||||
themeComponentType = ThemeComponentType.CustomSound;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
|
||||
@@ -185,15 +185,27 @@
|
||||
<ColumnDefinition Width="20"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="0" Command="{Binding Path=DataContext.PlayCustomSoundCommand, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}" Width="20" Height="20" Background="Transparent" BorderBrush="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Grid.Column="0" Grid.Row="0" Command="{Binding Path=DataContext.PlayCustomSoundCommand, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}" Width="20" Height="20" Background="Transparent" BorderBrush="Transparent">
|
||||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
<ComboBox Grid.Column="1" ItemsSource="{Binding Path=DataContext.CustomSoundsAvailable, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}"
|
||||
SelectedValue="{Binding Value}" Style="{StaticResource MetroComboBox}"/>
|
||||
<Button Grid.Column="1" Command="{Binding Path=DataContext.CustomSoundFileDialogCommand, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}"
|
||||
<ComboBox Grid.Column="1" Grid.Row="0" ItemsSource="{Binding Path=DataContext.CustomSoundsAvailable, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}"
|
||||
SelectedValue="{Binding Value, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource MetroComboBox}"/>
|
||||
<Button Grid.Column="1" Grid.Row="0" Command="{Binding Path=DataContext.CustomSoundFileDialogCommand, RelativeSource={RelativeSource AncestorType={x:Type views:ItemFilterBlockView}}}"
|
||||
Width="20" Height="20" Background="Transparent" BorderBrush="Transparent" Margin="0,0,30,0" VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||
<Image Grid.Column="1" Source="/Filtration;component/Resources/Icons/open_icon.png"/>
|
||||
</Button>
|
||||
<userControls:ThemeComponentSelectionControl Grid.Row="1" Grid.Column="1" ThemeComponent="{Binding ThemeComponent}" Margin="0,2,0,0">
|
||||
<userControls:ThemeComponentSelectionControl.AvailableThemeComponents>
|
||||
<MultiBinding Converter="{StaticResource AvailableThemeComponentsConverter}">
|
||||
<Binding Path="DataContext.Script.ThemeComponents" RelativeSource="{RelativeSource AncestorType={x:Type views:ItemFilterScriptView}}"/>
|
||||
<Binding Path="." />
|
||||
</MultiBinding>
|
||||
</userControls:ThemeComponentSelectionControl.AvailableThemeComponents>
|
||||
</userControls:ThemeComponentSelectionControl>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
|
||||
@@ -117,6 +117,10 @@ namespace Filtration.UserControls
|
||||
strIntBlockItem.Value = ((StrIntThemeComponent)strIntBlockItem.ThemeComponent).Value;
|
||||
strIntBlockItem.SecondValue = ((StrIntThemeComponent)strIntBlockItem.ThemeComponent).SecondValue;
|
||||
break;
|
||||
case ThemeComponentType.CustomSound:
|
||||
var stringBlockItem = BlockItem as StringBlockItem;
|
||||
stringBlockItem.Value = ((StringThemeComponent)stringBlockItem.ThemeComponent).Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,10 @@
|
||||
<DataTemplate DataType="{x:Type themeEditor:StrIntThemeComponent}">
|
||||
<!--TODO: How to show theese?-->
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type themeEditor:StringThemeComponent}">
|
||||
<!--TODO: How to show theese?-->
|
||||
</DataTemplate>
|
||||
</ContentControl.Resources>
|
||||
</ContentControl>
|
||||
</Grid>
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Filtration.ViewModels
|
||||
var customSoundBlockItem = blockItem as CustomSoundBlockItem;
|
||||
if (customSoundBlockItem != null)
|
||||
{
|
||||
if (_customSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _customSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
{
|
||||
_customSoundsAvailable.Add(customSoundBlockItem.Value);
|
||||
}
|
||||
@@ -454,6 +454,15 @@ namespace Filtration.ViewModels
|
||||
{
|
||||
IsDirty = true;
|
||||
}
|
||||
var customSoundBlockItem = sender as CustomSoundBlockItem;
|
||||
if (customSoundBlockItem != null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(customSoundBlockItem.Value) && _customSoundsAvailable.IndexOf(customSoundBlockItem.Value) < 0)
|
||||
{
|
||||
_customSoundsAvailable.Add(customSoundBlockItem.Value);
|
||||
}
|
||||
RaisePropertyChanged(nameof(CustomSoundsAvailable));
|
||||
}
|
||||
Block.IsEdited = true;
|
||||
//if (sender is IAudioVisualBlockItem)
|
||||
//{
|
||||
|
||||
@@ -116,6 +116,7 @@ namespace Filtration.ViewModels
|
||||
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddFontSizeThemeComponentCommand = new RelayCommand(OnAddFontSizeThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddAlertSoundThemeComponentCommand = new RelayCommand(OnAddAlertSoundThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
AddCustomSoundThemeComponentCommand = new RelayCommand(OnAddCustomSoundThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
|
||||
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
|
||||
|
||||
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
|
||||
@@ -217,6 +218,7 @@ namespace Filtration.ViewModels
|
||||
public RelayCommand AddBorderColorThemeComponentCommand { get; }
|
||||
public RelayCommand AddFontSizeThemeComponentCommand { get; }
|
||||
public RelayCommand AddAlertSoundThemeComponentCommand { get; }
|
||||
public RelayCommand AddCustomSoundThemeComponentCommand { get; }
|
||||
public RelayCommand DeleteThemeComponentCommand { get; }
|
||||
|
||||
public RelayCommand AddBlockCommand { get; }
|
||||
@@ -691,6 +693,11 @@ namespace Filtration.ViewModels
|
||||
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.AddThemeComponentCommand.Execute(ThemeComponentType.AlertSound);
|
||||
}
|
||||
|
||||
private void OnAddCustomSoundThemeComponentCommand()
|
||||
{
|
||||
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.AddThemeComponentCommand.Execute(ThemeComponentType.CustomSound);
|
||||
}
|
||||
|
||||
private void OnDeleteThemeComponentCommand()
|
||||
{
|
||||
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.DeleteThemeComponentCommand.Execute(
|
||||
|
||||
@@ -131,6 +131,7 @@
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Border Color" Icon="{StaticResource AddIcon}" Command="{Binding AddBorderColorThemeComponentCommand}" />
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Font Size" Icon="{StaticResource AddIcon}" Command="{Binding AddFontSizeThemeComponentCommand}" />
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Alert Sound" Icon="{StaticResource AddIcon}" Command="{Binding AddAlertSoundThemeComponentCommand}" />
|
||||
<fluent:Button SizeDefinition="Middle" Header="Add Custom Sound" Icon="{StaticResource AddIcon}" Command="{Binding AddCustomSoundThemeComponentCommand}" />
|
||||
</fluent:RibbonGroupBox>
|
||||
<fluent:RibbonGroupBox Header="Delete">
|
||||
<fluent:Button Header="Delete Theme Component" Icon="{StaticResource ThemeComponentDeleteIcon}" LargeIcon="{StaticResource ThemeComponentDeleteIcon}" Command="{Binding DeleteThemeComponentCommand}" />
|
||||
|
||||
Reference in New Issue
Block a user