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.ProjectDebug
{
    class UpdateValueAction : ChemicalWeighingAction, IAction
    {
        public void Run(RuntimeParameter runtime)
        {
            base.RunIni(runtime);       //必须要调用

            ComboBox comboBox = base.GetControlById("MCCombobox2") as ComboBox;
            TextBox TextBox = base.GetControlById("MCTextBox1") as TextBox;
            if (comboBox == null)
            {
                ICSharpCode.Core.LoggingService<ModifyAction>.Warn("{工程调试-打开} 缺少ComboBox控件...");
                runtime.IsReturn = false;
                return;
            }
            string str = comboBox.SelectedValue.ToString();
            string strTextBox = TextBox.Text.ToString();
            if (str != "" && str != null)
            {
                if (strTextBox != "" && strTextBox != null)
                {
                    int hlsd1 = int.Parse(strTextBox);
                    var writeResult16 = BasePlcHelper.Instance.PlcWriteByRunName(str, new object[] { hlsd1 });
                }
            }
        }
    }
}