public static void SetupTelemetry(this MainWindowVmBase vm, Window win, string instrumentationKey, bool hideOnWindowClose) { AppInsights.StartTracking(instrumentationKey); SetAppEventHandlers(); AppInsights.Post("Telemetry started."); vm.HandleWindowEvents(win, null, hideOnWindowClose); }
private static void SetAppEventHandlers() { AppDomain.CurrentDomain.ProcessExit += (s, e) => { AppInsights.Post("Telemetry ended."); AppInsights.Flush(); }; }