Handles application suspension.
This class maintains a list of the managers and tracks application suspension. When the app is suspended, any discovered targets tht implement ISuspendNotify are called.
Пример #1
0
        private static async void App_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            // unbind we're going to re-enter and don't want to loop...
            Application.Current.UnhandledException -= App_UnhandledException;

            // say we've handled this one. this allows our FATAL write to complete.
            e.Handled = true;

            // go...
            var log = (ILoggerAsync)pcl::MetroLog.LogManagerFactory.DefaultLogManager.GetLogger <Application>();
            await log.FatalAsync("The application crashed: " + e.Message, e.Exception);

            // if we're aborting, fake a suspend to flush the targets...
            await LazyFlushManager.FlushAllAsync(new LogWriteContext());

            // abort the app here...
            Application.Current.Exit();
        }
Пример #2
0
 public override void OnLogManagerCreated(ILogManager manager)
 {
     // initialize the suspend manager...
     LazyFlushManager.Initialize(manager);
 }
Пример #3
0
 internal static void Initialize(ILogManager manager)
 {
     Owners[manager] = new LazyFlushManager(manager);
 }
Пример #4
0
 internal static void Initialize(ILogManager manager)
 {
     Owners[manager] = new LazyFlushManager(manager);
 }