Esempio n. 1
0
        private string ReadProgramInfoHandle(ref ushort flib, string para)
        {
            string message = null;

            var res = new ReadProgramInfoResultModel();

            var ret = new ProgramInfoHelper().ReadProgramInfo(flib, ref res);

            if (ret.Item1 == -16)
            {
                var ret_conn = ConnectHelper.BuildConnect(ref flib, m_ip, m_port, m_timeout);

                if (ret_conn == 0)
                {
                    ret = new ProgramInfoHelper().ReadProgramInfo(flib, ref res);
                }
            }

            if (ret.Item1 != 0)
            {
                message = ret.Item2;
            }
            GetResultEvent?.Invoke(new BaseCNCResultModel <ReadProgramInfoResultModel>()
            {
                Value = new List <ReadProgramInfoResultModel>()
                {
                    res
                }, Id = para
            });

            return(message);
        }
        public HubReadWriterResultModel ReadProgramInfo(HubReadWriterModel hubRead)
        {
            ReadProgramInfoResultModel readProgramInfo = new ReadProgramInfoResultModel();
            var res = new ProgramInfoHelper().ReadProgramInfo(flib, ref readProgramInfo);

            return(new HubReadWriterResultModel()
            {
                Result = readProgramInfo,
                Error = res.Item2,
                Success = res.Item1 == 0,
                SuccessTip = hubRead.SuccessTip,
                ErrorTip = hubRead.ErrorTip
            });
        }