private void GenerateIdlPath(string idlsavpath, string idlsavinputpath, string functionname, string inputname) { string strPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; strPath = Directory.GetParent(strPath).FullName; idlsavpath = strPath + @"\" + functionname + @".sav"; idlsavinputpath = strPath + @"\" + inputname + @".txt"; string progresspath = strPath + @"\" + functionname + @"_progress.txt"; IDLProgress = progresspath; DeleteFile(IDLProgress); FileStream fs = new FileStream(idlsavinputpath, FileMode.Create); byte[] data = System.Text.Encoding.Default.GetBytes(textBoxPending.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxRefer.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBox2.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBox1.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(progresspath + "\r\n"); fs.Write(data, 0, data.Length); fs.Flush(); fs.Close(); if (RUtimer != null) { RUtimer.Stop(); } RUtimer = new System.Timers.Timer(1000); // 参数单位为ms RUtimer.Elapsed += OnTimedUEvent; RUtimer.AutoReset = true; RUtimer.Enabled = true; RUtimer.Start(); }
void OnTimedUEvent(object sender, ElapsedEventArgs e) { if (File.Exists(IDLProgress)) { RUtimer.Stop(); UpdateTextDelegate updateProcess = delegate() { try { this.textBoxResult.Clear(); StreamReader sr = new StreamReader(textBox1.Text, Encoding.Default); String line; textBoxResult.AppendText(" 核驱动模型校正系数\r\n"); textBoxResult.AppendText(" 系数fiso 系数fgeo 系数fvol\r\n"); if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("波段1 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("波段2 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("波段3 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("波段4 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } //textBoxResult.AppendText(File.ReadAllText(textBoxCorrectParams.Text)); textBoxResult.Select(0, 1); textBoxResult.ScrollToCaret(); privilegeManager.AppendLog(this.Text, textBox1.Text); //显示散点图,需要调用IDL的显示程序 } catch (System.IO.FileNotFoundException) { } }; textBoxResult.Invoke(updateProcess); } }
void OnTimedUEvent(object sender, ElapsedEventArgs e) { if (File.Exists(IDLProgress)) { RUtimer.Stop(); UpdateTextDelegate updateProcess = delegate() { try { this.textBoxResult.Clear(); StreamReader sr = new StreamReader(textBoxTotalUncertainty.Text, Encoding.Default); String line; textBoxResult.AppendText(" 波段1 波段2 波段3 波段4\r\n"); if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("图像噪声不确定度% "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("观测几何不确定度% "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("光谱匹配不确定度% "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("交叉定标总的不确定度% "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } //textBoxResult.AppendText(File.ReadAllText(textBoxCorrectParams.Text)); textBoxResult.Select(0, 1); textBoxResult.ScrollToCaret(); privilegeManager.AppendLog(this.Text, textBoxTotalUncertainty.Text); } catch (System.IO.FileNotFoundException) { } }; textBoxResult.Invoke(updateProcess); } }
private void GenerateIdlPath(string idlsavpath, string idlsavinputpath, string functionname, string inputname) { string strPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; strPath = Directory.GetParent(strPath).FullName; idlsavpath = strPath + @"\" + functionname + @".sav"; idlsavinputpath = strPath + @"\" + inputname + @".txt"; string progresspath = strPath + @"\" + @"progress.txt"; IDLProgress = progresspath; DeleteFile(progresspath); FileStream fs = new FileStream(idlsavinputpath, FileMode.Create); byte[] data = System.Text.Encoding.Default.GetBytes(textBoxPending.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxRefer.Text + "\r\n"); fs.Write(data, 0, data.Length); int index = comboBoxPosition.SelectedIndex + 1; data = System.Text.Encoding.Default.GetBytes(index.ToString() + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxSavePending.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxSaveRefer.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxSavePendingForAngle.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxSaveReferForAngle.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(progresspath + "\r\n"); fs.Write(data, 0, data.Length); fs.Flush(); fs.Close(); if (RUtimer != null) { RUtimer.Stop(); } // 创建一个1000ms定时的定时器 RUtimer = new System.Timers.Timer(1000); // 参数单位为ms // 定时时间到,处理函数为OnTimedUEvent(...) RUtimer.Elapsed += OnTimedUEvent; // 为true时,定时时间到会重新计时;为false则只定时一次 RUtimer.AutoReset = true; // 使能定时器 RUtimer.Enabled = true; // 开始计时 RUtimer.Start(); }
void OnTimedUEvent(object sender, ElapsedEventArgs e) { if (File.Exists(IDLProgress)) { RUtimer.Stop(); UpdateTextDelegate updateProcess = delegate() { try { this.textBoxResult.Clear(); //textBoxResult.AppendText(" 观测天顶角 / 观测方位角 / 太阳天顶角 / 太阳方位角"); StreamReader sr = new StreamReader(textBoxOutput.Text, Encoding.Default); String line; while ((line = sr.ReadLine()) != null) { //textBoxResult.AppendText("\r\n参考传感器 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } /* * if ((line = sr.ReadLine()) != null) * { * //textBoxResult.AppendText("\r\n待定标传感器 "); * textBoxResult.AppendText(line.ToString()); * textBoxResult.AppendText("\r\n"); * } * if ((line = sr.ReadLine()) != null) * { * //textBoxResult.AppendText("\r\n四波段BRDF校正系数 "); * textBoxResult.AppendText(line.ToString()); * textBoxResult.AppendText("\r\n"); * }*/ //textBoxResult.AppendText(File.ReadAllText(textBoxCorrectParams.Text)); textBoxResult.Select(0, 1); textBoxResult.ScrollToCaret(); privilegeManager.AppendLog(this.Text, textBoxOutput.Text); } catch (System.IO.FileNotFoundException) { } }; textBoxResult.Invoke(updateProcess); } }
void OnTimedUEvent(object sender, ElapsedEventArgs e) { if (File.Exists(IDLProgress)) { RUtimer.Stop(); UpdateTextDelegate updateProcess = delegate() { try { this.textBoxResult.Clear(); StreamReader sr = new StreamReader(textBoxOutput.Text, Encoding.Default); String line; textBoxResult.AppendText(" 波段1 波段2 波段3 波段4\r\n"); if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("待定标卫星图像灰度值 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("待定标卫星表观辐亮度 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText("待定标卫星定标系数 "); textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } textBoxResult.Select(0, 1); textBoxResult.ScrollToCaret(); privilegeManager.AppendLog(this.Text, textBoxOutput.Text); } catch (System.IO.FileNotFoundException) { } }; textBoxResult.Invoke(updateProcess); } }
void OnTimedUEvent(object sender, ElapsedEventArgs e) { if (File.Exists(IDLProgress)) { RUtimer.Stop(); UpdateTextDelegate updateProcess = delegate() { try { //具体的显示结果 this.textBoxResult.Clear(); StreamReader sr = new StreamReader(textBoxsave.Text, Encoding.Default); String line; textBoxResult.AppendText("场地光学厚度(单位:1):"); if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } textBoxResult.AppendText("场地水汽含量(单位:g/cm2):"); if ((line = sr.ReadLine()) != null) { textBoxResult.AppendText(line.ToString()); textBoxResult.AppendText("\r\n"); } textBoxResult.Select(0, 1); textBoxResult.ScrollToCaret(); privilegeManager.AppendLog(this.Text, textBoxsave.Text); } catch (System.IO.FileNotFoundException) { } }; textBoxResult.Invoke(updateProcess); } }
void OnTimedUEvent(object sender, ElapsedEventArgs e) { if (File.Exists(IDLProgress)) { RUtimer.Stop(); UpdateTextDelegate updateProcess = delegate() { privilegeManager.AppendLog(this.Text, textBox2.Text); /* * try * { * //显示计算出来的结果,通过调用IDL的画图来显示 * * * * this.textBoxResult.Clear(); * StreamReader sr = new StreamReader(textBox2.Text, Encoding.Default); * String line; * while ((line = sr.ReadLine()) != null) * { * //textBoxResult.AppendText("\r\n参考传感器 "); * textBoxResult.AppendText(line.ToString()); * textBoxResult.AppendText("\r\n"); * } * textBoxResult.Select(0, 1); * textBoxResult.ScrollToCaret(); * } * catch (System.IO.FileNotFoundException) * { * }*/ }; //textBoxResult.Invoke(updateProcess); } }
void OnTimedUEvent(object sender, ElapsedEventArgs e) { if (File.Exists(IDLProgress)) { RUtimer.Stop(); //触发界面做出响应 //btnPlaceImage.Enabled = true; //读取角度txt在角度信息进行显示 在此调用显示角度信息 UpdateTextDelegate updateProcess = delegate() { try { this.textBoxAngle.Clear(); textBoxAngle.AppendText("待定标卫星-待定标传感器\r\n"); StreamReader sr = new StreamReader(textBoxSavePendingForAngle.Text, Encoding.Default); String line; if ((line = sr.ReadLine()) != null) { textBoxAngle.AppendText(line.ToString()); textBoxAngle.AppendText("\r\n"); } textBoxAngle.AppendText("成像日期:年 月 日 时 分 秒\r\n"); if ((line = sr.ReadLine()) != null) { textBoxAngle.AppendText(" "); textBoxAngle.AppendText(line.ToString()); textBoxAngle.AppendText("\r\n"); } textBoxAngle.AppendText(" 观测天顶角 观测方位角 太阳天顶角 太阳方位角\r\n"); if ((line = sr.ReadLine()) != null) { textBoxAngle.AppendText(line.ToString()); textBoxAngle.AppendText("\r\n"); } textBoxAngle.AppendText("灰度值:波段1 波段2 波段3 波段4\r\n"); if ((line = sr.ReadLine()) != null) { textBoxAngle.AppendText(line.ToString()); textBoxAngle.AppendText("\r\n"); } textBoxAngle.AppendText("参考卫星-参考传感器\r\n"); StreamReader sr1 = new StreamReader(textBoxSaveReferForAngle.Text, Encoding.Default); String line1; if ((line1 = sr1.ReadLine()) != null) { textBoxAngle.AppendText(line1.ToString()); textBoxAngle.AppendText("\r\n"); } textBoxAngle.AppendText("成像日期:年 月 日 时 分 秒\r\n\r\n"); if ((line1 = sr1.ReadLine()) != null) { textBoxAngle.AppendText(" "); textBoxAngle.AppendText(line1.ToString()); textBoxAngle.AppendText("\r\n"); } textBoxAngle.AppendText(" 观测天顶角 观测方位角 太阳天顶角 太阳方位角\r\n"); if ((line1 = sr1.ReadLine()) != null) { textBoxAngle.AppendText(line1.ToString()); textBoxAngle.AppendText("\r\n"); } textBoxAngle.AppendText("表观反射率:波段1 波段2 波段3 波段4\r\n"); if ((line1 = sr1.ReadLine()) != null) { textBoxAngle.AppendText(line1.ToString()); textBoxAngle.AppendText("\r\n"); } //textBoxAngle.AppendText(File.ReadAllText(textBoxSavePendingForAngle.Text)); //textBoxAngle.AppendText(Environment.NewLine); //textBoxAngle.AppendText(File.ReadAllText(textBoxSaveReferForAngle.Text)); textBoxAngle.Select(0, 1); textBoxAngle.ScrollToCaret(); privilegeManager.AppendLog(this.Text, textBoxSavePendingForAngle.Text); } catch (System.IO.FileNotFoundException) { } }; textBoxAngle.Invoke(updateProcess); } }
private void GenerateIdlPath(string idlsavpath, string idlsavinputpath, string functionname, string inputname) { string strPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; strPath = Directory.GetParent(strPath).FullName; idlsavpath = strPath + @"\" + functionname + @".sav"; idlsavinputpath = strPath + @"\" + inputname + @".txt"; string progresspath = strPath + @"\" + functionname + @"_progress.txt"; IDLProgress = progresspath; DeleteFile(IDLProgress); FileStream fs = new FileStream(idlsavinputpath, FileMode.Create); int index = comboBoxSiteName.SelectedIndex + 1; byte[] data = System.Text.Encoding.Default.GetBytes(index.ToString() + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxThickness.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxVapor.Text + "\r\n"); fs.Write(data, 0, data.Length); index = comboBoxAtmModel.SelectedIndex + 1; data = System.Text.Encoding.Default.GetBytes(index.ToString() + "\r\n"); fs.Write(data, 0, data.Length); index = comboBoxAeroModel.SelectedIndex + 1; data = System.Text.Encoding.Default.GetBytes(index.ToString() + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxSpectra.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxNewThickness.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxNewVapor.Text + "\r\n"); fs.Write(data, 0, data.Length); index = comboBoxNewAtmModel.SelectedIndex + 1; data = System.Text.Encoding.Default.GetBytes(index.ToString() + "\r\n"); fs.Write(data, 0, data.Length); index = comboBoxNewAeroModel.SelectedIndex + 1; data = System.Text.Encoding.Default.GetBytes(index.ToString() + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxNewSpectra.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxTargetImage.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxReferImage.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(textBoxOutput.Text + "\r\n"); fs.Write(data, 0, data.Length); data = System.Text.Encoding.Default.GetBytes(progresspath + "\r\n"); fs.Write(data, 0, data.Length); fs.Flush(); fs.Close(); if (RUtimer != null) { RUtimer.Stop(); } RUtimer = new System.Timers.Timer(1000); // 参数单位为ms RUtimer.Elapsed += OnTimedUEvent; RUtimer.AutoReset = true; RUtimer.Enabled = true; RUtimer.Start(); }