diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-04 14:18:28 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-08-04 14:18:28 +0300 |
| commit | 91d5be468e28266a4ae18ee3845f0cb3433dd898 (patch) | |
| tree | 267173e3d906a2168ac72692b8d4ec523f59d30f /Software/Visual_Studio | |
| parent | a5c6a3baaf597ef58369192716ffe02d3af87ac2 (diff) | |
| download | Tango-91d5be468e28266a4ae18ee3845f0cb3433dd898.tar.gz Tango-91d5be468e28266a4ae18ee3845f0cb3433dd898.zip | |
Reset Application & Firmware "Logs" tab even when machine connection is the same.
Fixed issue on FileSystem download.
Ignored issue with procedure error highlighting caused application error.
Fixed issue when logout/login with different environment did not refreshed the list of available machines for connection.
Diffstat (limited to 'Software/Visual_Studio')
10 files changed, 73 insertions, 58 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs index 2860f8c63..0195d24c1 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Firmware/ViewModels/LogsViewVM.cs @@ -145,14 +145,11 @@ namespace Tango.FSE.Firmware.ViewModels private void MachineProvider_MachineConnected(object sender, MachineConnectedEventArgs e) { - if (e.DifferentFromPrevious) - { - _loaded = false; + _loaded = false; - if (MachineProvider.IsPPCAvailable && IsVisible) - { - LoadLogFiles(); - } + if (MachineProvider.IsPPCAvailable && IsVisible) + { + LoadLogFiles(); } } diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/LogsViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/LogsViewVM.cs index 30946ba0f..66270df7e 100644 --- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/LogsViewVM.cs +++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.PPCConsole/ViewModels/LogsViewVM.cs @@ -147,14 +147,11 @@ namespace Tango.FSE.PPCConsole.ViewModels private void MachineProvider_MachineConnected(object sender, MachineConnectedEventArgs e) { - if (e.DifferentFromPrevious) - { - _loaded = false; + _loaded = false; - if (MachineProvider.ConnectionType.IsRemote() && IsVisible) - { - LoadLogFiles(); - } + if (MachineProvider.IsPPCAvailable && IsVisible) + { + LoadLogFiles(); } } diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs index b1f4446d2..ab6a788f2 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/FileSystem/FileSystemHandler.cs @@ -15,6 +15,7 @@ namespace Tango.FSE.Common.FileSystem private System.Timers.Timer _transferRateTimer; private double _lastPosition; private TaskCompletionSource<FileSystemHandlerStatus> _completionSource; + private bool _completed; public event EventHandler<FileSystemHandlerStatus> StatusChanged; public event EventHandler<TangoProgressChangedEventArgs<double>> ProgressChanged; @@ -134,21 +135,33 @@ namespace Tango.FSE.Common.FileSystem internal void RaiseFailed(Exception exception) { - Status = FileSystemHandlerStatus.Failed; - FailedException = exception; - _completionSource.SetException(exception); + if (!_completed) + { + _completed = true; + Status = FileSystemHandlerStatus.Failed; + FailedException = exception; + _completionSource.SetException(exception); + } } internal void RaiseAborted() { - Status = FileSystemHandlerStatus.Aborted; - _completionSource.SetException(new OperationCanceledException("File system operation aborted.")); + if (!_completed) + { + _completed = true; + Status = FileSystemHandlerStatus.Aborted; + _completionSource.SetException(new OperationCanceledException("File system operation aborted.")); + } } internal void RaiseCompleted() { - Status = FileSystemHandlerStatus.Completed; - _completionSource.SetResult(Status); + if (!_completed) + { + _completed = true; + Status = FileSystemHandlerStatus.Completed; + _completionSource.SetResult(Status); + } } public void Abort() diff --git a/Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs b/Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs index 14997cd32..309839831 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.UI/Authentication/DefaultAuthenticationProvider.cs @@ -237,6 +237,8 @@ namespace Tango.FSE.UI.Authentication _tokenRefreshTimer.Stop(); + MemoryCacheManager.Default.ClearAll(); + await NavigationManager.NavigateWithObject<LoginViewVM.NavigationObject>(NavigationView.LoginView, new LoginViewVM.NavigationObject() { IsLoggingOut = true, diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 01def8679..40710ea21 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -1709,12 +1709,12 @@ namespace Tango.MachineStudio.Developer.ViewModels { try { - LogManager.Log(String.Format("Uploading process parameters table {0}...", SelectedProcessParametersTable.Name)); + LogManager.Log($"Uploading process parameters table {SelectedProcessParametersTable.Name}..."); await MachineOperator.UploadProcessParameters(SelectedProcessParametersTable); } catch (Exception ex) { - LogManager.LogFormat(ex, "Failed to upload process parameters table {0}", SelectedProcessParametersTable.Name); + LogManager.Log(ex, $"Failed to upload process parameters table {SelectedProcessParametersTable.Name}"); _notification.ShowError("Failed to upload the selected process parameters." + Environment.NewLine + ex.Message); } } @@ -2189,7 +2189,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (ActiveJob != null) { - LogManager.LogFormat("Adding new segment to job {0}...", ActiveJob.Name); + LogManager.Log($"Adding new segment to job {ActiveJob.Name}..."); Segment seg = new Segment(); seg.Job = ActiveJob; seg.Name = "SEGMENT"; @@ -2342,7 +2342,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { if (SelectedSegment != null) { - LogManager.LogFormat("Adding new brush stop to segment...", SelectedSegment.SegmentIndex.ToString()); + LogManager.Log($"Adding new brush stop to segment '{SelectedSegment.SegmentIndex}'..."); var stop = new BrushStop(); @@ -2373,7 +2373,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> private void DuplicateSelectedBrushStops() { - LogManager.LogFormat("Duplicating {0} brush stops...", SelectedBrushStops.Count); + LogManager.Log($"Duplicating {SelectedBrushStops.Count} brush stops..."); foreach (var stop in SelectedBrushStops.OrderBy(x => x.StopIndex)) { @@ -2391,7 +2391,7 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> private void DuplicateSelectedSegments() { - LogManager.LogFormat("Duplicating {0} segments...", SelectedSegments.Count); + LogManager.Log($"Duplicating {SelectedSegments.Count} segments..."); int start_index = SelectedSegments.Max(x => x.SegmentIndex); @@ -2419,7 +2419,7 @@ namespace Tango.MachineStudio.Developer.ViewModels { CanWork = false; - LogManager.LogFormat("Duplicating {0} jobs...", SelectedJobs.Count); + LogManager.Log($"Duplicating {SelectedJobs.Count} jobs..."); int index = SelectedMachine.Jobs.Max(x => x.JobIndex); diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs index 0e32af6ed..a3a682833 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/ScriptEditor.cs @@ -2458,9 +2458,16 @@ namespace Tango.Scripting.Editors public void HighlighError(int position, int length) { - ITextMarker marker = errorMarkerService.Create(position, length); - marker.MarkerTypes = TextMarkerTypes.SquigglyUnderline; - marker.MarkerColor = Colors.Red; + try + { + ITextMarker marker = errorMarkerService.Create(position, length); + marker.MarkerTypes = TextMarkerTypes.SquigglyUnderline; + marker.MarkerColor = Colors.Red; + } + catch (Exception ex) + { + Debug.WriteLine($"Error highlighting script error.\n{ex.ToString()}"); + } } public void ClearErrors() diff --git a/Software/Visual_Studio/Tango.Logging/FileLogger.cs b/Software/Visual_Studio/Tango.Logging/FileLogger.cs index 0839a5ee7..041b56be4 100644 --- a/Software/Visual_Studio/Tango.Logging/FileLogger.cs +++ b/Software/Visual_Studio/Tango.Logging/FileLogger.cs @@ -138,6 +138,8 @@ namespace Tango.Logging /// <param name="output">The output.</param> public void OnLog(LogItemBase output) { + if (output.SkipFileLogging) return; + try { if (DateTime.Now.Date > _logFileTimeDate.Date) diff --git a/Software/Visual_Studio/Tango.Logging/LogItemBase.cs b/Software/Visual_Studio/Tango.Logging/LogItemBase.cs index 01d520f6a..944f61130 100644 --- a/Software/Visual_Studio/Tango.Logging/LogItemBase.cs +++ b/Software/Visual_Studio/Tango.Logging/LogItemBase.cs @@ -24,10 +24,22 @@ namespace Tango.Logging /// </summary> public Object LogObject { + get { return _logObject; } set { _logObject = value; } } + [NonSerialized] + private bool _skipFileLogging; + /// <summary> + /// Gets or sets a value indicating whether this log should not be written to a file. + /// </summary> + public bool SkipFileLogging + { + get { return _skipFileLogging; } + set { _skipFileLogging = value; } + } + /// <summary> /// Gets or sets the caller method adding the exception. /// </summary> diff --git a/Software/Visual_Studio/Tango.Logging/LogManager.cs b/Software/Visual_Studio/Tango.Logging/LogManager.cs index bbc6baf57..55264164a 100644 --- a/Software/Visual_Studio/Tango.Logging/LogManager.cs +++ b/Software/Visual_Studio/Tango.Logging/LogManager.cs @@ -102,9 +102,9 @@ namespace Tango.Logging /// </summary> /// <param name="e">Exception.</param> /// <param name="description">Error description.</param> - public Exception Log(Exception e, String description = null, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) + public Exception Log(Exception e, String description = null, bool skipFileLogging = false, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) { - return Log(e, LogCategory.Error, description, caller, file, lineNumber); + return Log(e, LogCategory.Error, description, skipFileLogging, caller, file, lineNumber); } /// <summary> @@ -112,7 +112,7 @@ namespace Tango.Logging /// </summary> /// <param name="e">Exception.</param> /// <param name="description">Error description.</param> - public Exception Log(Exception e, LogCategory category, String description = null, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) + public Exception Log(Exception e, LogCategory category, String description = null, bool skipFileLogging = false, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) { if (!Categories.Contains(category)) return e; @@ -125,6 +125,7 @@ namespace Tango.Logging log.Category = category; log.Description = description; log.Message = log.Description + Environment.NewLine + log.Exception.FlattenException(); + log.SkipFileLogging = skipFileLogging; AppendLog(log); @@ -132,47 +133,28 @@ namespace Tango.Logging } /// <summary> - /// Add new exception log item. - /// </summary> - /// <param name="e">Exception.</param> - /// <param name="description">Error description.</param> - public Exception LogFormat(Exception e, String description, object argument, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) - { - return Log(e, LogCategory.Error, String.Format(description, argument), caller, file, lineNumber); - } - - /// <summary> - /// Add new message log item. - /// </summary> - /// <param name="message">Message.</param> - public String LogFormat(String message, object argument, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) - { - return Log(String.Format(message, argument), LogCategory.Info, null, caller, file, lineNumber); - } - - /// <summary> /// Add new message log item. /// </summary> /// <param name="message">Message.</param> - public String Log(String message, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) + public String Log(String message, bool skipFileLogging = false, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) { - return Log(message, LogCategory.Info, null, caller, file, lineNumber); + return Log(message, LogCategory.Info, null, skipFileLogging, caller, file, lineNumber); } /// <summary> /// Add new message log item. /// </summary> /// <param name="message">Message.</param> - public String Log(String message, LogCategory category, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) + public String Log(String message, LogCategory category, bool skipFileLogging = false, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) { - return Log(message, category, null, caller, file, lineNumber); + return Log(message, category, null, skipFileLogging, caller, file, lineNumber); } /// <summary> /// Add new message log item. /// </summary> /// <param name="message">Message.</param> - public String Log(String message, LogCategory category, Object logObject, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) + public String Log(String message, LogCategory category, Object logObject, bool skipFileLogging = false, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int lineNumber = 0) { if (!Categories.Contains(category)) return message; @@ -184,6 +166,7 @@ namespace Tango.Logging log.Category = category; log.Message = message; log.LogObject = logObject; + log.SkipFileLogging = skipFileLogging; AppendLog(log); diff --git a/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs b/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs index 4e378bfbf..efe74c899 100644 --- a/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs +++ b/Software/Visual_Studio/Tango.Logging/SessionFileLogger.cs @@ -102,6 +102,8 @@ namespace Tango.Logging /// <param name="output">The output.</param> public void OnLog(LogItemBase output) { + if (output.SkipFileLogging) return; + if (_inInSession) { try |
