/// <summary> /// This handler is called, whenever a message on the subscribed topic is received. /// </summary> /// <param name="message"> is the received message.</param> protected override void ReceiveMessage(WarningNotification message) { // Split operator and roboy log with code 0 for operator log, 1 for roboy log if (message.code == 0) { LogSubscriber.Instance.EnqueueOperatorMessage(message); } }
private void OnShowWarningNotificationExecute() { if (MinimizeWindow) { Application.Current.MainWindow.SetCurrentValue(Window.WindowStateProperty, WindowState.Minimized); } var notification = new WarningNotification { Title = NotificationTitle, Message = NotificationMessage, Command = new TaskCommand(async() => await _messageService.ShowAsync("You just clicked a notification")), IsClosable = IsClosable, Priority = NotificationPriority }; _notificationService.ShowNotification(notification); }
private async Task PostRequst(string _uri, WarningNotification data) { HttpClient _httpClient = new HttpClient(); try { var jsonData = new StringContent(System.Text.Json.JsonSerializer.Serialize(data), Encoding.UTF8, "application/json"); using var httpResponse = await _httpClient.PostAsync(_uri, jsonData); if (httpResponse.StatusCode == HttpStatusCode.OK) { Console.WriteLine("OK"); } } catch (Exception error) { Console.WriteLine("[Error]Post request: " + error.Message); } }
public void RemoveCampaign(CampaignLoadingItem item) { WarningNotification.OpenNotificationWindow("Do you really want to delete the Campaign " + item.title + "?", delegate { ActuallyRemoveCampaign(item); }); }
public void OnRemove() { WarningNotification.OpenNotificationWindow("Do you really want to delete the page " + page.name + "?", delegate { onRemove.Invoke(); }); }
public async void filterData(Sensor s) { if (s.PM25 > 250 || s.PM10 > 430 || s.O3 > 748 || s.CO > 34000 || s.NO2 > 400 || s.SO2 > 1600) { await _repository.Create(s); _messageHubContext.Clients.All.SendAsync("send", s); } if (s.PM25 >= 91 && s.PM25 <= 120) { WarningNotification w = new WarningNotification() { name = "PM 2.5", value = s.PM25, type = "Poor" }; await PostRequst(urlController, w); } else if (s.PM25 >= 121 && s.PM25 <= 250) { WarningNotification w = new WarningNotification() { name = "PM 2.5", value = s.PM25, type = "Very Poor" }; await PostRequst(urlController, w); } else if (s.PM25 > 250) { WarningNotification w = new WarningNotification() { name = "PM 2.5", value = s.PM25, type = "Severe" }; await PostRequst(urlController, w); } if (s.PM10 >= 251 && s.PM10 <= 350) { WarningNotification w = new WarningNotification() { name = "PM 10", value = s.PM10, type = "Poor" }; await PostRequst(urlController, w); } else if (s.PM10 >= 351 && s.PM10 <= 430) { WarningNotification w = new WarningNotification() { name = "PM 10", value = s.PM10, type = "Very Poor" }; await PostRequst(urlController, w); } else if (s.PM10 > 430) { WarningNotification w = new WarningNotification() { name = "PM 10", value = s.PM10, type = "Severe" }; await PostRequst(urlController, w); } if (s.O3 >= 169 && s.O3 <= 208) { WarningNotification w = new WarningNotification() { name = "O3", value = s.O3, type = "Poor" }; await PostRequst(urlController, w); } else if (s.O3 >= 209 && s.O3 <= 748) { WarningNotification w = new WarningNotification() { name = "O3", value = s.O3, type = "Very Poor" }; await PostRequst(urlController, w); } else if (s.O3 > 748) { WarningNotification w = new WarningNotification() { name = "O3", value = s.O3, type = "Severe" }; await PostRequst(urlController, w); } if (s.CO >= 10000 && s.CO <= 17999) { WarningNotification w = new WarningNotification() { name = "CO", value = s.CO, type = "Poor" }; await PostRequst(urlController, w); } else if (s.CO >= 18000 && s.CO <= 34000) { WarningNotification w = new WarningNotification() { name = "CO", value = s.CO, type = "Very Poor" }; await PostRequst(urlController, w); } else if (s.CO > 34000) { WarningNotification w = new WarningNotification() { name = "CO", value = s.CO, type = "Severe" }; await PostRequst(urlController, w); } if (s.NO2 >= 181 && s.NO2 <= 280) { WarningNotification w = new WarningNotification() { name = "NO2", value = s.NO2, type = "Poor" }; await PostRequst(urlController, w); } else if (s.NO2 >= 281 && s.NO2 <= 400) { WarningNotification w = new WarningNotification() { name = "NO2", value = s.NO2, type = "Very Poor" }; await PostRequst(urlController, w); } else if (s.NO2 > 400) { WarningNotification w = new WarningNotification() { name = "NO2", value = s.NO2, type = "Severe" }; await PostRequst(urlController, w); } if (s.SO2 >= 381 && s.SO2 <= 800) { WarningNotification w = new WarningNotification() { name = "SO2", value = s.SO2, type = "Poor" }; await PostRequst(urlController, w); } else if (s.SO2 >= 801 && s.SO2 <= 1600) { WarningNotification w = new WarningNotification() { name = "SO2", value = s.SO2, type = "Very Poor" }; await PostRequst(urlController, w); } else if (s.SO2 > 1600) { WarningNotification w = new WarningNotification() { name = "SO2", value = s.SO2, type = "Severe" }; await PostRequst(urlController, w); } }
public void SetInstance() { instance = this; }