Пример #1
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            string inFtrNm  = cmbSampleFeatureClass.Text;
            string outCsvNm = txtCSV.Text;

            if (inFtrNm == "" || inFtrNm == null || outCsvNm == "" || outCsvNm == null)
            {
                MessageBox.Show("You must specify both a feature class and a output CSV file name");
                return;
            }
            this.Visible = false;
            esriUtil.Forms.RunningProcess.frmRunningProcessDialog rp = new RunningProcess.frmRunningProcessDialog(false);
            System.DateTime dt1 = DateTime.Now;
            rp.addMessage("Exporting samples to the following location:\n" + outCsvNm);
            rp.stepPGBar(50);
            rp.Show();
            rp.Refresh();
            try
            {
                IFeatureClass ftrCls = ftrDic[inFtrNm];
                geoUtil.exportTableToTxt((ITable)ftrCls, System.IO.Path.GetDirectoryName(outCsvNm), System.IO.Path.GetFileName(outCsvNm));
            }
            catch (Exception ex)
            {
                rp.addMessage(ex.ToString());
            }
            finally
            {
                DateTime dt2 = DateTime.Now;
                TimeSpan ts  = dt2.Subtract(dt1);
                string   dur = "Export took " + ts.Hours.ToString() + " hours " + ts.Minutes.ToString() + " minutes and " + ts.Seconds.ToString() + " seconds to complete.";
                rp.addMessage(dur);
                rp.stepPGBar(100);
                rp.addMessage("Finished exporting samples");
                rp.enableClose();
                rp.Refresh();
                this.Close();
            }
        }