Fixed another copy paste bug, changed speaker icon to button
This commit is contained in:
parent
0c470b3c97
commit
3337531161
|
@ -49,11 +49,13 @@
|
||||||
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
<Reference Include="PresentationCore" />
|
||||||
|
<Reference Include="PresentationFramework" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
<HintPath>..\packages\MvvmLightLibs.5.1.1.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Xaml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
@ -64,6 +66,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\FileSystemService.cs" />
|
<Compile Include="Services\FileSystemService.cs" />
|
||||||
|
<Compile Include="Services\MessageBoxService.cs" />
|
||||||
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
<Compile Include="ViewModels\FiltrationViewModelBase.cs" />
|
||||||
<Compile Include="ViewModels\PaneViewModel.cs" />
|
<Compile Include="ViewModels\PaneViewModel.cs" />
|
||||||
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
<Compile Include="WindsorInstallers\ServicesInstaller.cs" />
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace Filtration.Common.Services
|
||||||
|
{
|
||||||
|
public interface IMessageBoxService
|
||||||
|
{
|
||||||
|
MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MessageBoxService : IMessageBoxService
|
||||||
|
{
|
||||||
|
public MessageBoxResult Show(string caption, string message, MessageBoxButton buttons, MessageBoxImage image)
|
||||||
|
{
|
||||||
|
return MessageBox.Show(message, caption, buttons, image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,6 +13,11 @@ namespace Filtration.Common.WindsorInstallers
|
||||||
Component.For<IFileSystemService>()
|
Component.For<IFileSystemService>()
|
||||||
.ImplementedBy<FileSystemService>()
|
.ImplementedBy<FileSystemService>()
|
||||||
.LifeStyle.Singleton);
|
.LifeStyle.Singleton);
|
||||||
|
|
||||||
|
container.Register(
|
||||||
|
Component.For<IMessageBoxService>()
|
||||||
|
.ImplementedBy<MessageBoxService>()
|
||||||
|
.LifeStyle.Singleton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,10 @@
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Filtration.Common\Filtration.Common.csproj">
|
||||||
|
<Project>{8cb44f28-2956-4c2a-9314-72727262edd4}</Project>
|
||||||
|
<Name>Filtration.Common</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||||
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||||
<Name>Filtration.ObjectModel</Name>
|
<Name>Filtration.ObjectModel</Name>
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using Filtration.Common.Services;
|
||||||
using Filtration.ObjectModel;
|
using Filtration.ObjectModel;
|
||||||
using Filtration.ObjectModel.BlockItemTypes;
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
using Filtration.ObjectModel.Enums;
|
using Filtration.ObjectModel.Enums;
|
||||||
using Filtration.ObjectModel.ThemeEditor;
|
using Filtration.ObjectModel.ThemeEditor;
|
||||||
using Filtration.ThemeEditor.Services;
|
using Filtration.ThemeEditor.Services;
|
||||||
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace Filtration.ThemeEditor.Tests.Services
|
namespace Filtration.ThemeEditor.Tests.Services
|
||||||
|
@ -27,8 +29,9 @@ namespace Filtration.ThemeEditor.Tests.Services
|
||||||
var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||||
testInputTheme.Components.Add(testInputThemeComponent);
|
testInputTheme.Components.Add(testInputThemeComponent);
|
||||||
testInputBlockItem.ThemeComponent = testInputThemeComponent;
|
testInputBlockItem.ThemeComponent = testInputThemeComponent;
|
||||||
|
var mockMessageBoxService = new Mock<IMessageBoxService>();
|
||||||
|
|
||||||
var service = new ThemeService();
|
var service = new ThemeService(mockMessageBoxService.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
||||||
|
@ -55,7 +58,9 @@ namespace Filtration.ThemeEditor.Tests.Services
|
||||||
testInputTheme.Components.Add(testInputThemeComponent);
|
testInputTheme.Components.Add(testInputThemeComponent);
|
||||||
testInputBlockItem.ThemeComponent = testInputBlockItemThemeComponent;
|
testInputBlockItem.ThemeComponent = testInputBlockItemThemeComponent;
|
||||||
|
|
||||||
var service = new ThemeService();
|
var mockMessageBoxService = new Mock<IMessageBoxService>();
|
||||||
|
|
||||||
|
var service = new ThemeService(mockMessageBoxService.Object);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Filtration.Common.Services;
|
||||||
using Filtration.ObjectModel;
|
using Filtration.ObjectModel;
|
||||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||||
using Filtration.ObjectModel.BlockItemTypes;
|
using Filtration.ObjectModel.BlockItemTypes;
|
||||||
|
@ -16,6 +17,13 @@ namespace Filtration.ThemeEditor.Services
|
||||||
|
|
||||||
public class ThemeService : IThemeService
|
public class ThemeService : IThemeService
|
||||||
{
|
{
|
||||||
|
private readonly IMessageBoxService _messageBoxService;
|
||||||
|
|
||||||
|
public ThemeService(IMessageBoxService messageBoxService)
|
||||||
|
{
|
||||||
|
_messageBoxService = messageBoxService;
|
||||||
|
}
|
||||||
|
|
||||||
public void ApplyThemeToScript(Theme theme, ItemFilterScript script)
|
public void ApplyThemeToScript(Theme theme, ItemFilterScript script)
|
||||||
{
|
{
|
||||||
var mismatchedComponents = false;
|
var mismatchedComponents = false;
|
||||||
|
@ -58,9 +66,9 @@ namespace Filtration.ThemeEditor.Services
|
||||||
|
|
||||||
if (mismatchedComponents)
|
if (mismatchedComponents)
|
||||||
{
|
{
|
||||||
MessageBox.Show(
|
_messageBoxService.Show("Possible Theme Mismatch",
|
||||||
"Not all theme components had matches - are you sure this theme is designed for this script?",
|
"Not all theme components had matches - are you sure this theme is designed for this script?",
|
||||||
"Possible Theme Mismatch", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using Filtration.Common.Services;
|
||||||
using Filtration.Common.ViewModels;
|
using Filtration.Common.ViewModels;
|
||||||
using Filtration.Interface;
|
using Filtration.Interface;
|
||||||
using Filtration.ThemeEditor.Providers;
|
using Filtration.ThemeEditor.Providers;
|
||||||
|
@ -27,12 +28,15 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
private readonly IThemeProvider _themeProvider;
|
private readonly IThemeProvider _themeProvider;
|
||||||
|
private readonly IMessageBoxService _messageBoxService;
|
||||||
private bool _filenameIsFake;
|
private bool _filenameIsFake;
|
||||||
private string _filePath;
|
private string _filePath;
|
||||||
|
|
||||||
public ThemeViewModel(IThemeProvider themeProvider)
|
public ThemeViewModel(IThemeProvider themeProvider,
|
||||||
|
IMessageBoxService messageBoxService)
|
||||||
{
|
{
|
||||||
_themeProvider = themeProvider;
|
_themeProvider = themeProvider;
|
||||||
|
_messageBoxService = messageBoxService;
|
||||||
|
|
||||||
Components = new ObservableCollection<ThemeComponentViewModel>();
|
Components = new ObservableCollection<ThemeComponentViewModel>();
|
||||||
|
|
||||||
|
@ -93,8 +97,7 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show(@"Error saving filter theme - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
_messageBoxService.Show("Save Error", "Error saving filter theme - " + e.Message, MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
MessageBoxImage.Error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +128,7 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show(@"Error saving theme file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
_messageBoxService.Show("Save Error", "Error saving theme file - " + e.Message, MessageBoxButton.OK,
|
||||||
MessageBoxImage.Error);
|
MessageBoxImage.Error);
|
||||||
FilePath = previousFilePath;
|
FilePath = previousFilePath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ namespace Filtration.Converters
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return (bool) value ? Visibility.Visible : Visibility.Hidden;
|
|
||||||
if (value is bool && targetType == typeof (Visibility))
|
if (value is bool && targetType == typeof (Visibility))
|
||||||
{
|
{
|
||||||
var val = (bool) value;
|
var val = (bool) value;
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace Filtration.Translators
|
||||||
{
|
{
|
||||||
internal interface IItemFilterBlockTranslator
|
internal interface IItemFilterBlockTranslator
|
||||||
{
|
{
|
||||||
|
void InitialiseForExistingScript(ItemFilterScript script);
|
||||||
ItemFilterBlock TranslateStringToItemFilterBlock(string inputString);
|
ItemFilterBlock TranslateStringToItemFilterBlock(string inputString);
|
||||||
string TranslateItemFilterBlockToString(ItemFilterBlock block);
|
string TranslateItemFilterBlockToString(ItemFilterBlock block);
|
||||||
void ReplaceColorBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString);
|
void ReplaceColorBlockItemsFromString(ObservableCollection<IItemFilterBlockItem> blockItems, string inputString);
|
||||||
|
@ -34,6 +35,12 @@ namespace Filtration.Translators
|
||||||
_themeComponentListBuilder = themeComponentListBuilder;
|
_themeComponentListBuilder = themeComponentListBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InitialiseForExistingScript(ItemFilterScript script)
|
||||||
|
{
|
||||||
|
_themeComponentListBuilder.Initialise(script.ThemeComponents);
|
||||||
|
_blockGroupHierarchyBuilder.Initialise(script.ItemFilterBlockGroups.First());
|
||||||
|
}
|
||||||
|
|
||||||
// This method converts a string into a ItemFilterBlock. This is used for pasting ItemFilterBlocks
|
// This method converts a string into a ItemFilterBlock. This is used for pasting ItemFilterBlocks
|
||||||
// and reading ItemFilterScripts from a file.
|
// and reading ItemFilterScripts from a file.
|
||||||
public ItemFilterBlock TranslateStringToItemFilterBlock(string inputString)
|
public ItemFilterBlock TranslateStringToItemFilterBlock(string inputString)
|
||||||
|
|
|
@ -9,6 +9,7 @@ using System.Windows.Data;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using Castle.Core.Internal;
|
using Castle.Core.Internal;
|
||||||
|
using Filtration.Common.Services;
|
||||||
using Filtration.Common.ViewModels;
|
using Filtration.Common.ViewModels;
|
||||||
using Filtration.Interface;
|
using Filtration.Interface;
|
||||||
using Filtration.ObjectModel;
|
using Filtration.ObjectModel;
|
||||||
|
@ -18,7 +19,6 @@ using GalaSoft.MvvmLight.CommandWpf;
|
||||||
using GalaSoft.MvvmLight.Messaging;
|
using GalaSoft.MvvmLight.Messaging;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Clipboard = System.Windows.Clipboard;
|
using Clipboard = System.Windows.Clipboard;
|
||||||
using MessageBox = System.Windows.MessageBox;
|
|
||||||
|
|
||||||
namespace Filtration.ViewModels
|
namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
|
@ -70,6 +70,7 @@ namespace Filtration.ViewModels
|
||||||
private readonly IItemFilterBlockTranslator _blockTranslator;
|
private readonly IItemFilterBlockTranslator _blockTranslator;
|
||||||
private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel;
|
private readonly IAvalonDockWorkspaceViewModel _avalonDockWorkspaceViewModel;
|
||||||
private readonly IItemFilterPersistenceService _persistenceService;
|
private readonly IItemFilterPersistenceService _persistenceService;
|
||||||
|
private readonly IMessageBoxService _messageBoxService;
|
||||||
|
|
||||||
private bool _isDirty;
|
private bool _isDirty;
|
||||||
private IItemFilterBlockViewModel _selectedBlockViewModel;
|
private IItemFilterBlockViewModel _selectedBlockViewModel;
|
||||||
|
@ -81,13 +82,15 @@ namespace Filtration.ViewModels
|
||||||
public ItemFilterScriptViewModel(IItemFilterBlockViewModelFactory itemFilterBlockViewModelFactory,
|
public ItemFilterScriptViewModel(IItemFilterBlockViewModelFactory itemFilterBlockViewModelFactory,
|
||||||
IItemFilterBlockTranslator blockTranslator,
|
IItemFilterBlockTranslator blockTranslator,
|
||||||
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
IAvalonDockWorkspaceViewModel avalonDockWorkspaceViewModel,
|
||||||
IItemFilterPersistenceService persistenceService)
|
IItemFilterPersistenceService persistenceService,
|
||||||
|
IMessageBoxService messageBoxService)
|
||||||
{
|
{
|
||||||
_itemFilterBlockViewModelFactory = itemFilterBlockViewModelFactory;
|
_itemFilterBlockViewModelFactory = itemFilterBlockViewModelFactory;
|
||||||
_blockTranslator = blockTranslator;
|
_blockTranslator = blockTranslator;
|
||||||
_avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
|
_avalonDockWorkspaceViewModel = avalonDockWorkspaceViewModel;
|
||||||
_avalonDockWorkspaceViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
|
_avalonDockWorkspaceViewModel.ActiveDocumentChanged += OnActiveDocumentChanged;
|
||||||
_persistenceService = persistenceService;
|
_persistenceService = persistenceService;
|
||||||
|
_messageBoxService = messageBoxService;
|
||||||
_itemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModel>();
|
_itemFilterBlockViewModels = new ObservableCollection<IItemFilterBlockViewModel>();
|
||||||
|
|
||||||
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand);
|
ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand);
|
||||||
|
@ -342,8 +345,8 @@ namespace Filtration.ViewModels
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
_messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK,
|
||||||
MessageBoxImage.Error);
|
MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +381,7 @@ namespace Filtration.ViewModels
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show(@"Error saving filter file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
_messageBoxService.Show("Save Error", "Error saving filter file - " + e.Message, MessageBoxButton.OK,
|
||||||
MessageBoxImage.Error);
|
MessageBoxImage.Error);
|
||||||
Script.FilePath = previousFilePath;
|
Script.FilePath = previousFilePath;
|
||||||
}
|
}
|
||||||
|
@ -421,7 +424,8 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
var messageText = "The following script validation errors occurred:" + Environment.NewLine + failures;
|
var messageText = "The following script validation errors occurred:" + Environment.NewLine + failures;
|
||||||
|
|
||||||
MessageBox.Show(messageText, "Script Validation Failure", MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
_messageBoxService.Show("Script Validation Failure", messageText, MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Exclamation);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,8 +442,9 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show(@"Want to save your changes to this script?",
|
var result = _messageBoxService.Show("Filtration",
|
||||||
@"Filtration", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
|
"Want to save your changes to this script?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case MessageBoxResult.Yes:
|
case MessageBoxResult.Yes:
|
||||||
|
@ -538,6 +543,7 @@ namespace Filtration.ViewModels
|
||||||
var clipboardText = Clipboard.GetText();
|
var clipboardText = Clipboard.GetText();
|
||||||
if (clipboardText.IsNullOrEmpty()) return;
|
if (clipboardText.IsNullOrEmpty()) return;
|
||||||
|
|
||||||
|
_blockTranslator.InitialiseForExistingScript(Script);
|
||||||
var translatedBlock = _blockTranslator.TranslateStringToItemFilterBlock(clipboardText);
|
var translatedBlock = _blockTranslator.TranslateStringToItemFilterBlock(clipboardText);
|
||||||
if (translatedBlock == null) return;
|
if (translatedBlock == null) return;
|
||||||
|
|
||||||
|
@ -562,8 +568,10 @@ namespace Filtration.ViewModels
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
MessageBox.Show(e.Message + Environment.NewLine + e.StackTrace + Environment.NewLine +
|
_messageBoxService.Show("Paste Error",
|
||||||
e.InnerException.Message + Environment.NewLine + e.InnerException.StackTrace, "Paste Error", MessageBoxButton.OK);
|
e.Message + Environment.NewLine + e.StackTrace + Environment.NewLine +
|
||||||
|
e.InnerException.Message + Environment.NewLine + e.InnerException.StackTrace, MessageBoxButton.OK,
|
||||||
|
MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -717,8 +725,9 @@ namespace Filtration.ViewModels
|
||||||
|
|
||||||
public void DeleteBlock(IItemFilterBlockViewModel targetBlockViewModel)
|
public void DeleteBlock(IItemFilterBlockViewModel targetBlockViewModel)
|
||||||
{
|
{
|
||||||
var result = MessageBox.Show("Are you sure you wish to delete this block?", "Delete Confirmation",
|
var result = _messageBoxService.Show("Delete Confirmation", "Are you sure you wish to delete this block?",
|
||||||
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
MessageBoxButton.YesNo,
|
||||||
|
MessageBoxImage.Question);
|
||||||
|
|
||||||
if (result == MessageBoxResult.Yes)
|
if (result == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
using Filtration.Common.Services;
|
||||||
using Filtration.Common.ViewModels;
|
using Filtration.Common.ViewModels;
|
||||||
using Filtration.Interface;
|
using Filtration.Interface;
|
||||||
using Filtration.Models;
|
using Filtration.Models;
|
||||||
|
@ -45,6 +46,7 @@ namespace Filtration.ViewModels
|
||||||
private readonly IThemeService _themeService;
|
private readonly IThemeService _themeService;
|
||||||
private readonly IUpdateCheckService _updateCheckService;
|
private readonly IUpdateCheckService _updateCheckService;
|
||||||
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
|
private readonly IUpdateAvailableViewModel _updateAvailableViewModel;
|
||||||
|
private readonly IMessageBoxService _messageBoxService;
|
||||||
|
|
||||||
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
|
public MainWindowViewModel(IItemFilterScriptRepository itemFilterScriptRepository,
|
||||||
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
IItemFilterScriptTranslator itemFilterScriptTranslator,
|
||||||
|
@ -54,7 +56,8 @@ namespace Filtration.ViewModels
|
||||||
IThemeProvider themeProvider,
|
IThemeProvider themeProvider,
|
||||||
IThemeService themeService,
|
IThemeService themeService,
|
||||||
IUpdateCheckService updateCheckService,
|
IUpdateCheckService updateCheckService,
|
||||||
IUpdateAvailableViewModel updateAvailableViewModel)
|
IUpdateAvailableViewModel updateAvailableViewModel,
|
||||||
|
IMessageBoxService messageBoxService)
|
||||||
{
|
{
|
||||||
_itemFilterScriptRepository = itemFilterScriptRepository;
|
_itemFilterScriptRepository = itemFilterScriptRepository;
|
||||||
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
_itemFilterScriptTranslator = itemFilterScriptTranslator;
|
||||||
|
@ -65,6 +68,7 @@ namespace Filtration.ViewModels
|
||||||
_themeService = themeService;
|
_themeService = themeService;
|
||||||
_updateCheckService = updateCheckService;
|
_updateCheckService = updateCheckService;
|
||||||
_updateAvailableViewModel = updateAvailableViewModel;
|
_updateAvailableViewModel = updateAvailableViewModel;
|
||||||
|
_messageBoxService = messageBoxService;
|
||||||
|
|
||||||
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
NewScriptCommand = new RelayCommand(OnNewScriptCommand);
|
||||||
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
|
CopyScriptCommand = new RelayCommand(OnCopyScriptCommand, () => ActiveDocumentIsScript);
|
||||||
|
@ -319,9 +323,9 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
}
|
}
|
||||||
MessageBox.Show(@"Error loading filter script - " + e.Message, @"Script Load Error",
|
_messageBoxService.Show("Script Load Error", "Error loading filter script - " + e.Message,
|
||||||
MessageBoxButtons.OK,
|
MessageBoxButton.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxImage.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,9 +353,9 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
}
|
}
|
||||||
MessageBox.Show(@"Error loading filter theme - " + e.Message, @"Theme Load Error",
|
_messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message,
|
||||||
MessageBoxButtons.OK,
|
MessageBoxButton.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxImage.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,15 +382,16 @@ namespace Filtration.ViewModels
|
||||||
{
|
{
|
||||||
_logger.Error(e);
|
_logger.Error(e);
|
||||||
}
|
}
|
||||||
MessageBox.Show(@"Error loading filter theme - " + e.Message, @"Theme Load Error",
|
_messageBoxService.Show("Theme Load Error", "Error loading filter theme - " + e.Message,
|
||||||
MessageBoxButtons.OK,
|
MessageBoxButton.OK,
|
||||||
MessageBoxIcon.Error);
|
MessageBoxImage.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = MessageBox.Show(@"Are you sure you wish to apply this theme to the current filter script?",
|
var result = _messageBoxService.Show("Confirm",
|
||||||
@"Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
|
"Are you sure you wish to apply this theme to the current filter script?", MessageBoxButton.YesNo,
|
||||||
if (result == DialogResult.No)
|
MessageBoxImage.Question);
|
||||||
|
if (result == MessageBoxResult.No)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using Filtration.Common.Services;
|
||||||
using Filtration.Common.ViewModels;
|
using Filtration.Common.ViewModels;
|
||||||
using Filtration.Properties;
|
using Filtration.Properties;
|
||||||
using Filtration.Services;
|
using Filtration.Services;
|
||||||
|
@ -14,10 +15,12 @@ namespace Filtration.ViewModels
|
||||||
internal class SettingsPageViewModel : FiltrationViewModelBase, ISettingsPageViewModel
|
internal class SettingsPageViewModel : FiltrationViewModelBase, ISettingsPageViewModel
|
||||||
{
|
{
|
||||||
private readonly IItemFilterPersistenceService _itemFilterPersistenceService;
|
private readonly IItemFilterPersistenceService _itemFilterPersistenceService;
|
||||||
|
private readonly IMessageBoxService _messageBoxService;
|
||||||
|
|
||||||
public SettingsPageViewModel(IItemFilterPersistenceService itemFilterPersistenceService)
|
public SettingsPageViewModel(IItemFilterPersistenceService itemFilterPersistenceService, IMessageBoxService messageBoxService)
|
||||||
{
|
{
|
||||||
_itemFilterPersistenceService = itemFilterPersistenceService;
|
_itemFilterPersistenceService = itemFilterPersistenceService;
|
||||||
|
_messageBoxService = messageBoxService;
|
||||||
SaveCommand = new RelayCommand(OnSaveCommand);
|
SaveCommand = new RelayCommand(OnSaveCommand);
|
||||||
|
|
||||||
DefaultFilterDirectory = Settings.Default.DefaultFilterDirectory;
|
DefaultFilterDirectory = Settings.Default.DefaultFilterDirectory;
|
||||||
|
@ -41,7 +44,7 @@ namespace Filtration.ViewModels
|
||||||
}
|
}
|
||||||
catch (DirectoryNotFoundException)
|
catch (DirectoryNotFoundException)
|
||||||
{
|
{
|
||||||
MessageBox.Show("The entered Default Filter Directory is invalid or does not exist.", "Error",
|
_messageBoxService.Show("Error", "The entered Default Filter Directory is invalid or does not exist.",
|
||||||
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
MessageBoxButton.OK, MessageBoxImage.Exclamation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
<TextBlock Grid.Column="0" Text="{Binding DisplayHeading}" Style="{StaticResource DisplayHeading}" />
|
||||||
<WrapPanel Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right">
|
<WrapPanel Grid.Column="1" Grid.Row="0" HorizontalAlignment="Right">
|
||||||
<Button Command="{Binding ElementName=SettingsGrid, Path=DataContext.PlaySoundCommand}" Width="20" Height="20" Padding="3" Background="Transparent" BorderBrush="Transparent">
|
<Button Command="{Binding ElementName=SettingsGrid, Path=DataContext.PlaySoundCommand}" Width="20" Height="20" Background="Transparent" BorderBrush="Transparent">
|
||||||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
</Button>
|
</Button>
|
||||||
<ComboBox ItemsSource="{Binding ElementName=SettingsGrid, Path=DataContext.SoundsAvailable}" SelectedValue="{Binding Value}" />
|
<ComboBox ItemsSource="{Binding ElementName=SettingsGrid, Path=DataContext.SoundsAvailable}" SelectedValue="{Binding Value}" />
|
||||||
|
|
|
@ -111,12 +111,18 @@
|
||||||
|
|
||||||
<!-- Item Preview Box -->
|
<!-- Item Preview Box -->
|
||||||
<WrapPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
<WrapPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
|
||||||
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png"
|
<Button Command="{Binding PlaySoundCommand}"
|
||||||
VerticalAlignment="Center"
|
Width="25"
|
||||||
HorizontalAlignment="Center"
|
Height="25"
|
||||||
Height="15" Width="15"
|
VerticalAlignment="Center"
|
||||||
Margin="0,0,3,0"
|
HorizontalAlignment="Center"
|
||||||
Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}" />
|
Margin="0,0,3,0"
|
||||||
|
Visibility="{Binding HasSound, Converter={StaticResource BooleanVisibilityConverter}}"
|
||||||
|
Background="Transparent"
|
||||||
|
BorderBrush="Transparent"
|
||||||
|
ToolTip="Click to preview drop sound">
|
||||||
|
<Image Source="/Filtration;component/Resources/Icons/speaker_icon.png" VerticalAlignment="Center" HorizontalAlignment="Center" />
|
||||||
|
</Button>
|
||||||
<ToggleButton Margin="0,2,2,2"
|
<ToggleButton Margin="0,2,2,2"
|
||||||
Style="{StaticResource ChromelessToggleButton}"
|
Style="{StaticResource ChromelessToggleButton}"
|
||||||
x:Name="ItemPreviewButton"
|
x:Name="ItemPreviewButton"
|
||||||
|
|
Loading…
Reference in New Issue