private async void Send(Notification notification) { // Post JSON to server: var request = (HttpWebRequest)(WebRequest.Create(Config.EndpointUrl)); request.Method = "POST"; request.ContentType = "application/json"; request.Proxy = DetectedProxy; using (var streamWriter = new StreamWriter(await request.GetRequestStreamAsync())) { var json = JsonConvert.SerializeObject(notification, JsonSettings); streamWriter.Write(json); streamWriter.Flush(); } //TODO: add some checks try { var response = await request.GetResponseAsync(); } catch (WebException) { return; } }
private Notification CreateNotificationBase() { var notifierInfo = new NotifierInfo { Name = Notifier.Name, Version = Notifier.Version, Url = Notifier.Url.AbsoluteUri }; var notification = new Notification { ApiKey = Config.ApiKey, Notifier = notifierInfo, Events = new List<EventInfo>() }; return notification; }