From c726e1f7697d9f0fe8cff387dc64dd00c4980b82 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 28 Feb 2018 11:42:21 +0200 Subject: Change LogManager to Instance. --- .../ViewModels/LoadingViewVM.cs | 4 ++-- .../Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 9 +++++---- .../Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs | 19 ++++++++++--------- 3 files changed, 17 insertions(+), 15 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 9acf26afd..f181ebb45 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -24,7 +24,7 @@ namespace Tango.MachineStudio.UI.ViewModels private INotificationProvider _notificationProvider; private INavigationManager _navigationManager; private IStudioModuleLoader _studioModuleLoader; - + private LogManager logManager = LogManager.Default; public IStudioApplicationManager ApplicationManager { get; set; } /// @@ -60,7 +60,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex); + logManager.Log(ex); InvokeUINow(() => { diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index fb2cd5c82..57f1d704c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -42,6 +42,7 @@ namespace Tango.MachineStudio.UI.ViewModels private INavigationManager _navigation; private bool _isDisconnecting; private Thread _updateCheckThread; + private LogManager logManager = LogManager.Default; /// /// Gets or sets the current loaded module. @@ -248,7 +249,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error in version update periodic check..."); + logManager.Log(ex, "Error in version update periodic check..."); } Thread.Sleep(TimeSpan.FromMinutes(4)); @@ -322,7 +323,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex); + logManager.Log(ex); _notificationProvider.ShowError(ex.Message); } @@ -341,7 +342,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex); + logManager.Log(ex); _notificationProvider.ShowError(ex.Message); } @@ -435,7 +436,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error popping out module " + module.Name); + logManager.Log(ex, "Error popping out module " + module.Name); _notificationProvider.ShowError("Error popping out module " + module.Name); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs index 6be4ba4ca..ab4fd8e0b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/UpdateViewVM.cs @@ -38,6 +38,7 @@ namespace Tango.MachineStudio.UI.ViewModels public class UpdateViewVM : ViewModel { private String _appPath = AppDomain.CurrentDomain.BaseDirectory; + private LogManager logManager = LogManager.Default; private INotificationProvider _notification; private INavigationManager _navigation; @@ -147,7 +148,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error while checking for version update!"); + logManager.Log(ex, "Error while checking for version update!"); Status = UpdateStatus.Error; } finally @@ -187,7 +188,7 @@ namespace Tango.MachineStudio.UI.ViewModels try { - LogManager.Log("Creating temporary file " + tempFile); + logManager.Log("Creating temporary file " + tempFile); int fileSize = 0; @@ -202,12 +203,12 @@ namespace Tango.MachineStudio.UI.ViewModels { using (FtpClient ftp = new FtpClient(_updateInfo.FtpHost, _updateInfo.UserName, _updateInfo.Password)) { - LogManager.Log("Connecting to FTP site: " + _updateInfo.FtpHost); + logManager.Log("Connecting to FTP site: " + _updateInfo.FtpHost); ftp.ConnectAsync().Wait(); - LogManager.Log("Retrieving download size..."); + logManager.Log("Retrieving download size..."); fileSize = (int)ftp.GetFileSize(_updateInfo.FilePath); - LogManager.Log("Download size: " + fileSize + " bytes."); - LogManager.Log("Starting download..."); + logManager.Log("Download size: " + fileSize + " bytes."); + logManager.Log("Starting download..."); ftp.DownloadAsync(fs, _updateInfo.FilePath).Wait(); } } @@ -225,7 +226,7 @@ namespace Tango.MachineStudio.UI.ViewModels { if (args.EventType == ZipProgressEventType.Extracting_AfterExtractEntry) { - LogManager.Log("Extracting " + Path.GetFileName(args.CurrentEntry.FileName)); + logManager.Log("Extracting " + Path.GetFileName(args.CurrentEntry.FileName)); UpdateProgress = ((double)(currentEntry++) / (double)zip.Entries.Count) * 100d; } }; @@ -250,7 +251,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch { - LogManager.Log("Could not extract file " + entry.FileName); + logManager.Log("Could not extract file " + entry.FileName); } } } @@ -260,7 +261,7 @@ namespace Tango.MachineStudio.UI.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error while extracting update package."); + logManager.Log(ex, "Error while extracting update package."); Status = UpdateStatus.Error; } finally -- cgit v1.3.1