protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ProfilerApp = new ProfilerApp(); dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += NetworkUpdate; dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1000 / 30); // 30 updates per second dispatcherTimer.Start(); }
protected override void OnExit(ExitEventArgs e) { base.OnExit(e); if (dispatcherTimer != null) { dispatcherTimer.Stop(); dispatcherTimer = null; } if (ProfilerApp != null) { ProfilerApp.Dispose(); ProfilerApp = null; } }