Add custom sound theme support

This commit is contained in:
azakhi
2018-08-29 13:11:41 +03:00
parent 2958d93b33
commit a09f0a5090
24 changed files with 255 additions and 14 deletions

View File

@@ -39,6 +39,10 @@ namespace Filtration.ThemeEditor.Converters
{
return "Alert Sound Theme Components";
}
case "Custom Sound":
{
return "Custom Alert Sound Theme Components";
}
}
return type.GetAttributeDescription();

View File

@@ -109,6 +109,7 @@
<Compile Include="Services\ThemePersistenceService.cs" />
<Compile Include="Services\ThemeService.cs" />
<Compile Include="ViewModels\ColorThemeComponentViewModel.cs" />
<Compile Include="ViewModels\StringThemeComponentViewModel.cs" />
<Compile Include="ViewModels\StrIntThemeComponentViewModel.cs" />
<Compile Include="ViewModels\IntegerThemeComponentViewModel.cs" />
<Compile Include="ViewModels\IThemeViewModelFactory.cs" />
@@ -138,7 +139,10 @@
<Name>Filtration.ObjectModel</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Resource Include="Resources\open_icon.png" />
<Resource Include="Resources\speaker_icon.png" />
</ItemGroup>
<ItemGroup>
<Page Include="Views\ThemeComponentControl.xaml">
<SubType>Designer</SubType>

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,9 @@
using System.Windows.Media;
namespace Filtration.ThemeEditor.ViewModels
{
public class StringThemeComponentViewModel : ThemeComponentViewModel
{
public string Value { get; set; }
}
}

View File

@@ -208,6 +208,9 @@ namespace Filtration.ThemeEditor.ViewModels
case ThemeComponentType.AlertSound:
Components.Add(new StrIntThemeComponent(themeComponentType, "Untitled Component", "1", 100));
break;
case ThemeComponentType.CustomSound:
Components.Add(new StringThemeComponent(themeComponentType, "Untitled Component", "placeholder.mp3"));
break;
}
}

View File

@@ -7,6 +7,7 @@
xmlns:commonConverters="clr-namespace:Filtration.Common.Converters;assembly=Filtration.Common"
xmlns:themeEditor="clr-namespace:Filtration.ObjectModel.ThemeEditor;assembly=Filtration.ObjectModel"
xmlns:views="clr-namespace:Filtration.ThemeEditor.Views"
xmlns:viewModels="clr-namespace:Filtration.ThemeEditor.ViewModels"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=themeEditor:ThemeComponent}"
d:DesignHeight="100" d:DesignWidth="200">
@@ -81,6 +82,23 @@
<xctk:ShortUpDown Grid.Column="1" Value="{Binding SecondValue}" HorizontalAlignment="Right"/>
</Grid>
</DataTemplate>
<!--TODO:File block type and string block type should be separate-->
<!-- Custom Sound Theme Template -->
<DataTemplate DataType="{x:Type themeEditor:StringThemeComponent}">
<Grid>
<!--TODO: Add play sound support-->
<!--<Button Grid.Column="0" Command="{Binding PlayCustomSoundCommand}" Width="20" Height="20" Background="Transparent" BorderBrush="Transparent">
<Image Source="/Filtration.ThemeEditor;component/Resources/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
</Button>-->
<ComboBox ItemsSource="{Binding CustomSoundsAvailable}"
SelectedValue="{Binding Value}" Style="{StaticResource MetroComboBox}"/>
<Button Command="{Binding CustomSoundFileDialogCommand}"
Width="20" Height="20" Background="Transparent" BorderBrush="Transparent" Margin="0,0,30,0" VerticalAlignment="Center" HorizontalAlignment="Right">
<Image Source="/Filtration.ThemeEditor;component/Resources/open_icon.png"/>
</Button>
</Grid>
</DataTemplate>
</ContentControl.Resources>
</ContentControl>
</Grid>