diff --git a/Filtration.ObjectModel/BlockItemBaseTypes/StrIntBlockItem.cs b/Filtration.ObjectModel/BlockItemBaseTypes/StrIntBlockItem.cs
new file mode 100644
index 0000000..2f66db2
--- /dev/null
+++ b/Filtration.ObjectModel/BlockItemBaseTypes/StrIntBlockItem.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Windows.Media;
+using Filtration.ObjectModel.ThemeEditor;
+
+namespace Filtration.ObjectModel.BlockItemBaseTypes
+{
+ public abstract class StrIntBlockItem : BlockItemBase, IAudioVisualBlockItem, IBlockItemWithTheme
+ {
+ private string _value;
+ private int _secondValue;
+ private ThemeComponent _themeComponent;
+
+ protected StrIntBlockItem()
+ {
+ }
+
+ protected StrIntBlockItem(string value, int secondValue)
+ {
+ Value = value;
+ SecondValue = secondValue;
+ Value = value;
+ SecondValue = secondValue;
+ }
+
+ public override string OutputText => PrefixText + " " + Value + " " + SecondValue + (ThemeComponent != null ? " # " + ThemeComponent.ComponentName : string.Empty);
+
+ public override string SummaryText => string.Empty;
+ public override Color SummaryBackgroundColor => Colors.Transparent;
+ public override Color SummaryTextColor => Colors.Transparent;
+
+ public ThemeComponent ThemeComponent
+ {
+ get { return _themeComponent; }
+ set
+ {
+ if (_themeComponent == value) { return; }
+
+ if (_themeComponent != null)
+ {
+ _themeComponent.ThemeComponentUpdated -= OnThemeComponentUpdated;
+ _themeComponent.ThemeComponentDeleted -= OnThemeComponentDeleted;
+ }
+ if (value != null)
+ {
+ value.ThemeComponentUpdated += OnThemeComponentUpdated;
+ value.ThemeComponentDeleted += OnThemeComponentDeleted;
+ }
+
+ _themeComponent = value;
+ OnPropertyChanged();
+ }
+ }
+
+ public string Value
+ {
+ get { return _value; }
+ set
+ {
+ _value = value;
+ IsDirty = true;
+ OnPropertyChanged();
+ }
+ }
+
+ public int SecondValue
+ {
+ get { return _secondValue; }
+ set
+ {
+ _secondValue = value;
+ IsDirty = true;
+ OnPropertyChanged();
+ }
+ }
+
+ private void OnThemeComponentUpdated(object sender, EventArgs e)
+ {
+ Value = ((StrIntBlockItem)sender).Value;
+ SecondValue = ((StrIntBlockItem)sender).SecondValue;
+ }
+
+ private void OnThemeComponentDeleted(object sender, EventArgs e)
+ {
+ ThemeComponent = null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Filtration.ObjectModel/BlockItemBaseTypes/StringIntBlockItem.cs b/Filtration.ObjectModel/BlockItemBaseTypes/StringIntBlockItem.cs
deleted file mode 100644
index 405879c..0000000
--- a/Filtration.ObjectModel/BlockItemBaseTypes/StringIntBlockItem.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using System.Windows.Media;
-
-namespace Filtration.ObjectModel.BlockItemBaseTypes
-{
- public abstract class StrIntBlockItem : BlockItemBase, IAudioVisualBlockItem
- {
- private string _value;
- private int _secondValue;
-
- protected StrIntBlockItem()
- {
- }
-
- protected StrIntBlockItem(string value, int secondValue)
- {
- Value = value;
- SecondValue = secondValue;
- Value = value;
- SecondValue = secondValue;
- }
-
- public override string OutputText => PrefixText + " " + Value + " " + SecondValue;
-
- public override string SummaryText => string.Empty;
- public override Color SummaryBackgroundColor => Colors.Transparent;
- public override Color SummaryTextColor => Colors.Transparent;
-
- public string Value
- {
- get { return _value; }
- set
- {
- _value = value;
- IsDirty = true;
- OnPropertyChanged();
- }
- }
-
- public int SecondValue
- {
- get { return _secondValue; }
- set
- {
- _secondValue = value;
- IsDirty = true;
- OnPropertyChanged();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/Filtration.ObjectModel/Enums/ThemeComponentType.cs b/Filtration.ObjectModel/Enums/ThemeComponentType.cs
index 48c20a0..ac3b70b 100644
--- a/Filtration.ObjectModel/Enums/ThemeComponentType.cs
+++ b/Filtration.ObjectModel/Enums/ThemeComponentType.cs
@@ -11,6 +11,8 @@ namespace Filtration.ObjectModel.Enums
[Description("Border")]
BorderColor,
[Description("Font Size")]
- FontSize
+ FontSize,
+ [Description("Alert Sound")]
+ AlertSound
}
}
diff --git a/Filtration.ObjectModel/Filtration.ObjectModel.csproj b/Filtration.ObjectModel/Filtration.ObjectModel.csproj
index bcc1cef..b7f55d5 100644
--- a/Filtration.ObjectModel/Filtration.ObjectModel.csproj
+++ b/Filtration.ObjectModel/Filtration.ObjectModel.csproj
@@ -55,7 +55,7 @@
-
+
@@ -131,6 +131,7 @@
+
diff --git a/Filtration.ObjectModel/ThemeEditor/StrIntThemeComponent.cs b/Filtration.ObjectModel/ThemeEditor/StrIntThemeComponent.cs
new file mode 100644
index 0000000..a959d70
--- /dev/null
+++ b/Filtration.ObjectModel/ThemeEditor/StrIntThemeComponent.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Windows.Media;
+using Filtration.ObjectModel.Enums;
+
+namespace Filtration.ObjectModel.ThemeEditor
+{
+ [Serializable]
+ public class StrIntThemeComponent : ThemeComponent
+ {
+ private string _value;
+ private int _secondValue;
+
+ public StrIntThemeComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
+ {
+ if (componentName == null || componentValue == null)
+ {
+ throw new ArgumentException("Null parameters not allowed in StrIntThemeComponent constructor");
+ }
+
+ ComponentType = componentType;
+ Value = componentValue;
+ SecondValue = componentSecondValue;
+ ComponentName = componentName;
+ }
+
+ public string Value
+ {
+ get { return _value; }
+ set
+ {
+ _value = value;
+ OnPropertyChanged();
+ _themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
+ }
+ }
+
+ public int SecondValue
+ {
+ get { return _secondValue; }
+ set
+ {
+ _secondValue = value;
+ OnPropertyChanged();
+ _themeComponentUpdatedEventHandler?.Invoke(this, EventArgs.Empty);
+ }
+ }
+ }
+}
diff --git a/Filtration.ObjectModel/ThemeEditor/Theme.cs b/Filtration.ObjectModel/ThemeEditor/Theme.cs
index a765e30..7d9d3fc 100644
--- a/Filtration.ObjectModel/ThemeEditor/Theme.cs
+++ b/Filtration.ObjectModel/ThemeEditor/Theme.cs
@@ -39,5 +39,10 @@ namespace Filtration.ObjectModel.ThemeEditor
{
_components.Add(new IntegerThemeComponent(componentType, componentName, componentValue));
}
+
+ public void AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
+ {
+ _components.Add(new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue));
+ }
}
}
diff --git a/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs b/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs
index 605a62c..50510e0 100644
--- a/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs
+++ b/Filtration.ObjectModel/ThemeEditor/ThemeComponentCollection.cs
@@ -35,6 +35,19 @@ namespace Filtration.ObjectModel.ThemeEditor
return component;
}
+ public ThemeComponent AddComponent(ThemeComponentType componentType, string componentName, string componentValue, int componentSecondValue)
+ {
+ if (ComponentExists(componentType, componentName))
+ {
+ return Items.FirstOrDefault(t => t.ComponentName == componentName && t.ComponentType == componentType);
+ }
+
+ var component = new StrIntThemeComponent(componentType, componentName, componentValue, componentSecondValue);
+ Items.Add(component);
+
+ return component;
+ }
+
private bool ComponentExists(ThemeComponentType componentType, string componentName)
{
var componentCount =
diff --git a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs
index fb1d755..ee1ff18 100644
--- a/Filtration.Parser/Services/ItemFilterBlockTranslator.cs
+++ b/Filtration.Parser/Services/ItemFilterBlockTranslator.cs
@@ -236,7 +236,7 @@ namespace Filtration.Parser.Services
RemoveExistingBlockItemsOfType(block);
RemoveExistingBlockItemsOfType(block);
- var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s?(\d+)?");
+ var match = Regex.Match(trimmedLine, @"\S+\s+(\S+)\s?(\d+)?\s*([#]?)(.*)");
if (match.Success)
{
@@ -250,6 +250,12 @@ namespace Filtration.Parser.Services
else
{
secondValue = 79;
+ }
+
+ ThemeComponent themeComponent = null;
+ if(match.Groups[3].Value == "#" && !string.IsNullOrWhiteSpace(match.Groups[4].Value))
+ {
+ themeComponent = _masterComponentCollection.AddComponent(ThemeComponentType.AlertSound, match.Groups[4].Value.Trim(), firstValue, secondValue);
}
if (lineOption == "PlayAlertSound")
@@ -259,6 +265,7 @@ namespace Filtration.Parser.Services
Value = firstValue,
SecondValue = secondValue
};
+ blockItemValue.ThemeComponent = themeComponent;
block.BlockItems.Add(blockItemValue);
}
else
@@ -268,6 +275,7 @@ namespace Filtration.Parser.Services
Value = firstValue,
SecondValue = secondValue
};
+ blockItemValue.ThemeComponent = themeComponent;
block.BlockItems.Add(blockItemValue);
}
}
diff --git a/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs b/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs
index 2ae7c2d..a3fe4f4 100644
--- a/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs
+++ b/Filtration.ThemeEditor/Converters/ThemeComponentTypeToStringConverter.cs
@@ -35,6 +35,10 @@ namespace Filtration.ThemeEditor.Converters
{
return "Font Size Theme Components";
}
+ case "Alert Sound":
+ {
+ return "Alert Sound Theme Components";
+ }
}
return type.GetAttributeDescription();
diff --git a/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj b/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj
index d64952d..8644cd7 100644
--- a/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj
+++ b/Filtration.ThemeEditor/Filtration.ThemeEditor.csproj
@@ -109,6 +109,7 @@
+
diff --git a/Filtration.ThemeEditor/Providers/ThemeProvider.cs b/Filtration.ThemeEditor/Providers/ThemeProvider.cs
index 2c9bec3..4e8fe20 100644
--- a/Filtration.ThemeEditor/Providers/ThemeProvider.cs
+++ b/Filtration.ThemeEditor/Providers/ThemeProvider.cs
@@ -45,6 +45,9 @@ namespace Filtration.ThemeEditor.Providers
case ThemeComponentType.FontSize:
c.Add(new IntegerThemeComponent(component.ComponentType, component.ComponentName, ((IntegerThemeComponent)component).Value));
break;
+ case ThemeComponentType.AlertSound:
+ c.Add(new StrIntThemeComponent(component.ComponentType, component.ComponentName, ((StrIntThemeComponent)component).Value, ((StrIntThemeComponent)component).SecondValue));
+ break;
}
return c;
});
diff --git a/Filtration.ThemeEditor/Services/ThemeService.cs b/Filtration.ThemeEditor/Services/ThemeService.cs
index 2885dd0..392abcd 100644
--- a/Filtration.ThemeEditor/Services/ThemeService.cs
+++ b/Filtration.ThemeEditor/Services/ThemeService.cs
@@ -45,6 +45,10 @@ namespace Filtration.ThemeEditor.Services
case ThemeComponentType.FontSize:
mismatchedComponents = ApplyIntegerTheme(blocks, typeof(FontSizeBlockItem), component);
break;
+ case ThemeComponentType.AlertSound:
+ mismatchedComponents = ApplyStrIntTheme(blocks, typeof(SoundBlockItem), component);
+ mismatchedComponents = ApplyStrIntTheme(blocks, typeof(PositionalSoundBlockItem), component);
+ break;
}
}
@@ -95,5 +99,26 @@ namespace Filtration.ThemeEditor.Services
return !componentMatched;
}
+
+ private bool ApplyStrIntTheme(IEnumerable blocks, Type type, ThemeComponent component)
+ {
+ var componentMatched = false;
+ foreach (var block in blocks)
+ {
+ foreach (var blockItem in block.BlockItems.Where(i => i.GetType() == type))
+ {
+ var colorBlockItem = (StrIntBlockItem)blockItem;
+ if (colorBlockItem.ThemeComponent != null &&
+ colorBlockItem.ThemeComponent.ComponentName == component.ComponentName)
+ {
+ colorBlockItem.Value = ((StrIntThemeComponent)component).Value;
+ colorBlockItem.SecondValue = ((StrIntThemeComponent)component).SecondValue;
+ componentMatched = true;
+ }
+ }
+ }
+
+ return !componentMatched;
+ }
}
}
diff --git a/Filtration.ThemeEditor/ViewModels/StrIntThemeComponentViewModel.cs b/Filtration.ThemeEditor/ViewModels/StrIntThemeComponentViewModel.cs
new file mode 100644
index 0000000..a1bfe6d
--- /dev/null
+++ b/Filtration.ThemeEditor/ViewModels/StrIntThemeComponentViewModel.cs
@@ -0,0 +1,8 @@
+namespace Filtration.ThemeEditor.ViewModels
+{
+ public class StrIntThemeComponentViewModel : ThemeComponentViewModel
+ {
+ public int Value { get; set; }
+ public int SecondValue { get; set; }
+ }
+}
diff --git a/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs b/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs
index b342082..18e5657 100644
--- a/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs
+++ b/Filtration.ThemeEditor/ViewModels/ThemeEditorViewModel.cs
@@ -205,6 +205,9 @@ namespace Filtration.ThemeEditor.ViewModels
case ThemeComponentType.FontSize:
Components.Add(new IntegerThemeComponent(themeComponentType, "Untitled Component", 35));
break;
+ case ThemeComponentType.AlertSound:
+ Components.Add(new StrIntThemeComponent(themeComponentType, "Untitled Component", "1", 100));
+ break;
}
}
diff --git a/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml b/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml
index 231561b..0065087 100644
--- a/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml
+++ b/Filtration.ThemeEditor/Views/ThemeComponentControl.xaml
@@ -69,6 +69,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Filtration/App.xaml.cs b/Filtration/App.xaml.cs
index 192f000..e5cb90a 100644
--- a/Filtration/App.xaml.cs
+++ b/Filtration/App.xaml.cs
@@ -48,6 +48,7 @@ namespace Filtration
cfg.CreateMap().ReverseMap();
cfg.CreateMap().ReverseMap();
cfg.CreateMap().ReverseMap();
+ cfg.CreateMap().ReverseMap();
cfg.CreateMap();
});
diff --git a/Filtration/Converters/AvailableThemeComponentsConverter.cs b/Filtration/Converters/AvailableThemeComponentsConverter.cs
index 33a1a2b..537ba56 100644
--- a/Filtration/Converters/AvailableThemeComponentsConverter.cs
+++ b/Filtration/Converters/AvailableThemeComponentsConverter.cs
@@ -37,6 +37,10 @@ namespace Filtration.Converters
{
themeComponentType = ThemeComponentType.FontSize;
}
+ else if (blockItem.GetType() == typeof(SoundBlockItem) || blockItem.GetType() == typeof(PositionalSoundBlockItem))
+ {
+ themeComponentType = ThemeComponentType.AlertSound;
+ }
else
{
return null;
diff --git a/Filtration/UserControls/BlockItemControl.xaml b/Filtration/UserControls/BlockItemControl.xaml
index abf7363..606e780 100644
--- a/Filtration/UserControls/BlockItemControl.xaml
+++ b/Filtration/UserControls/BlockItemControl.xaml
@@ -141,6 +141,14 @@
+
+
+
+
+
+
+
+
@@ -152,6 +160,14 @@
+
+
+
+
+
+
+
+
diff --git a/Filtration/UserControls/BlockItemControl.xaml.cs b/Filtration/UserControls/BlockItemControl.xaml.cs
index e312c3d..bb90bd1 100644
--- a/Filtration/UserControls/BlockItemControl.xaml.cs
+++ b/Filtration/UserControls/BlockItemControl.xaml.cs
@@ -112,6 +112,11 @@ namespace Filtration.UserControls
var integerBlockItem = BlockItem as IntegerBlockItem;
integerBlockItem.Value = ((IntegerThemeComponent)integerBlockItem.ThemeComponent).Value;
break;
+ case ThemeComponentType.AlertSound:
+ var strIntBlockItem = BlockItem as StrIntBlockItem;
+ strIntBlockItem.Value = ((StrIntThemeComponent)strIntBlockItem.ThemeComponent).Value;
+ strIntBlockItem.SecondValue = ((StrIntThemeComponent)strIntBlockItem.ThemeComponent).SecondValue;
+ break;
}
}
diff --git a/Filtration/UserControls/ThemeComponentSelectionControl.xaml b/Filtration/UserControls/ThemeComponentSelectionControl.xaml
index 97ac25b..862390f 100644
--- a/Filtration/UserControls/ThemeComponentSelectionControl.xaml
+++ b/Filtration/UserControls/ThemeComponentSelectionControl.xaml
@@ -55,9 +55,14 @@
+
+
+
+
+
diff --git a/Filtration/ViewModels/MainWindowViewModel.cs b/Filtration/ViewModels/MainWindowViewModel.cs
index 168f006..6e4fcce 100644
--- a/Filtration/ViewModels/MainWindowViewModel.cs
+++ b/Filtration/ViewModels/MainWindowViewModel.cs
@@ -115,6 +115,7 @@ namespace Filtration.ViewModels
AddBackgroundColorThemeComponentCommand = new RelayCommand(OnAddBackgroundColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
AddBorderColorThemeComponentCommand = new RelayCommand(OnAddBorderColorThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
AddFontSizeThemeComponentCommand = new RelayCommand(OnAddFontSizeThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
+ AddAlertSoundThemeComponentCommand = new RelayCommand(OnAddAlertSoundThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable);
DeleteThemeComponentCommand = new RelayCommand(OnDeleteThemeComponentCommand, () => ActiveDocumentIsTheme && ActiveThemeIsEditable && _avalonDockWorkspaceViewModel.ActiveThemeViewModel.SelectedThemeComponent != null);
ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript);
@@ -215,6 +216,7 @@ namespace Filtration.ViewModels
public RelayCommand AddBackgroundColorThemeComponentCommand { get; }
public RelayCommand AddBorderColorThemeComponentCommand { get; }
public RelayCommand AddFontSizeThemeComponentCommand { get; }
+ public RelayCommand AddAlertSoundThemeComponentCommand { get; }
public RelayCommand DeleteThemeComponentCommand { get; }
public RelayCommand AddBlockCommand { get; }
@@ -684,6 +686,11 @@ namespace Filtration.ViewModels
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.AddThemeComponentCommand.Execute(ThemeComponentType.FontSize);
}
+ private void OnAddAlertSoundThemeComponentCommand()
+ {
+ _avalonDockWorkspaceViewModel.ActiveThemeViewModel.AddThemeComponentCommand.Execute(ThemeComponentType.AlertSound);
+ }
+
private void OnDeleteThemeComponentCommand()
{
_avalonDockWorkspaceViewModel.ActiveThemeViewModel.DeleteThemeComponentCommand.Execute(
diff --git a/Filtration/Views/MainWindow.xaml b/Filtration/Views/MainWindow.xaml
index 2fd013b..ed97dc0 100644
--- a/Filtration/Views/MainWindow.xaml
+++ b/Filtration/Views/MainWindow.xaml
@@ -130,6 +130,7 @@
+