diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-24 19:30:23 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-04-24 19:30:23 +0300 |
| commit | 4b95b6c19bdf18e50068285b3b0a8a8ab0a7b4ce (patch) | |
| tree | 327f7c345e6364ee961916b628a1f8029459d7ee /Software/Visual_Studio/PPC | |
| parent | 7ebc478b390e52ea5332bf7c443ca6a8ac79154c (diff) | |
| download | Tango-4b95b6c19bdf18e50068285b3b0a8a8ab0a7b4ce.tar.gz Tango-4b95b6c19bdf18e50068285b3b0a8a8ab0a7b4ce.zip | |
Machine Studio v4.0.13.0
PPC v1.0.11.0
Diffstat (limited to 'Software/Visual_Studio/PPC')
5 files changed, 82 insertions, 4 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs index 1f63fcd55..0146f199b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/LoggingViewVM.cs @@ -62,8 +62,15 @@ namespace Tango.PPC.Technician.ViewModels ApplicationLogsViewSource.Filter = (x) => { - LogItemBase log = x as LogItemBase; - return String.IsNullOrWhiteSpace(Filter) || log.Category.ToString().ToLower().Contains(Filter.ToLower()) || log.Message.ToLower().Contains(Filter.ToLower()); + try + { + LogItemBase log = x as LogItemBase; + return String.IsNullOrWhiteSpace(Filter) || log.Category.ToString().ToLower().Contains(Filter.ToLower()) || log.Message.ToLower().Contains(Filter.ToLower()); + } + catch + { + return false; + } }; } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs index 7c6113829..5131522e0 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Publish/PPCPublisher.cs @@ -364,6 +364,7 @@ namespace Tango.PPC.Common.Publish } }; + zip.ParallelDeflateThreshold = -1; zip.Save(tempFile); OnPublishProgress(100, 100, "TUP file generated successfully."); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs index 0eb982d08..0bd9f9d1d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml.cs @@ -9,9 +9,12 @@ using System.Threading.Tasks; using System.Windows; using Tango.BL; using Tango.Core; +using Tango.Core.DI; using Tango.Core.Helpers; using Tango.Logging; using Tango.PPC.Common; +using Tango.PPC.Common.EventLogging; +using Tango.PPC.Common.Notifications; using Tango.PPC.Common.WatchDog; using Tango.Settings; @@ -22,6 +25,8 @@ namespace Tango.PPC.UI /// </summary> public partial class App : Application { + private WpfGlobalExceptionTrapper exceptionTrapper; + public static String[] StartupArgs { get; private set; } private LogManager LogManager = LogManager.Default; @@ -47,6 +52,10 @@ namespace Tango.PPC.UI base.OnStartup(e); + exceptionTrapper = new WpfGlobalExceptionTrapper(); + exceptionTrapper.Initialize(this); + exceptionTrapper.ApplicationCrashed += ExceptionTrapper_ApplicationCrashed; + LogManager.Categories.Clear(); CoreSettings.DefaultDataSource = new DataSource() @@ -72,5 +81,66 @@ namespace Tango.PPC.UI LogManager.Categories.AddRange(settings.LoggingCategories); } + + #region Global Exception Trapping + + /// <summary> + /// Handles the ApplicationCrashed event of the ExceptionTrapper. + /// </summary> + /// <param name="sender">The source of the event.</param> + /// <param name="e">The <see cref="ApplicationCrashedEventArgs"/> instance containing the event data.</param> + private void ExceptionTrapper_ApplicationCrashed(object sender, ApplicationCrashedEventArgs e) + { + e.TryRecover = true; + + try + { + LogManager.Log(e.Exception, "Application Crashed!"); + LogManager.Log("Trying to recover from application crash..."); + + try + { + if (Application.Current == null) + { + new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown }; + } + } + catch { } + + try + { + var eventLogger = TangoIOC.Default.GetInstance<IEventLogger>(); + if (eventLogger != null) + { + eventLogger.Log(e.Exception, "Application Crashed!"); + } + } + catch { } + + Application.Current.Dispatcher.Invoke(async () => + { + try + { + LogManager.Log("Trying to notify the user about the crash..."); + INotificationProvider notificationProvider = TangoIOC.Default.GetInstance<INotificationProvider>(); + + if (notificationProvider != null) + { + await notificationProvider.ShowError("An unexpected error has occurred. Use the application logs to diagnose and report the problem."); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error using the notification provider."); + } + }); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error in global exception trapper!"); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 1f4f36e0b..6244f13fb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.10.0")] +[assembly: AssemblyVersion("1.0.11.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> |
