public FrameHandler(PageViewTelemetryModule module, Frame frame)
            {
                this.module = module;

                this.frame             = frame;
                this.frame.Navigating += this.HandleFrameNavigatingEvent;
                this.frame.Navigated  += this.HandleFrameNavigatedEvent;
                this.frame.Unloaded   += this.HandleFrameUnloadedEvent;

                this.stopwatch = new Stopwatch();

                Task dontWait = PlatformDispatcher.RunAsync(this.TrackCurrentFrameContent);
            }
 public void Dispose()
 {
     Task dontWait = PlatformDispatcher.RunAsync(() =>
     {
         // unhook the event handlers; this needs to happen on the UI thread.
         Frame current = this.frame;
         if (current != null)
         {
             current.Navigating -= this.HandleFrameNavigatingEvent;
             current.Navigated  -= this.HandleFrameNavigatedEvent;
             current.Unloaded   -= this.HandleFrameUnloadedEvent;
             this.frame          = null;
         }
     });
 }
Esempio n. 3
0
 internal void Initialize()
 {
     ExceptionHandler.Start(() => PlatformDispatcher.RunAsync(() => this.OnStarted(null)));
     CoreApplication.Resuming   += (sender, e) => this.OnStarted(e);
     CoreApplication.Suspending += (sender, e) => this.OnStopping(new ApplicationStoppingEventArgs(RunWithDeferral(e)));
 }