示例#1
0
        /// <summary>
        /// 加载参数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btLoding_Click(object sender, EventArgs e)
        {
            var filePath = bastDataPath + "\\" + this.cbQueryList.Text;
            var fileByte = FileHelper.FileToBytes(filePath);
            var model    = ByteConvertHelper.Bytes2T <ParameterModel>(fileByte);

            var a = new SelectModel {
                Value = model.postType.GetHashCode(), Title = model.postType.GetFieldDisplay()
            };
            var b = new SelectModel {
                Value = model.postType.GetHashCode(), Title = model.postType.GetFieldDisplay()
            };

            if (model != null)
            {
                this.tbDataBody.Text = model.postBody;
                this.tbUrl.Text      = model.postUrl.AbsoluteUri;
                var postTypeList = postType.ToList();
                this.cbPostType.SelectedIndex = postTypeList.IndexOf(postTypeList.Where(item => item.Value == model.postType.GetHashCode()).FirstOrDefault());

                var langTypeList = langType.ToList();
                this.cbLangType.SelectedIndex = langTypeList.IndexOf(langTypeList.Where(item => item.Value == model.langType.GetHashCode()).FirstOrDefault());
                this.dgvFiles.Rows.Clear();
                foreach (var item in model.fileList)
                {
                    var dgvIndex = this.dgvFiles.Rows.Add();
                    this.dgvFiles.Rows[dgvIndex].Cells[0].Value = item;
                }
            }
        }
示例#2
0
        /// <summary>
        /// 加载历史查询数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btLoding_Click(object sender, EventArgs e)
        {
            //var filePath = bastDataPath + "\\" + this.cbQueryList.Text;
            var fileModel = this.cbQueryList.SelectedItem.ToOfType <FilesTree>();

            if (fileModel.IsFolder)
            {
                MessageBox.Show("请不要选择目录.");
                return;
            }

            var fileByte = FileHelper.FileToBytes(fileModel.AbsolutePath);
            var model    = ByteConvertHelper.Bytes2T <ParameterModel>(fileByte);

            var a = new SelectModel {
                Value = model.postType.GetHashCode(), Title = model.postType.GetFieldDisplay()
            };
            var b = new SelectModel {
                Value = model.postType.GetHashCode(), Title = model.postType.GetFieldDisplay()
            };

            if (model != null)
            {
                this.tbDataBody.Text = model.postBody;
                this.tbUrl.Text      = model.postUrl.AbsoluteUri;
                var postTypeList = postType.ToList();
                this.cbPostType.SelectedIndex = postTypeList.IndexOf(postTypeList.Where(item => item.Value == model.postType.GetHashCode()).FirstOrDefault());

                var langTypeList = langType.ToList();
                this.cbLangType.SelectedIndex = langTypeList.IndexOf(langTypeList.Where(item => item.Value == model.langType.GetHashCode()).FirstOrDefault());
                this.dgvFiles.Rows.Clear();
                foreach (var item in model.fileList)
                {
                    var dgvIndex = this.dgvFiles.Rows.Add();
                    this.dgvFiles.Rows[dgvIndex].Cells[0].Value = item;
                }
                this.cbIsBinary.Checked = model.IsBinary;

                this.dgvParameter.Rows.Clear();
                if (model.HeadersDic != null)
                {
                    foreach (var item in model.HeadersDic)
                    {
                        var dgvIndex = this.dgvParameter.Rows.Add();
                        this.dgvParameter.Rows[dgvIndex].Cells[0].Value = item.Key;
                        this.dgvParameter.Rows[dgvIndex].Cells[1].Value = item.Value;
                    }
                }
            }
        }