using Mesnac.Action.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Mesnac.Action.ChemicalWeighing.DeviceParamManage
{
    public class SelectDeviceParamInfo : ChemicalWeighingAction, IAction
    {
        private RuntimeParameter _runtime;

        public void Run(RuntimeParameter runtime)
        {
            base.RunIni(runtime);       //必须要调用
            this._runtime = runtime;
            foreach (var item in BasePlcHelper.Instance.dataKeyValues)
            {
                if (item.Name == "VccHighWei" || item.Name == "VccLowWei" || item.Name == "VccJogWei"|| item.Name == "VccExcWei" || item.Name == "GFAHighWei" || item.Name == "GFALowWei" || item.Name == "GFAJogWei" || item.Name == "GFAExcWei" || item.Name == "ResinHighWei" || item.Name == "ResinLowWei" || item.Name == "ResinJogWei" || item.Name == "ResinExcWei")
                {
                    TextBox comboBox = base.GetControlById(item.Name) as TextBox;
                    comboBox.Text = item.NowValue.ToFloat().ToString();
                }
                else
                {
                    TextBox comboBox = base.GetControlById(item.Name) as TextBox;
                    comboBox.Text = item.NowValue.ToInt().ToString();
                }
            }
            
        }
    }
}