private void btnExecute_Click(object sender, EventArgs e) { string smpFtrNm = cmbSampleFeatureClass.Text; string strataField = cmbStrataField.Text; string outP = txtOutputPath.Text; if (smpFtrNm == null || smpFtrNm == "") { MessageBox.Show("You must select a feature Class","Error",MessageBoxButtons.OK,MessageBoxIcon.Error); return; } if (strataField == null || strataField == "") { MessageBox.Show("You must select a strata field or raster", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (outP == null || outP == "") { MessageBox.Show("You must select an output model path", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { Statistics.ModelHelper.runProgressBar("Running Stratified VarCov"); List<string> lstInd = new List<string>(); for (int i = 0; i < lstIndependent.Items.Count; i++) { string s = lstIndependent.Items[i].ToString(); lstInd.Add(s); } Statistics.dataPrepStrata strata = null; if (ftrDic.ContainsKey(smpFtrNm)) { if (lstInd.Count < 1) { MessageBox.Show("You must select at least one variable field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Visible = false; ITable ftrCls = ftrDic[smpFtrNm]; strata = new Statistics.dataPrepStrata(ftrCls, lstInd.ToArray(), strataField); } else { IRaster rs = rstDic[smpFtrNm]; IRaster rs2 = rstDic[strataField]; this.Visible = false; strata = new Statistics.dataPrepStrata(rs, rs2); } strata.writeModel(outP); Statistics.ModelHelper mH = new Statistics.ModelHelper(outP); mH.openModelReport(outP, 0.05); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Statistics.ModelHelper.closeProgressBar(); this.Close(); } }
private void btnExecute_Click(object sender, EventArgs e) { string smpFtrNm = cmbSampleFeatureClass.Text; string strataField = cmbStrataField.Text; string outP = txtOutputPath.Text; if (smpFtrNm == null || smpFtrNm == "") { MessageBox.Show("You must select a feature Class", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (strataField == null || strataField == "") { MessageBox.Show("You must select a strata field or raster", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (outP == null || outP == "") { MessageBox.Show("You must select an output model path", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { Statistics.ModelHelper.runProgressBar("Running Stratified VarCov"); List <string> lstInd = new List <string>(); for (int i = 0; i < lstIndependent.Items.Count; i++) { string s = lstIndependent.Items[i].ToString(); lstInd.Add(s); } Statistics.dataPrepStrata strata = null; if (ftrDic.ContainsKey(smpFtrNm)) { if (lstInd.Count < 1) { MessageBox.Show("You must select at least one variable field", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.Visible = false; ITable ftrCls = ftrDic[smpFtrNm]; strata = new Statistics.dataPrepStrata(ftrCls, lstInd.ToArray(), strataField); } else { IRaster rs = rstDic[smpFtrNm]; IRaster rs2 = rstDic[strataField]; this.Visible = false; strata = new Statistics.dataPrepStrata(rs, rs2); } strata.writeModel(outP); Statistics.ModelHelper mH = new Statistics.ModelHelper(outP); mH.openModelReport(outP, 0.05); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { Statistics.ModelHelper.closeProgressBar(); this.Close(); } }