private WeightEventArgs ParseResults(string _inpstr) { NumberFormatInfo provider = new NumberFormatInfo(); provider.NumberDecimalSeparator = "."; string sweight = "0"; string sunit = "0"; double lweit = 0; WeightEventArgs parseres = null; Match match = RegexResulth.Match(_inpstr); if (match.Success) { sweight = match.Groups["weight"].Value; sunit = match.Groups["unit"].Value; } try { lweit = Convert.ToDouble(sweight, provider); } catch (Exception error) { log.Error(error); log.Debug("Получено с весов: " + _inpstr); } parseres = new WeightEventArgs(lweit, sunit); return(parseres); }
protected virtual void OnWeightMeasurement(WeightEventArgs _MyEventParameters) { if (WeightMeasurementEvent != null) { WeightMeasurementEvent(_MyEventParameters); } }