diff options
Diffstat (limited to 'Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs index 0b1a10f13..99be80b29 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs @@ -145,18 +145,21 @@ namespace Tango.MachineEM.UI.ViewModels /// </summary> public MainViewVM() { - MainViewLogger logger = new MainViewLogger(); - //logger.NewLog += (output) => - //{ - // Log += output + Environment.NewLine; - //}; + SimpleStringLogger logger = new SimpleStringLogger(LogCategory.Critical, LogCategory.Error, LogCategory.General, LogCategory.Warning); + logger.LogReceived += (sedner, log) => + { + Log += log.ToString() + Environment.NewLine; + }; LogManager.RegisterLogger(logger); + LogManager.Log("Embedded Emulator Started..."); + + Emulator = new MachineEmulator(new BasicTransporter()); StartCommand = new RelayCommand(Start, (x) => !Emulator.IsStarted); - StopCommand = new RelayCommand(Stop,(x) => Emulator.IsStarted); + StopCommand = new RelayCommand(Stop, (x) => Emulator.IsStarted); RunCommand = new RelayCommand(RunSelectedStub, (x) => !_running); CancelCommand = new RelayCommand(Cancel, (x) => _running); ClearCommand = new RelayCommand(() => Log = String.Empty); @@ -257,32 +260,5 @@ namespace Tango.MachineEM.UI.ViewModels } #endregion - - #region Custom Logger - - public class MainViewLogger : ILogger - { - public bool Enabled { get; set; } - public bool Immediate { get; set; } - public event Action<String> NewLog; - - public MainViewLogger() - { - Enabled = true; - Immediate = true; - } - - public void OnError(LogItemBase output) - { - NewLog?.Invoke(output.ToString()); - } - - public void OnTrace(LogItemBase output) - { - NewLog?.Invoke(output.ToString()); - } - } - - #endregion } } |
