private void Page_Unloaded(object sender, RoutedEventArgs e) { if (sniffer != null && sniffer.ListView == this.SnifferListView) { sniffer = null; } if (eventSink != null && eventSink.ListView == this.EventsListView) { Log.Unregister(eventSink); eventSink.Dispose(); eventSink = null; } if (instance == this) { instance = null; } }
public MainPage() { this.InitializeComponent(); if (sniffer == null) { sniffer = new ListViewSniffer(this.SnifferListView); } if (eventSink == null) { eventSink = new ListViewEventSink("List View Event Sink.", this.EventsListView); Log.Register(eventSink); } if (instance == null) { instance = this; } App.OwnershipChanged += App_OwnershipChanged; }