コード例 #1
0
        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);
        }
コード例 #2
0
 protected virtual void OnWeightMeasurement(WeightEventArgs _MyEventParameters)
 {
     if (WeightMeasurementEvent != null)
     {
         WeightMeasurementEvent(_MyEventParameters);
     }
 }