private void btnLogBackgroundSignal_Click(object sender, EventArgs e) { outputTextbox.AppendText("Logging signal\n"); Preact.Api api = new Preact.Api(codeTextbox.Text, secretTextbox.Text); try { var month = 1; var day = 1; var timeSpan = DateTime.UtcNow.AddDays(-3) - new DateTime(1970, month, day); Preact.BackgroundSignalRequest request = new Preact.BackgroundSignalRequest() { AccountId = accountIdTextbox.Text, Name = signalNameTextbox.Text, Value = int.Parse(signalValueTextbox.Text), Timestamp = timeSpan.TotalSeconds }; outputTextbox.AppendText(JsonConvert.SerializeObject(request, Formatting.Indented) + "\n"); api.LogBackgroundSignal(request); } catch (Exception ex) { outputTextbox.AppendText("Log failure:" + ex.Message); outputTextbox.AppendText(ex.StackTrace); } }
public void LogBackgroundSignal(BackgroundSignalRequest request) { JObject param = JObject.FromObject(request); Helpers.SendData(ProjectCode, ProjectApiSecret, api_endpoint_metrics, "POST", param); }
public void LogBackgroundSignal(BackgroundSignalRequest request) { JObject param = JObject.FromObject(request); Helpers.SendData(ProjectCode, ProjectApiSecret, api_endpoint_metrics, "POST", param); }