public ViewSource(string filePath)
        {
            InitializeComponent();
            if (string.IsNullOrEmpty(filePath))
            { MessageBox.Show("请先选择文件");
              return;
            }
            this.Title = filePath + "的内容";
            FilePath=filePath;
            CSVHelper helper = new CSVHelper(FilePath,'\t');
            DataTable dt = helper.CsVTable;
             listView.DataContext = dt; 
             sourceGridView.Columns.Clear();

             foreach (var colum in dt.Columns)
             {
                 DataColumn dc = (DataColumn)colum;
                 GridViewColumn column = new GridViewColumn();
                 column.DisplayMemberBinding = new Binding(dc.ColumnName);
                 column.Header = dc.ColumnName;
                 sourceGridView.Columns.Add(column);
             }
             Binding bind = new Binding();
             listView.SetBinding(ListView.ItemsSourceProperty, bind);             
        }
        private void btnReplace_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(OutputFolder))
            {
                MessageBox.Show("请先选择结果输出文件夹");
                return;
            }
            if (string.IsNullOrEmpty(ReplaceColumnName))
            {
                MessageBox.Show("你没有选择要替换的列,请选择");
                return;
            }

            try
            {

                CSVHelper helper = new CSVHelper(csvFilePath, '\t');
                OutputList.Clear();
                this.lblReulstMsg.Content = "正在转换";
                foreach (var item in ConfigHelper.ConfigSetting.GroupSettings)
                {
                    DataTable dt = helper.CsVTable.Copy();
                    string groupName = item.GroupName;
                    LogHelper.WriteLog("####################################################################");
                    LogHelper.WriteLog(string.Format("正在替换组:{0}", groupName));

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        foreach (var map in item.GroupReplaceItems)
                        {
                            try
                            {
                                if (dt.Rows[i][ReplaceColumnName].ToString().Trim()==map.SourceString.Trim())
                                {
                                    LogHelper.WriteLog(string.Format("找到对应的配置:{0}", map.SourceString));
                                    dt.Rows[i][ReplaceColumnName] = dt.Rows[i][ReplaceColumnName].ToString().Replace(map.SourceString, map.ReplaceString);
                                    LogHelper.WriteLog(string.Format("进行替换{0}==>:{1}", map.SourceString, map.ReplaceString));
                                }

                            }
                            catch (Exception ex)
                            {
                                LogHelper.WriteLog("列替换异常:");
                                LogHelper.WriteLog(ex.Message, ex);
                            }
                        }
                    }
                    string path = OutputFolder + "\\" + groupName.ToLower() + "_" + csvFilePath.Substring(csvFilePath.LastIndexOf("\\") + 1);
                    LogHelper.WriteLog(string.Format("输出的转换的文件路径:{0}", path));
                    OutputList.Add(path);
                    helper.WriteDataTableToCsVFile(dt, path);
                    LogHelper.WriteLog("####################################################################");
                }
                this.lblReulstMsg.Content = "转换完成了";
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.Message, ex);
               
            }
           
           
           
            //
        }