Exemplo n.º 1
0
        /// <summary>
        /// 导出通道数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Export_Click(object sender, EventArgs e)
        {
            try
            {
                this.btn_Export.Enabled = false;

                GetChannelNames();
                if (channelNameList.Count == 0)
                {
                    MessageBox.Show("请选择至少一个通道");
                    return;
                }

                dataList.Clear();

                for (int i = 0; i < channelNameList.Count; i++)
                {
                    CitFileHelper citHelper = new CitFileHelper();

                    if (channelNameList[i].sNameEn == "sample")
                    {
                        double[] d = citHelper.GetSingleChannelDataNoConvert(filePathStr, 2);
                        dataList.Add(d);
                    }
                    else
                    {
                        double[] d = citHelper.GetSingleChannelData(filePathStr, citHelper.GetChannelId(channelNameList[i].sNameEn, filePathStr));
                        dataList.Add(d);
                    }
                }

                //使用中文名称
                if (ckb_Chinese.Checked)
                {
                    ExportDataTxt(true);
                }
                else
                {
                    ExportDataTxt(false);
                }

                MessageBox.Show("数据导出完成");

                this.btn_Export.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemplo n.º 2
0
        public string GetChannelNum(string json)
        {
            ResultInfo resultInfo = new ResultInfo();

            try
            {
                Request request  = JsonConvert.DeserializeObject <Request>(json);
                string  FilePath = request.filepath;
                var     item     = citHelper.GetChannelId(request.channelname, FilePath);
                string  result   = JsonConvert.SerializeObject(item);
                resultInfo.flag = 1;
                resultInfo.msg  = "";
                resultInfo.data = result;
            }
            catch (Exception ex)
            {
                resultInfo.flag = 0;
                resultInfo.msg  = ex.Message;
            }

            return(JsonConvert.SerializeObject(resultInfo));
        }