Exemple #1
0
        protected override void OnExit(ExitEventArgs e)
        {
            if (_instanceMutex != null)
            {
                _instanceMutex.ReleaseMutex();
            }

            CursorManager.RestoreOriginalCursors();
            base.OnExit(e);
        }
Exemple #2
0
        private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            if (e.ExceptionObject is Exception ex)
            {
                Logger.LogError("Unhandled exception", ex);
            }
            else
            {
                Logger.LogError("Unhandled exception");
            }

            CursorManager.RestoreOriginalCursors();
        }
Exemple #3
0
 public static void Main()
 {
     AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     try
     {
         var application = new App();
         application.InitializeComponent();
         application.Run();
     }
     catch (Exception ex)
     {
         Logger.LogError("Unhandled exception", ex);
         CursorManager.RestoreOriginalCursors();
     }
 }
Exemple #4
0
 public static void Main(string[] args)
 {
     _args = args;
     Logger.LogInfo($"Color Picker started with pid={Environment.ProcessId}");
     AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
     try
     {
         using (var application = new App())
         {
             application.InitializeComponent();
             application.Run();
         }
     }
     catch (Exception ex)
     {
         Logger.LogError("Unhandled exception", ex);
         CursorManager.RestoreOriginalCursors();
     }
 }
Exemple #5
0
        public static void Main(string[] args)
        {
            _args = args;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            try
            {
                using (var application = new App())
                {
                    application.InitializeComponent();
                    application.Run();
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
#pragma warning restore CA1031 // Do not catch general exception types
            {
                Logger.LogError("Unhandled exception", ex);
                CursorManager.RestoreOriginalCursors();
            }
        }
Exemple #6
0
 private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     Logger.LogError("Unhandled exception", (e.ExceptionObject is Exception) ? (e.ExceptionObject as Exception) : new Exception());
     CursorManager.RestoreOriginalCursors();
 }