Пример #1
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            string source = txtSource.Text;
            string target = txtTarget.Text;

            if (FileService.FileExists(source) && !string.IsNullOrEmpty(target))
            {
                if (ExpressUtility.IsShp(target))
                {
                    if (File.Exists(target))
                    {
                        if (!DeleteRelated(target))
                        {
                            return;
                        }
                        else
                        {
                            DeleteRelatedFiles(target);
                        }
                    }
                    else if (Directory.Exists(target))
                    {
                        string shp = Path.Combine(target, Path.GetFileNameWithoutExtension(source) + ".shp");
                        if (File.Exists(shp) && !DeleteRelated(shp))
                        {
                            return;
                        }
                        else
                        {
                            DeleteRelatedFiles(shp);
                        }
                    }
                }

                using (FdoBulkCopy bcp = ExpressUtility.CreateBulkCopy(source, target, chkCopySpatialContexts.Checked, true, chkFlatten.Checked))
                {
                    EtlProcessCtl ctl = new EtlProcessCtl(bcp);
                    Workbench.Instance.ShowContent(ctl, ViewRegion.Dialog);
                    base.Close();
                }
            }
            else
            {
                this.ShowError("Source and Target fields are required");
            }
        }