public static IElectronicScalesController CreateController(ElectronicScalesControl electronicScales)
 {
     switch (electronicScales.ElectronicScalesType)
     {
         case ElectronicScalesType.None:
             return new DefaultController(electronicScales);
         default:
             return new DefaultController(electronicScales);
     }
 }
 public DefaultController(ElectronicScalesControl control)
 {
     this.ElectronicScales = control;
     this.serialPort = this.ElectronicScales.SerialPort;
 }
        public void RestoreConfig(ElectronicScalesControl electronicScalesControl)
        {
            if (electronicScalesControl == null)
                throw new ArgumentNullException("ElectronicScalesControl");

            ElectronicScalesConfig config = ElectronicScalesConfigManager.Current.GetConfig(electronicScalesControl.ConfigName);
            if (config != null)
            {
                electronicScalesControl.ApplyConfig(config);
            }
            else
            {
                MessageService.ShowError("电子称控件没有配置初始化,请先配置初始化。");
            }

        }