Added NLog logging
This commit is contained in:
@@ -54,6 +54,9 @@
|
||||
<Reference Include="Microsoft.Practices.ServiceLocation">
|
||||
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
<HintPath>..\packages\NLog.4.0.1\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System" />
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Windows.Media.Imaging;
|
||||
using Filtration.Common.ViewModels;
|
||||
using Filtration.Interface;
|
||||
using Filtration.ThemeEditor.Providers;
|
||||
using NLog;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
|
||||
namespace Filtration.ThemeEditor.ViewModels
|
||||
@@ -23,6 +24,8 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||
|
||||
public class ThemeViewModel : PaneViewModel, IThemeViewModel
|
||||
{
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IThemeProvider _themeProvider;
|
||||
private bool _filenameIsFake;
|
||||
private string _filePath;
|
||||
@@ -85,6 +88,11 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
|
||||
MessageBox.Show(@"Error saving filter theme - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
}
|
||||
@@ -103,19 +111,24 @@ namespace Filtration.ThemeEditor.ViewModels
|
||||
if (result != DialogResult.OK) return;
|
||||
|
||||
var previousFilePath = FilePath;
|
||||
//try
|
||||
//{
|
||||
try
|
||||
{
|
||||
FilePath = saveDialog.FileName;
|
||||
_themeProvider.SaveTheme(this, FilePath);
|
||||
_filenameIsFake = false;
|
||||
//RemoveDirtyFlag();
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// MessageBox.Show(@"Error saving theme file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
// MessageBoxImage.Error);
|
||||
// FilePath = previousFilePath;
|
||||
//}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (_logger.IsErrorEnabled)
|
||||
{
|
||||
_logger.Error(e);
|
||||
}
|
||||
|
||||
MessageBox.Show(@"Error saving theme file - " + e.Message, @"Save Error", MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
FilePath = previousFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
public void Close()
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
<package id="CommonServiceLocator" version="1.3" targetFramework="net451" />
|
||||
<package id="Extended.Wpf.Toolkit" version="2.4" targetFramework="net451" />
|
||||
<package id="MvvmLightLibs" version="5.1.1.0" targetFramework="net451" />
|
||||
<package id="NLog" version="4.0.1" targetFramework="net451" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user