private void Number_reg_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { try { if (!(Regex.IsMatch(PulseUnWork.Text, @"^\d*$"))) { PulseUnWork.Clear(); throw new Exception("Error!!! Неправильные символы"); } else if (!(Regex.IsMatch(PulseWork.Text, @"^\d*$"))) { PulseWork.Clear(); throw new Exception("Error!!! Неправильные символы"); } else if (!(Regex.IsMatch(PressureSistol.Text, @"^\d*$"))) { PressureSistol.Clear(); throw new Exception("Error!!! Неправильные символы"); } else if (!(Regex.IsMatch(PressureDiastol.Text, @"^\d*$"))) { PressureDiastol.Clear(); throw new Exception("Error!!! Неправильные символы"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private async void Button_update_indicators_Click(object sender, RoutedEventArgs e) { try { if (!string.IsNullOrEmpty(PulseUnWork.Text) && !string.IsNullOrEmpty(PulseWork.Text) && !string.IsNullOrEmpty(PressureSistol.Text) && !string.IsNullOrEmpty(PressureDiastol.Text)) { WorkClass.indicator.pulseUnWork = Convert.ToInt32(PulseUnWork.Text); WorkClass.indicator.pulseWork = Convert.ToInt32(PulseWork.Text); WorkClass.indicator.pressureSistol = Convert.ToInt32(PressureSistol.Text); WorkClass.indicator.pressureDiastol = Convert.ToInt32(PressureDiastol.Text); await UpdateIdicatorsAsync(); PulseUnWork.Clear(); PulseWork.Clear(); PressureSistol.Clear(); PressureDiastol.Clear(); await ReadIndicatorAsync(); } else { throw new Exception("Поля не заполнены"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }