public void SendEventReport() { AppTelemetry.OverrideUID = "test"; NameValueCollection v = new NameValueCollection(); v.Add("data", "SomeData"); v.Add("value", "3"); AppTelemetry.ReportEvent("test", v); // Use REST API to test if write was succesful }
private async void Execute_UpdateCommand() { if (this.updating) { return; } Updating = true; CurrentState = State.Checking; try { Stopwatch watch = Stopwatch.StartNew(); using (var manager = await UpdateManager.GitHubUpdateManager("https://github.com/wolkesson/SampleCrunch", null, null, null, Properties.Settings.Default.PreRelease)) { var updates = await manager.CheckForUpdate(); var lastVersion = updates?.ReleasesToApply?.OrderBy(x => x.Version).LastOrDefault(); CurrentState = State.Downloading; await manager.DownloadReleases(new[] { lastVersion }); #if DEBUG System.Windows.Forms.MessageBox.Show("DEBUG: Don't actually perform the update in debug mode"); #else CurrentState = State.Installing; //manager.CreateShortcutForThisExe(); MainViewModel main = SimpleIoc.Default.GetInstance <MainViewModel>(); // Send Telemetry System.Collections.Specialized.NameValueCollection data = new System.Collections.Specialized.NameValueCollection { { "from", main.Version }, { "to", this.lastVersion.Version.ToString() }, { "elapse", watch.ElapsedMilliseconds.ToString() } }; AppTelemetry.ReportEvent("Updating", data); //System.Windows.Forms.MessageBox.Show("The application has been updated - please restart the app."); await manager.ApplyReleases(updates); await manager.UpdateApp(); BackupSettings(); CurrentState = State.Installed; #endif } } catch (Exception e) { AppTelemetry.ReportError("Update", e); CurrentState = State.Failed; } finally { if (CurrentState == State.Installed) { UpdateManager.RestartApp(); } Updating = false; } }