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);
 }