示例#1
0
        public bool Excute()
        {
            bool flag = false;

            this.m_sb.Remove(0, this.m_sb.Length);
            ESRI.ArcGIS.Geoprocessor.Geoprocessor geoprocessor = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
            geoprocessor.RegisterGeoProcessorEvents(this);
            try
            {
                geoprocessor.OverwriteOutput = true;
                geoprocessor.ClearMessages();
                try
                {
                    object obj2 = geoprocessor.Execute(this.m_pGPProcess, null);
                    flag = true;
                }
                catch (Exception)
                {
                    flag = false;
                }
            }
            catch
            {
            }
            geoprocessor.UnRegisterGeoProcessorEvents(this);
            if (!this.m_IsPostToolExecute)
            {
                if (geoprocessor.MessageCount > 0)
                {
                    for (int i = 0; i <= (geoprocessor.MessageCount - 1); i++)
                    {
                        if (this.m_sb.Length > 0)
                        {
                            this.m_sb.Append("\r\n");
                        }
                        this.m_sb.Append(geoprocessor.GetMessage(i));
                    }
                }
                this.txtMessage.Text = this.m_sb.ToString();
            }
            this.xpProgressBar1.Position = this.xpProgressBar1.PositionMax;
            this.timer1.Enabled          = false;
            this.m_IsPostToolExecute     = false;
            this.m_IsPreExecute          = false;
            if (this.chkAutoCompleteSucc.Checked)
            {
                base.Close();
                if (this.m_attchForm != null)
                {
                    this.m_attchForm.Close();
                }
            }
            return(flag);
        }
示例#2
0
 public static bool RunTool(ESRI.ArcGIS.Geoprocessor.Geoprocessor geoprocessor, IGPProcess process,
                            ITrackCancel TC)
 {
     geoprocessor.OverwriteOutput = true;
     geoprocessor.ClearMessages();
     try
     {
         object obj2 = geoprocessor.Execute(process, TC);
         ReturnMessages(geoprocessor);
         return(true);
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         ReturnMessages(geoprocessor);
         return(false);
     }
 }