Beispiel #1
0
        private void btnExecute_Click(object sender, EventArgs e)
        {
            string rstNm  = cmbSampleFeatureClass.Text;
            string mdPath = txtOutputPath.Text;

            if (rstNm == null || rstNm == "")
            {
                MessageBox.Show("You must specify a output name", "No Output", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (mdPath == null || mdPath == "")
            {
                MessageBox.Show("You must specify a model path", "No Output", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            ITable tbl = rstDic[rstNm];

            this.Visible = false;
            esriUtil.Forms.RunningProcess.frmRunningProcessDialog rp = new RunningProcess.frmRunningProcessDialog(false);
            DateTime dt = DateTime.Now;

            rp.addMessage("Predicting new data. This may take a while...");
            rp.stepPGBar(10);
            rp.TopMost = true;
            rp.Show();
            try
            {
                Statistics.ModelHelper.runProgressBar("Predicting data");
                Statistics.ModelHelper br = new Statistics.ModelHelper(mdPath);
                rp.Refresh();
                br.predictNewData(tbl, qf);
                this.DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                rp.addMessage(ex.ToString());
            }
            finally
            {
                Statistics.ModelHelper.closeProgressBar();
                DateTime dt2 = DateTime.Now;
                TimeSpan ts  = dt2.Subtract(dt);
                string   t   = " in " + ts.Days.ToString() + " days " + ts.Hours.ToString() + " hours " + ts.Minutes.ToString() + " minutes and " + ts.Seconds.ToString() + " seconds .";
                rp.stepPGBar(100);
                rp.addMessage("Finished calculations" + t);
                rp.enableClose();
                this.Close();
            }
        }
 private void btnExecute_Click(object sender, EventArgs e)
 {
     string rstNm = cmbSampleFeatureClass.Text;
     string mdPath = txtOutputPath.Text;
     if (rstNm == null || rstNm == "")
     {
         MessageBox.Show("You must specify a output name","No Output",MessageBoxButtons.OK,MessageBoxIcon.Error);
         return;
     }
     if (mdPath == null || mdPath == "")
     {
         MessageBox.Show("You must specify a model path","No Output",MessageBoxButtons.OK,MessageBoxIcon.Error);
         return;
     }
     ITable tbl = rstDic[rstNm];
     this.Visible = false;
     esriUtil.Forms.RunningProcess.frmRunningProcessDialog rp = new RunningProcess.frmRunningProcessDialog(false);
     DateTime dt = DateTime.Now;
     rp.addMessage("Predicting new data. This may take a while...");
     rp.stepPGBar(10);
     rp.TopMost = true;
     rp.Show();
     try
     {
         Statistics.ModelHelper.runProgressBar("Predicting data");
         Statistics.ModelHelper br = new Statistics.ModelHelper(mdPath);
         rp.Refresh();
         br.predictNewData(tbl,qf);
         this.DialogResult = DialogResult.OK;
     }
     catch (Exception ex)
     {
         rp.addMessage(ex.ToString());
     }
     finally
     {
         Statistics.ModelHelper.closeProgressBar();
         DateTime dt2 = DateTime.Now;
         TimeSpan ts = dt2.Subtract(dt);
         string t = " in " + ts.Days.ToString() + " days " + ts.Hours.ToString() + " hours " + ts.Minutes.ToString() + " minutes and " + ts.Seconds.ToString() + " seconds .";
         rp.stepPGBar(100);
         rp.addMessage("Finished calculations" + t);
         rp.enableClose();
         this.Close();
     }
 }
 private ITable predictNewValues(string[] paramArr)
 {
     string tblStr = paramArr[0];
     ITable tbl = getTable(tblStr);
     string mPath = getModelPath(paramArr[1]);
     IQueryFilter qf = new QueryFilterClass();
     if (paramArr.Length > 2)
     {
         qf.WhereClause = paramArr[2];
     }
     Statistics.ModelHelper mH = new Statistics.ModelHelper(mPath);
     mH.predictNewData(tbl,qf);
     return tbl;
 }