1、添加2个自定义控件:chartTC、TreeViewTc; 2、修复了一些bug,完善了功能;3、更新了gitignore,将bin等目录忽略;

This commit is contained in:
tangchao0503
2022-06-16 13:26:55 +08:00
parent b43227dc58
commit f36c5eaa39
50 changed files with 13043 additions and 3770 deletions

147
mainProgram/AboutWindows.Designer.cs generated Normal file
View File

@ -0,0 +1,147 @@
namespace mainProgram
{
partial class AboutWindows
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AboutWindows));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("宋体", 20F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label1.Location = new System.Drawing.Point(150, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(117, 27);
this.label1.TabIndex = 2;
this.label1.Text = "EasySif";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label2.Location = new System.Drawing.Point(152, 69);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(77, 14);
this.label2.TabIndex = 3;
this.label2.Text = "版本1.13";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label4.Location = new System.Drawing.Point(41, 155);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(336, 14);
this.label4.TabIndex = 5;
this.label4.Text = "地址北京市海淀区安宁庄东路18号光华创业园5号楼";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label5.Location = new System.Drawing.Point(41, 186);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(133, 14);
this.label5.TabIndex = 6;
this.label5.Text = "电话010-51292601";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.label6.Location = new System.Drawing.Point(41, 214);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(203, 14);
this.label6.TabIndex = 7;
this.label6.Text = "邮箱hanshanlong@iris-rs.cn";
//
// pictureBox2
//
this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
this.pictureBox2.Location = new System.Drawing.Point(44, 22);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(66, 75);
this.pictureBox2.TabIndex = 9;
this.pictureBox2.TabStop = false;
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.linkLabel1.Location = new System.Drawing.Point(41, 124);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(231, 14);
this.linkLabel1.TabIndex = 10;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "公司:北京依锐思遥感技术有限公司";
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
//
// AboutWindows
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(448, 260);
this.Controls.Add(this.linkLabel1);
this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "AboutWindows";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "关于EasySif";
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.LinkLabel linkLabel1;
}
}

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace mainProgram
{
public partial class AboutWindows : Form
{
public AboutWindows()
{
InitializeComponent();
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("http://www.iris-rs.cn/");
linkLabel1.LinkVisited = true;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -26,9 +26,14 @@
private System.Windows.Forms.TextBox PointInfoTextBox;
private TreeViewTc.TreeViewTc2 treeViewTc21;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton toolStripButton1;
private System.Windows.Forms.ToolStripMenuItem CloseToolStripMenuItem;
private chartTC.chartTC chartTC1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ToolStripStatusLabel projectPath_toolStripStatusLabel;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem AboutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem sifAlgorithmAbstractToolStripMenuItem;
}
}

View File

@ -32,6 +32,8 @@ namespace mainProgram
mProjectManager = value;
Console.WriteLine("工程文件目录为:" + mProjectManager.ProjectPath + "---------------------");
}
private void newToolStripMenuItem_Click(object sender, EventArgs e)
@ -42,8 +44,11 @@ namespace mainProgram
//w.Show();//不阻塞
DialogResult tmp = w.ShowDialog();//阻塞
if(tmp == DialogResult.OK)
if (tmp == DialogResult.OK)
{
treeViewTc21.Initialize(mProjectManager.ProjectPath);
SetProjectNameAndProjectPath();
}
}
private void OpenProjectToolStripMenuItem_Click(object sender, EventArgs e)
@ -62,7 +67,7 @@ namespace mainProgram
if (dialogResult == DialogResult.OK)
{
this.Text = this.Text + "-" + getProjectName();
SetProjectNameAndProjectPath();
treeViewTc21.Initialize(mProjectManager.ProjectPath);
}
@ -77,9 +82,22 @@ namespace mainProgram
}
private void ss()
private void SetProjectNameAndProjectPath()
{
//PrejectTreeView
this.Text = this.Text + "-" + getProjectName();
this.projectPath_toolStripStatusLabel.Text = this.projectPath_toolStripStatusLabel.Text + mProjectManager.ProjectPath;
}
private void ClearProjectNameAndProjectPath()
{
this.Text = this.Text + "-" + getProjectName();
this.projectPath_toolStripStatusLabel.Text = this.projectPath_toolStripStatusLabel.Text + mProjectManager.ProjectPath;
int index = this.Text.IndexOf(getProjectName());
this.Text = this.Text.Substring(0, index - 1);//index - 1还要加上一个字符“-”
int index2 = this.projectPath_toolStripStatusLabel.Text.IndexOf(mProjectManager.ProjectPath);
this.projectPath_toolStripStatusLabel.Text = this.projectPath_toolStripStatusLabel.Text.Substring(0, index2);
}
@ -118,7 +136,7 @@ namespace mainProgram
private void main_FormClosing(object sender, FormClosingEventArgs e)
{
if (MessageBox.Show("确退出", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
if (MessageBox.Show("确退出", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
{
e.Cancel = false;
}
@ -136,6 +154,12 @@ namespace mainProgram
return;
}
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时2rad文件夹为空就不能打开算法窗口
{
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
return;
}
SVDWindows w = new SVDWindows(mProjectManager, "svd");
//w.TransferEvent += RecieveProjectManager;
@ -154,6 +178,12 @@ namespace mainProgram
return;
}
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时2rad文件夹为空就不能打开算法窗口
{
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
return;
}
SVDWindows w = new SVDWindows(mProjectManager, "doas");
//w.TransferEvent += RecieveProjectManager;
@ -172,6 +202,12 @@ namespace mainProgram
return;
}
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时2rad文件夹为空就不能打开算法窗口
{
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
return;
}
SVDWindows w = new SVDWindows(mProjectManager, "sfm");
//w.TransferEvent += RecieveProjectManager;
@ -190,6 +226,12 @@ namespace mainProgram
return;
}
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时2rad文件夹为空就不能打开算法窗口
{
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
return;
}
SVDWindows w = new SVDWindows(mProjectManager, "sfm_gaussian");
//w.TransferEvent += RecieveProjectManager;
@ -208,6 +250,12 @@ namespace mainProgram
return;
}
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时2rad文件夹为空就不能打开算法窗口
{
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
return;
}
SVDWindows w = new SVDWindows(mProjectManager, "sfld");
//w.TransferEvent += RecieveProjectManager;
@ -226,6 +274,12 @@ namespace mainProgram
return;
}
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时2rad文件夹为空就不能打开算法窗口
{
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
return;
}
SVDWindows w = new SVDWindows(mProjectManager, "3fld");
//w.TransferEvent += RecieveProjectManager;
@ -391,6 +445,7 @@ namespace mainProgram
private void main_Load(object sender, EventArgs e)
{
treeViewTc21.DeleteEvent += DeleteFiles;
treeViewTc21.PlotSifEvent += PlotSif;
treeViewTc21.SaveAsEvent += SaveAs;
@ -398,6 +453,12 @@ namespace mainProgram
chartTC1.clickPointEvent += ShowPointInfo;
}
//protected override void OnPaint(PaintEventArgs e)
//{
// //System.Drawing.Color.FromArgb(0, 106, 181)
// ControlPaint.DrawBorder(e.Graphics, ClientRectangle, System.Drawing.Color.FromArgb(0, 106, 181), ButtonBorderStyle.Solid);
//}
public void PlotSifSpectral(string path)
{
//SpectralDataReaderWriter spectralDataReaderWriter = new SpectralDataReaderWriter(@"D:\Desktop\0sifRawData\rawdata\2021_12_21\beijing_10_53_45.csv");
@ -469,33 +530,40 @@ namespace mainProgram
this.SfmGaussinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SfldToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.Fld3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sifAlgorithmAbstractToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.AboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.projectPath_toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.panel1 = new System.Windows.Forms.Panel();
this.treeViewTc21 = new TreeViewTc.TreeViewTc2();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.PointInfoTextBox = new System.Windows.Forms.TextBox();
this.chartTC1 = new chartTC.chartTC();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panel1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// menuStrip1
//
this.menuStrip1.BackColor = System.Drawing.Color.White;
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.preprocessToolStripMenuItem,
this.sifComputeToolStripMenuItem});
this.sifComputeToolStripMenuItem,
this.ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1420, 25);
this.menuStrip1.Size = new System.Drawing.Size(1176, 25);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@ -608,60 +676,127 @@ namespace mainProgram
this.Fld3ToolStripMenuItem.Text = "3Fld";
this.Fld3ToolStripMenuItem.Click += new System.EventHandler(this.Fld3ToolStripMenuItem_Click);
//
// 帮助ToolStripMenuItem
//
this.ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.sifAlgorithmAbstractToolStripMenuItem,
this.AboutToolStripMenuItem});
this.ToolStripMenuItem.Name = "帮助ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.ToolStripMenuItem.Text = "帮助";
//
// sifAlgorithmAbstractToolStripMenuItem
//
this.sifAlgorithmAbstractToolStripMenuItem.Name = "sifAlgorithmAbstractToolStripMenuItem";
this.sifAlgorithmAbstractToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.sifAlgorithmAbstractToolStripMenuItem.Text = "Sif算法简介";
this.sifAlgorithmAbstractToolStripMenuItem.Click += new System.EventHandler(this.sifAlgorithmAbstractToolStripMenuItem_Click);
//
// AboutToolStripMenuItem
//
this.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem";
this.AboutToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.AboutToolStripMenuItem.Text = "关于";
this.AboutToolStripMenuItem.Click += new System.EventHandler(this.AboutToolStripMenuItem_Click);
//
// statusStrip1
//
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip1.Location = new System.Drawing.Point(0, 1040);
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.projectPath_toolStripStatusLabel});
this.statusStrip1.Location = new System.Drawing.Point(0, 778);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1420, 22);
this.statusStrip1.Size = new System.Drawing.Size(1176, 22);
this.statusStrip1.TabIndex = 1;
this.statusStrip1.Text = "statusStrip1";
//
// projectPath_toolStripStatusLabel
//
this.projectPath_toolStripStatusLabel.Name = "projectPath_toolStripStatusLabel";
this.projectPath_toolStripStatusLabel.Size = new System.Drawing.Size(68, 17);
this.projectPath_toolStripStatusLabel.Text = "工程路径:";
//
// splitContainer1
//
this.splitContainer1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 52);
this.splitContainer1.Location = new System.Drawing.Point(0, 50);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.panel1);
this.splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.No;
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.chartTC1);
this.splitContainer1.Size = new System.Drawing.Size(1420, 988);
this.splitContainer1.SplitterDistance = 269;
this.splitContainer1.Panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.splitContainer1.Size = new System.Drawing.Size(1176, 728);
this.splitContainer1.SplitterDistance = 231;
this.splitContainer1.TabIndex = 6;
//
// panel1
//
this.panel1.Controls.Add(this.treeViewTc21);
this.panel1.Controls.Add(this.button1);
this.panel1.Controls.Add(this.button2);
this.panel1.Controls.Add(this.PointInfoTextBox);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(269, 988);
this.panel1.Size = new System.Drawing.Size(227, 724);
this.panel1.TabIndex = 6;
//
// treeViewTc21
//
this.treeViewTc21.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeViewTc21.Location = new System.Drawing.Point(0, 0);
this.treeViewTc21.Location = new System.Drawing.Point(0, 23);
this.treeViewTc21.Margin = new System.Windows.Forms.Padding(4);
this.treeViewTc21.Name = "treeViewTc21";
this.treeViewTc21.Size = new System.Drawing.Size(269, 731);
this.treeViewTc21.Size = new System.Drawing.Size(227, 421);
this.treeViewTc21.TabIndex = 6;
this.treeViewTc21.Load += new System.EventHandler(this.treeViewTc21_Load);
//
// button1
//
this.button1.BackColor = System.Drawing.Color.WhiteSmoke;
this.button1.Cursor = System.Windows.Forms.Cursors.Default;
this.button1.Dock = System.Windows.Forms.DockStyle.Top;
this.button1.Enabled = false;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button1.Location = new System.Drawing.Point(0, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(227, 23);
this.button1.TabIndex = 7;
this.button1.Text = "工程";
this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.UseVisualStyleBackColor = false;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.WhiteSmoke;
this.button2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.button2.Enabled = false;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.button2.Location = new System.Drawing.Point(0, 444);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(227, 23);
this.button2.TabIndex = 8;
this.button2.Text = "信息";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.UseVisualStyleBackColor = false;
//
// PointInfoTextBox
//
this.PointInfoTextBox.BackColor = System.Drawing.Color.White;
this.PointInfoTextBox.Dock = System.Windows.Forms.DockStyle.Bottom;
this.PointInfoTextBox.Location = new System.Drawing.Point(0, 731);
this.PointInfoTextBox.Location = new System.Drawing.Point(0, 467);
this.PointInfoTextBox.Multiline = true;
this.PointInfoTextBox.Name = "PointInfoTextBox";
this.PointInfoTextBox.ReadOnly = true;
this.PointInfoTextBox.Size = new System.Drawing.Size(269, 257);
this.PointInfoTextBox.Size = new System.Drawing.Size(227, 257);
this.PointInfoTextBox.TabIndex = 5;
//
// chartTC1
@ -669,56 +804,50 @@ namespace mainProgram
this.chartTC1.Dock = System.Windows.Forms.DockStyle.Fill;
this.chartTC1.Location = new System.Drawing.Point(0, 0);
this.chartTC1.Name = "chartTC1";
this.chartTC1.Size = new System.Drawing.Size(1147, 988);
this.chartTC1.Size = new System.Drawing.Size(937, 724);
this.chartTC1.TabIndex = 3;
this.chartTC1.Load += new System.EventHandler(this.chartTC1_Load);
//
// toolStrip1
//
this.toolStrip1.BackColor = System.Drawing.Color.WhiteSmoke;
this.toolStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1});
this.toolStrip1.Location = new System.Drawing.Point(0, 25);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(1420, 27);
this.toolStrip1.Size = new System.Drawing.Size(1176, 25);
this.toolStrip1.TabIndex = 7;
this.toolStrip1.Text = "toolStrip1";
//
// toolStripButton1
//
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Size = new System.Drawing.Size(24, 24);
this.toolStripButton1.Text = "toolStripButton1";
//
// main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1420, 1062);
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(1176, 800);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.toolStrip1);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.ForeColor = System.Drawing.SystemColors.ControlText;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "main";
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "easySif";
this.Text = "EasySif";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.main_FormClosing);
this.Load += new System.EventHandler(this.main_Load);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -744,11 +873,11 @@ namespace mainProgram
if (mProjectManager == null)
return;
int index = this.Text.IndexOf(getProjectName());
this.Text = this.Text.Substring(0, index - 1);//index - 1还要加上一个字符“-”
ClearProjectNameAndProjectPath();
mProjectManager = null;
GC.Collect();
treeViewTc21.clearAll();
chartTC1.chart1.Series.Clear();
PointInfoTextBox.Clear();
@ -758,6 +887,26 @@ namespace mainProgram
{
}
private void button1_Click(object sender, EventArgs e)
{
}
//C#调用默认浏览器打开网页的几种方法https://blog.csdn.net/testcs_dn/article/details/42246969
private void sifAlgorithmAbstractToolStripMenuItem_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://mp.weixin.qq.com/s/L89CdJcSs2dADxQMztv2nw");
}
private void AboutToolStripMenuItem_Click(object sender, EventArgs e)
{
AboutWindows w = new AboutWindows();
//Form2 w = new Form2();
//w.Show();//不阻塞
DialogResult tmp = w.ShowDialog();//阻塞
}
}
}

File diff suppressed because it is too large Load Diff

46
mainProgram/Form2.Designer.cs generated Normal file
View File

@ -0,0 +1,46 @@
namespace mainProgram
{
partial class Form2
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form2
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Name = "Form2";
this.Text = "Form2";
this.ResumeLayout(false);
}
#endregion
}
}

20
mainProgram/Form2.cs Normal file
View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace mainProgram
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
}
}

120
mainProgram/Form2.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -45,7 +45,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(36, 41);
this.label1.Location = new System.Drawing.Point(25, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 0;
@ -53,7 +53,8 @@
//
// ProjectPathTextBox
//
this.ProjectPathTextBox.Location = new System.Drawing.Point(115, 37);
this.ProjectPathTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.ProjectPathTextBox.Location = new System.Drawing.Point(104, 26);
this.ProjectPathTextBox.Name = "ProjectPathTextBox";
this.ProjectPathTextBox.ReadOnly = true;
this.ProjectPathTextBox.Size = new System.Drawing.Size(205, 21);
@ -62,7 +63,7 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(36, 154);
this.label2.Location = new System.Drawing.Point(25, 143);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 2;
@ -70,27 +71,32 @@
//
// CreateProjectBtn
//
this.CreateProjectBtn.Location = new System.Drawing.Point(96, 217);
this.CreateProjectBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.CreateProjectBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.CreateProjectBtn.Location = new System.Drawing.Point(234, 206);
this.CreateProjectBtn.Name = "CreateProjectBtn";
this.CreateProjectBtn.Size = new System.Drawing.Size(75, 23);
this.CreateProjectBtn.TabIndex = 3;
this.CreateProjectBtn.Text = "创建工程";
this.CreateProjectBtn.UseVisualStyleBackColor = true;
this.CreateProjectBtn.Text = "创建";
this.CreateProjectBtn.UseVisualStyleBackColor = false;
this.CreateProjectBtn.Click += new System.EventHandler(this.CreateProjectBtn_Click);
//
// Cancel
//
this.Cancel.Location = new System.Drawing.Point(314, 217);
this.Cancel.BackColor = System.Drawing.Color.WhiteSmoke;
this.Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.Cancel.Location = new System.Drawing.Point(324, 206);
this.Cancel.Name = "Cancel";
this.Cancel.Size = new System.Drawing.Size(75, 23);
this.Cancel.TabIndex = 4;
this.Cancel.Text = "取消";
this.Cancel.UseVisualStyleBackColor = true;
this.Cancel.UseVisualStyleBackColor = false;
this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
//
// DataPathTextBox
//
this.DataPathTextBox.Location = new System.Drawing.Point(115, 150);
this.DataPathTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.DataPathTextBox.Location = new System.Drawing.Point(104, 139);
this.DataPathTextBox.Name = "DataPathTextBox";
this.DataPathTextBox.ReadOnly = true;
this.DataPathTextBox.Size = new System.Drawing.Size(205, 21);
@ -98,27 +104,32 @@
//
// SelectDataPathBtn
//
this.SelectDataPathBtn.Location = new System.Drawing.Point(374, 149);
this.SelectDataPathBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.SelectDataPathBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SelectDataPathBtn.Location = new System.Drawing.Point(324, 137);
this.SelectDataPathBtn.Name = "SelectDataPathBtn";
this.SelectDataPathBtn.Size = new System.Drawing.Size(75, 23);
this.SelectDataPathBtn.TabIndex = 4;
this.SelectDataPathBtn.Text = "选择";
this.SelectDataPathBtn.UseVisualStyleBackColor = true;
this.SelectDataPathBtn.Text = "浏览...";
this.SelectDataPathBtn.UseVisualStyleBackColor = false;
this.SelectDataPathBtn.Click += new System.EventHandler(this.SelectDataPathBtn_Click);
//
// SelectProjectPathBtn
//
this.SelectProjectPathBtn.Location = new System.Drawing.Point(374, 36);
this.SelectProjectPathBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.SelectProjectPathBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SelectProjectPathBtn.Location = new System.Drawing.Point(324, 24);
this.SelectProjectPathBtn.Name = "SelectProjectPathBtn";
this.SelectProjectPathBtn.Size = new System.Drawing.Size(75, 23);
this.SelectProjectPathBtn.TabIndex = 5;
this.SelectProjectPathBtn.Text = "选择";
this.SelectProjectPathBtn.UseVisualStyleBackColor = true;
this.SelectProjectPathBtn.Text = "浏览...";
this.SelectProjectPathBtn.UseVisualStyleBackColor = false;
this.SelectProjectPathBtn.Click += new System.EventHandler(this.SelectProjectPathBtn_Click);
//
// CalFilePathTextBox
//
this.CalFilePathTextBox.Location = new System.Drawing.Point(115, 91);
this.CalFilePathTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.CalFilePathTextBox.Location = new System.Drawing.Point(104, 80);
this.CalFilePathTextBox.Name = "CalFilePathTextBox";
this.CalFilePathTextBox.ReadOnly = true;
this.CalFilePathTextBox.Size = new System.Drawing.Size(205, 21);
@ -126,18 +137,20 @@
//
// SelectCalFilePathBtn
//
this.SelectCalFilePathBtn.Location = new System.Drawing.Point(374, 90);
this.SelectCalFilePathBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.SelectCalFilePathBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SelectCalFilePathBtn.Location = new System.Drawing.Point(324, 78);
this.SelectCalFilePathBtn.Name = "SelectCalFilePathBtn";
this.SelectCalFilePathBtn.Size = new System.Drawing.Size(75, 23);
this.SelectCalFilePathBtn.TabIndex = 8;
this.SelectCalFilePathBtn.Text = "选择";
this.SelectCalFilePathBtn.UseVisualStyleBackColor = true;
this.SelectCalFilePathBtn.Text = "浏览...";
this.SelectCalFilePathBtn.UseVisualStyleBackColor = false;
this.SelectCalFilePathBtn.Click += new System.EventHandler(this.SelectCalFilePathBtn_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(36, 95);
this.label3.Location = new System.Drawing.Point(25, 84);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(53, 12);
this.label3.TabIndex = 9;
@ -147,7 +160,8 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(490, 271);
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(429, 249);
this.Controls.Add(this.label3);
this.Controls.Add(this.SelectCalFilePathBtn);
this.Controls.Add(this.CalFilePathTextBox);
@ -163,7 +177,7 @@
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "NewProjectWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "创建工程";
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -50,15 +50,42 @@ namespace mainProgram
return;
}
//做判断:
DialogResult re = MessageBox.Show("删除工程路径下所有内容?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
if (re == DialogResult.Cancel)
{
return;
}
//创建工程
ProjectManager projectManager = new ProjectManager(projectPath);
projectManager.CreateProject(calFilePath, dataPath);
int value = projectManager.CreateProject(calFilePath, dataPath);
TransferEvent(projectManager);//触发事件
switch (value)
{
case 0:
TransferEvent(projectManager);//触发事件
MessageBox.Show(this, "工程创建成功!", "提示");
MessageBox.Show(this, "工程创建成功!", "提示");
this.DialogResult = DialogResult.OK;
Close();//创建工程完成后,关闭窗口
this.DialogResult = DialogResult.OK;
Close();//创建工程完成后,关闭窗口
break;
case 1:
MessageBox.Show(this, "定标文件夹有错!", "提示");
break;
case 2:
MessageBox.Show(this, "数据文件夹有错!", "提示");
break;
case 3:
MessageBox.Show(this, "工程路径有错!", "提示");
break;
default: /* 可选的 */
break;
}
}
private void SelectDataPathBtn_Click(object sender, EventArgs e)
@ -81,19 +108,32 @@ namespace mainProgram
private void SelectProjectPathBtn_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择工程文件夹";
if (dialog.ShowDialog() == DialogResult.OK)
{
if (string.IsNullOrEmpty(dialog.SelectedPath))
{
MessageBox.Show(this, "文件夹路径不能为空", "提示");
return;
}
string savePath = dialog.SelectedPath;
ProjectPathTextBox.Text = savePath;
//FolderBrowserDialog dialog = new FolderBrowserDialog();
//dialog.Description = "请选择工程文件夹";
//if (dialog.ShowDialog() == DialogResult.OK)
//{
// if (string.IsNullOrEmpty(dialog.SelectedPath))
// {
// MessageBox.Show(this, "文件夹路径不能为空", "提示");
// return;
// }
// string savePath = dialog.SelectedPath;
// ProjectPathTextBox.Text = savePath;
//}
OpenFileDialog dialog = new OpenFileDialog();
dialog.CheckFileExists = false; //设置不弹出警告
//dialog.Multiselect = true;//该值确定是否可以选择多个文件
dialog.Title = "请输入工程名";
dialog.Filter = "所有文件(*.*)|*.*";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string filePath = dialog.FileName;
filePath = filePath + ".EasySif";
ProjectPathTextBox.Text = filePath;
}
}
private void Cancel_Click(object sender, EventArgs e)

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,8 @@
//
// ProjectPathTextBox
//
this.ProjectPathTextBox.Location = new System.Drawing.Point(135, 38);
this.ProjectPathTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.ProjectPathTextBox.Location = new System.Drawing.Point(111, 28);
this.ProjectPathTextBox.Name = "ProjectPathTextBox";
this.ProjectPathTextBox.ReadOnly = true;
this.ProjectPathTextBox.Size = new System.Drawing.Size(162, 21);
@ -46,18 +47,20 @@
//
// OpenProjectPathBtn
//
this.OpenProjectPathBtn.Location = new System.Drawing.Point(49, 118);
this.OpenProjectPathBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.OpenProjectPathBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.OpenProjectPathBtn.Location = new System.Drawing.Point(190, 90);
this.OpenProjectPathBtn.Name = "OpenProjectPathBtn";
this.OpenProjectPathBtn.Size = new System.Drawing.Size(83, 23);
this.OpenProjectPathBtn.TabIndex = 2;
this.OpenProjectPathBtn.Text = "打开工程";
this.OpenProjectPathBtn.UseVisualStyleBackColor = true;
this.OpenProjectPathBtn.UseVisualStyleBackColor = false;
this.OpenProjectPathBtn.Click += new System.EventHandler(this.OpenProjectPathBtn_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(47, 38);
this.label1.Location = new System.Drawing.Point(32, 32);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 3;
@ -65,29 +68,34 @@
//
// SelectProjectPathBtn
//
this.SelectProjectPathBtn.Location = new System.Drawing.Point(351, 38);
this.SelectProjectPathBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.SelectProjectPathBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SelectProjectPathBtn.Location = new System.Drawing.Point(295, 27);
this.SelectProjectPathBtn.Name = "SelectProjectPathBtn";
this.SelectProjectPathBtn.Size = new System.Drawing.Size(83, 23);
this.SelectProjectPathBtn.TabIndex = 4;
this.SelectProjectPathBtn.Text = "选择";
this.SelectProjectPathBtn.UseVisualStyleBackColor = true;
this.SelectProjectPathBtn.Text = "浏览...";
this.SelectProjectPathBtn.UseVisualStyleBackColor = false;
this.SelectProjectPathBtn.Click += new System.EventHandler(this.SelectProjectPathBtn_Click);
//
// CancelBtn
//
this.CancelBtn.Location = new System.Drawing.Point(351, 118);
this.CancelBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.CancelBtn.Location = new System.Drawing.Point(295, 90);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(83, 23);
this.CancelBtn.TabIndex = 5;
this.CancelBtn.Text = "取消";
this.CancelBtn.UseVisualStyleBackColor = true;
this.CancelBtn.UseVisualStyleBackColor = false;
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
//
// OpenProjectWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(485, 191);
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(416, 141);
this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.SelectProjectPathBtn);
this.Controls.Add(this.label1);
@ -97,7 +105,7 @@
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "OpenProjectWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "打开工程";
this.ResumeLayout(false);
this.PerformLayout();

View File

@ -19,32 +19,44 @@ namespace mainProgram
private void SelectProjectPathBtn_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择工程文件夹";
//FolderBrowserDialog dialog = new FolderBrowserDialog();
//dialog.Description = "请选择工程文件";
//if (dialog.ShowDialog() == DialogResult.OK)
//{
// if (string.IsNullOrEmpty(dialog.SelectedPath))
// {
// MessageBox.Show(this, "文件夹路径不能为空", "提示");
// return;
// }
// string savePath = dialog.SelectedPath;
// ProjectPathTextBox.Text = savePath;
//}
OpenFileDialog dialog = new OpenFileDialog();
//dialog.CheckFileExists = false; //设置不弹出警告
//dialog.Multiselect = true;//该值确定是否可以选择多个文件
dialog.Title = "请选择工程文件";
dialog.Filter = "工程文件(*.EasySif)|*.EasySif";
if (dialog.ShowDialog() == DialogResult.OK)
{
if (string.IsNullOrEmpty(dialog.SelectedPath))
{
MessageBox.Show(this, "文件夹路径不能为空", "提示");
return;
}
string savePath = dialog.SelectedPath;
ProjectPathTextBox.Text = savePath;
string filePath = dialog.FileName;
ProjectPathTextBox.Text = filePath;
}
}
public event transferProjectManagerDelegate TransferEvent;//申明事件
private void OpenProjectPathBtn_Click(object sender, EventArgs e)
{
string projectPath = ProjectPathTextBox.Text;
if (projectPath != null && projectPath.Length == 0)
string projectFile = ProjectPathTextBox.Text;
if (projectFile != null && projectFile.Length == 0)
{
MessageBox.Show(this, "工程路径不能为空", "提示");
return;
}
ProjectManager projectManager = new ProjectManager(projectPath);
ProjectManager projectManager = new ProjectManager(projectFile);
if(projectManager.OpenProject())
{

File diff suppressed because it is too large Load Diff

View File

@ -172,9 +172,13 @@ namespace mainProgram
{
public ProjectManager(string xx)
{
mProjectPath = xx;
string sourceFileName = Path.GetFileName(xx);//获取文件名
mProjectFile = xx;
mProjectPath = Path.GetDirectoryName(xx);
}
private string mProjectFile;
private string mProjectPath;
private string mMetadataPath;
private string mRawPath;
@ -241,18 +245,37 @@ namespace mainProgram
}
}
public void CreateProject(string calFilePath, string dataPath)
//返回值0代表成功1代表定标文件夹有错误2代表数据文件夹有错误3代表工程路径有错误
public int CreateProject(string calFilePath, string dataPath)
{
if (mProjectPath.Length == 0)
{
return;
return 3;
}
DelectDir(mProjectPath);//删除工程路径下的所有内容
CreateProjectStructure();
CopyCalFiles2Project(calFilePath);//复制定标文件到工程结构对应文件夹
CopyFiles2Project(dataPath);//复制原始数据文件到工程结构对应文件夹
CreateProjectStructure();
bool re1 = CopyCalFiles2Project(calFilePath);//复制定标文件到工程结构对应文件夹
if (!re1)
{
DelectDir(mProjectPath);
return 1;
}
mCsvFileCount = 0;//类的变量
bool re2 = CopyFiles2Project(dataPath, ref mCsvFileCount);//复制原始数据文件到工程结构对应文件夹
if (!re2)
{
DelectDir(mProjectPath);
return 2;
}
//将文件个数写入到可执行文件所在目录 → 打开工程时需要读取
BinaryWriter bw = new BinaryWriter(new FileStream(mProjectFile, FileMode.Create));//Path.Combine(mMetadataPath, "CsvFileCount.dat")
bw.Write(mCsvFileCount);
bw.Close();
@ -269,7 +292,7 @@ namespace mainProgram
////删除指定节点信息
//DeleteXmlInformation(myXMLFilePath);
return 0;
}
public bool OpenProject()
@ -285,7 +308,7 @@ namespace mainProgram
if (Directory.Exists(mMetadataPath) & Directory.Exists(mRawPath) & Directory.Exists(mRadPath) & Directory.Exists(mSifPath))
{
BinaryReader br = new BinaryReader(new FileStream(Path.Combine(mMetadataPath, "CsvFileCount.dat"), FileMode.Open));
BinaryReader br = new BinaryReader(new FileStream(mProjectFile, FileMode.Open));
mCsvFileCount = br.ReadInt32();
br.Close();
@ -502,22 +525,23 @@ namespace mainProgram
}
//文件复制实现https://www.cnblogs.com/sun-shadow/p/7553556.html
public void CopyFiles2Project(string sourceFolderName)//
public bool CopyFiles2Project(string sourceFolderName, ref int fileCounter)//
{
if (Directory.Exists(mRawPath))
{
DelectDir(mRawPath);
}
mCsvFileCount = 0;
CopySubFun(sourceFolderName, mRawPath, true);//因为此函数会递归,所以把它摘出来
bool re = CopySubFun2(sourceFolderName, mRawPath, true, ref mCsvFileCount);//因为此函数会递归,所以把它摘出来
return re;
}
public void CopyCalFiles2Project(string sourceFolderName)
public bool CopyCalFiles2Project(string sourceFolderName)
{
if (!Directory.Exists(sourceFolderName))
{
return;
return false;
}
if (!Directory.Exists(mMetadataPath))
{
@ -526,6 +550,7 @@ namespace mainProgram
string[] sourceFilesPath = Directory.GetFileSystemEntries(sourceFolderName);
int fileCounterCopied = 0;
for (int i = 0; i < sourceFilesPath.Length; i++)
{
string sourceFilePath = sourceFilesPath[i];
@ -536,27 +561,36 @@ namespace mainProgram
string dest = mMetadataPath;
string sourceFileName = Path.GetFileName(sourceFilePath);//获取文件名
File.Copy(sourceFilePath, Path.Combine(dest, sourceFileName), true);
}
else if (Directory.Exists(sourceFilePath))//是文件夹,拷贝文件夹;并递归
{
string lastDirectory = forlders[forlders.Length - 1];
string dest = Path.Combine(mMetadataPath, lastDirectory);
if (!Directory.Exists(dest))
{
Directory.CreateDirectory(dest);
}
CopySubFun(sourceFilePath, dest, true);
fileCounterCopied++;
}
//因为定标文件不能够放在
//else if (Directory.Exists(sourceFilePath))//是文件夹,拷贝文件夹;并递归
//{
// string lastDirectory = forlders[forlders.Length - 1];
// string dest = Path.Combine(mMetadataPath, lastDirectory);
// if (!Directory.Exists(dest))
// {
// Directory.CreateDirectory(dest);
// }
// CopySubFun(sourceFilePath, dest, true);
//}
}
if (fileCounterCopied == 0)
{
return false;
}
return true;
}
private void CopySubFun(string sourceFolderName, string destFolderName, bool overwrite)//因为此函数会递归,所以把它摘出来
private bool CopySubFun(string sourceFolderName, string destFolderName, bool overwrite)//因为此函数会递归,所以把它摘出来
{
if (!Directory.Exists(sourceFolderName))
{
return;
return false;
}
if (!Directory.Exists(destFolderName))
{
@ -591,11 +625,67 @@ namespace mainProgram
CopySubFun(sourceFilePath, dest, overwrite);
}
}
return true;
}
//将文件个数写入到可执行文件所在目录 → 打开工程时需要读取
BinaryWriter bw = new BinaryWriter(new FileStream(Path.Combine(mMetadataPath, "CsvFileCount.dat"), FileMode.Create));
bw.Write(mCsvFileCount);
bw.Close();
private bool CopySubFun2(string sourceFolderName, string destFolderName, bool overwrite, ref int fileCounter)//不使用递归
{
if (!Directory.Exists(sourceFolderName))
{
return false;
}
if (!Directory.Exists(destFolderName))
{
Directory.CreateDirectory(destFolderName);
}
string[] files = Directory.GetFiles(sourceFolderName);
if (files.Length>0)
{
return false;
}
string[] sourceForldersPath = Directory.GetFileSystemEntries(sourceFolderName);
for (int i = 0; i < sourceForldersPath.Length; i++)
{
string sourceForlder = sourceForldersPath[i];
string[] forlders = sourceForlder.Split('\\');
string destFolderName2 = Path.Combine(destFolderName, forlders[forlders.Length - 1]);
if (File.Exists(sourceForlder))//如果是文件代表用户选择的dn数据文件夹结构有问题
{
return false;
}
if (!Directory.Exists(destFolderName2))
{
Directory.CreateDirectory(destFolderName2);
}
string[] filesPath = Directory.GetFileSystemEntries(sourceForlder);
for (int j = 0; j < filesPath.Length; j++)//必须按照源文件夹结构!!!!!!
{
string filePath = filesPath[j];
if (Directory.Exists(filePath))//如果是文件夹代表用户选择的dn数据文件夹结构有问题
{
return false;
}
string sourceFileName = Path.GetFileName(filePath);//获取文件名
File.Copy(filePath, Path.Combine(destFolderName2, sourceFileName), overwrite);
//统计文件个数
fileCounter++;
}
}
if (fileCounter == 0)
{
return false;
}
return true;
}
public void DelectDir(string srcPath)
@ -936,14 +1026,34 @@ namespace mainProgram
Array.Sort(df);
}
public int GetDateFolderCount()
{
FindTimespan();
return df.Length;
}
public string GetMinDate()
{
return df[0].mDateFolder;
if (df.Length == 0)
{
return null;
}
else
{
return df[0].mDateFolder;
}
}
public string GetMaxDate()
{
return df[df.Length - 1].mDateFolder;
if (df.Length == 0)
{
return null;
}
else
{
return df[df.Length - 1].mDateFolder;
}
}
public void CopyWantedFiles(string minTime, string maxTime)
@ -1006,22 +1116,10 @@ namespace mainProgram
destFileName = sourceFileName.Substring(firstIndex);
}
if (File.Exists(sourceFilePath))//是文件,直接拷贝
{
File.Copy(sourceFilePath, Path.Combine(destFolderPath, sourceFolderName + destFileName), overwrite);
}
else if (Directory.Exists(sourceFilePath))//是文件夹,拷贝文件夹;并递归 → 减而治之
{
string lastDirectory = forlders[forlders.Length - 1];
string dest = Path.Combine(destFolderPath, lastDirectory);
if (!Directory.Exists(dest))
{
Directory.CreateDirectory(dest);
}
CopySubFun(sourceFilePath, dest, overwrite);
}
}
}

View File

@ -44,7 +44,8 @@
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(341, 76);
this.textBox1.BackColor = System.Drawing.Color.WhiteSmoke;
this.textBox1.Location = new System.Drawing.Point(239, 82);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 1;
@ -53,6 +54,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(547, 236);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
@ -60,7 +62,7 @@
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ProjectManagerWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ProjectManagerWindow";
this.ResumeLayout(false);
this.PerformLayout();

File diff suppressed because it is too large Load Diff

View File

@ -1,71 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能导致不正确的行为,并且如果
// 重新生成代码,这些更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace mainProgram.Properties
{
namespace mainProgram.Properties {
using System;
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("mainProgram.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找
/// 重写当前线程的 CurrentUICulture 属性
/// 重写当前线程的 CurrentUICulture 属性
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap EasySif_logo1 {
get {
object obj = ResourceManager.GetObject("EasySif_logo1", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap IRIS_LOG2 {
get {
object obj = ResourceManager.GetObject("IRIS LOG2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -109,9 +112,16 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="IRIS LOG2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\IRIS LOG2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="EasySif_logo1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\EasySif_logo1.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,110 @@
namespace mainProgram
{
partial class RadCorrectionWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RadCorrectionWindow));
this.CancelBtn = new System.Windows.Forms.Button();
this.ProcessesDetailTextBox = new System.Windows.Forms.TextBox();
this.StartProcessBtn = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.SuspendLayout();
//
// CancelBtn
//
this.CancelBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.CancelBtn.Location = new System.Drawing.Point(388, 255);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(75, 23);
this.CancelBtn.TabIndex = 7;
this.CancelBtn.Text = "取消";
this.CancelBtn.UseVisualStyleBackColor = false;
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
//
// ProcessesDetailTextBox
//
this.ProcessesDetailTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.ProcessesDetailTextBox.Location = new System.Drawing.Point(32, 24);
this.ProcessesDetailTextBox.Multiline = true;
this.ProcessesDetailTextBox.Name = "ProcessesDetailTextBox";
this.ProcessesDetailTextBox.ReadOnly = true;
this.ProcessesDetailTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.ProcessesDetailTextBox.Size = new System.Drawing.Size(431, 154);
this.ProcessesDetailTextBox.TabIndex = 6;
//
// StartProcessBtn
//
this.StartProcessBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.StartProcessBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.StartProcessBtn.Location = new System.Drawing.Point(296, 255);
this.StartProcessBtn.Name = "StartProcessBtn";
this.StartProcessBtn.Size = new System.Drawing.Size(75, 23);
this.StartProcessBtn.TabIndex = 5;
this.StartProcessBtn.Text = "开始";
this.StartProcessBtn.UseVisualStyleBackColor = false;
this.StartProcessBtn.Click += new System.EventHandler(this.StartProcessBtn_Click);
//
// progressBar1
//
this.progressBar1.BackColor = System.Drawing.Color.WhiteSmoke;
this.progressBar1.ForeColor = System.Drawing.Color.WhiteSmoke;
this.progressBar1.Location = new System.Drawing.Point(32, 207);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(431, 23);
this.progressBar1.TabIndex = 4;
//
// RadCorrectionWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(496, 304);
this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.ProcessesDetailTextBox);
this.Controls.Add(this.StartProcessBtn);
this.Controls.Add(this.progressBar1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "RadCorrectionWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "辐亮度校正";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button CancelBtn;
private System.Windows.Forms.TextBox ProcessesDetailTextBox;
private System.Windows.Forms.Button StartProcessBtn;
private System.Windows.Forms.ProgressBar progressBar1;
}
}

View File

@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
namespace mainProgram
{
public partial class RadCorrectionWindow : Form
{
private BackgroundWorker backgroundWorker1;
private ProjectManager mProjectManager = null;//保存打开的/新建的工程对象
public RadCorrectionWindow(ProjectManager projectManager)
{
InitializeComponent();
mProjectManager = projectManager;
}
private void CancelBtn_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
Close();
}
private void StartProcessBtn_Click(object sender, EventArgs e)
{
var addr2 = getMemory(mProjectManager);
Console.WriteLine("子窗口变量的地址 = " + addr2);
//mProjectManager.UpdateProgressBarInfo = new UpdateProgressBarInfoDelegate(UpdateWidgetInfo);
mProjectManager.UpdateProgressBarInfoEvent += UpdateWidgetInfo;//向事件中注册事件处理程序
//mProjectManager.RadComplete = new RadCompleteDelegate(RadComplete);
mProjectManager.RadCompleteEvent += RadComplete;
Thread t1 = new Thread(new ThreadStart(mProjectManager.Rad));
t1.IsBackground = true;
t1.Start();
}
public void UpdateWidgetInfo(int ipos, string vinfo)//
{
//ProcessesDetailTextBox.AppendText(vinfo);//此行代码放在这里会出现问题 → 线程间操作无效: 从不是创建控件“ProcessesDetailTextBox”的线程访问它。
if (this.InvokeRequired) //InvokeRequired属性为真时说明一个创建它以以外的线程(即SleepT)想访问它
{
UpdateProgressBarInfoDelegate setpos = new UpdateProgressBarInfoDelegate(UpdateWidgetInfo);
this.Invoke(setpos, new object[] { ipos, vinfo });//SleepT线程调用本控件Form1中的方法
}
else
{
this.progressBar1.Value = Convert.ToInt32(ipos);
ProcessesDetailTextBox.AppendText(vinfo);
}
}
public void RadComplete()
{
//this.Close();//此行代码放在这里会出现问题 → 线程间操作无效: 从不是创建控件“RadCorrectionWindow”的线程访问它。
if (this.InvokeRequired)//InvokeRequired属性为真时说明一个创建它以以外的线程想访问它
{
RadCompleteDelegate RadCompleteTmp = new RadCompleteDelegate(RadComplete);
this.Invoke(RadCompleteTmp, new object[] { });
}
else
{
MessageBox.Show(this, "辐亮度转换完成!", "提示");
this.DialogResult = DialogResult.OK;
this.Close();
}
}
public string getMemory(object o) // 获取引用类型的内存地址方法
{
GCHandle h = GCHandle.Alloc(o, GCHandleType.WeakTrackResurrection);
IntPtr addr = GCHandle.ToIntPtr(h);
return "0x" + addr.ToString("X");
}
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

384
mainProgram/SVDWindows.Designer.cs generated Normal file
View File

@ -0,0 +1,384 @@
namespace mainProgram
{
partial class SVDWindows
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SVDWindows));
this.label1 = new System.Windows.Forms.Label();
this.ProcessBtn = new System.Windows.Forms.Button();
this.CancelBtn = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.Min_FraunhoferWindowTextBox = new System.Windows.Forms.TextBox();
this.Max_FraunhoferWindowTextBox = new System.Windows.Forms.TextBox();
this.FraunhoferPositionTextBox = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.MinYearTextBox = new System.Windows.Forms.TextBox();
this.MaxYearTextBox = new System.Windows.Forms.TextBox();
this.ProcessMessageTextBox = new System.Windows.Forms.TextBox();
this.MinMonthTextBox = new System.Windows.Forms.TextBox();
this.MinDayTextBox = new System.Windows.Forms.TextBox();
this.MaxMonthTextBox = new System.Windows.Forms.TextBox();
this.MaxDayTextBox = new System.Windows.Forms.TextBox();
this.LeftShoulder_leftTextBox = new System.Windows.Forms.TextBox();
this.LeftShoulder_rightTextBox = new System.Windows.Forms.TextBox();
this.RightShoulder_leftTextBox = new System.Windows.Forms.TextBox();
this.RightShoulder_rightTextBox = new System.Windows.Forms.TextBox();
this.LeftShoulderLabel = new System.Windows.Forms.Label();
this.RightShoulderLabel = new System.Windows.Forms.Label();
this.min_dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.max_dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(28, 95);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(77, 12);
this.label1.TabIndex = 1;
this.label1.Text = "选择时间范围";
//
// ProcessBtn
//
this.ProcessBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.ProcessBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.ProcessBtn.Location = new System.Drawing.Point(419, 575);
this.ProcessBtn.Name = "ProcessBtn";
this.ProcessBtn.Size = new System.Drawing.Size(75, 23);
this.ProcessBtn.TabIndex = 3;
this.ProcessBtn.Text = "执行";
this.ProcessBtn.UseVisualStyleBackColor = false;
this.ProcessBtn.Click += new System.EventHandler(this.ProcessBtn_Click);
//
// CancelBtn
//
this.CancelBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.CancelBtn.Location = new System.Drawing.Point(518, 575);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(75, 23);
this.CancelBtn.TabIndex = 4;
this.CancelBtn.Text = "取消";
this.CancelBtn.UseVisualStyleBackColor = false;
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(28, 29);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 12);
this.label2.TabIndex = 5;
this.label2.Text = "Fraunhofer窗口";
//
// Min_FraunhoferWindowTextBox
//
this.Min_FraunhoferWindowTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.Min_FraunhoferWindowTextBox.Location = new System.Drawing.Point(145, 26);
this.Min_FraunhoferWindowTextBox.Name = "Min_FraunhoferWindowTextBox";
this.Min_FraunhoferWindowTextBox.Size = new System.Drawing.Size(160, 21);
this.Min_FraunhoferWindowTextBox.TabIndex = 6;
this.Min_FraunhoferWindowTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// Max_FraunhoferWindowTextBox
//
this.Max_FraunhoferWindowTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.Max_FraunhoferWindowTextBox.Location = new System.Drawing.Point(356, 26);
this.Max_FraunhoferWindowTextBox.Name = "Max_FraunhoferWindowTextBox";
this.Max_FraunhoferWindowTextBox.Size = new System.Drawing.Size(160, 21);
this.Max_FraunhoferWindowTextBox.TabIndex = 7;
this.Max_FraunhoferWindowTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// FraunhoferPositionTextBox
//
this.FraunhoferPositionTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.FraunhoferPositionTextBox.Location = new System.Drawing.Point(280, 158);
this.FraunhoferPositionTextBox.Name = "FraunhoferPositionTextBox";
this.FraunhoferPositionTextBox.Size = new System.Drawing.Size(100, 21);
this.FraunhoferPositionTextBox.TabIndex = 8;
this.FraunhoferPositionTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(32, 161);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(113, 12);
this.label3.TabIndex = 9;
this.label3.Text = "Fraunhofer确切位置";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(28, 40);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(77, 12);
this.label4.TabIndex = 10;
this.label4.Text = "数据时间范围";
//
// MinYearTextBox
//
this.MinYearTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.MinYearTextBox.Location = new System.Drawing.Point(145, 36);
this.MinYearTextBox.Name = "MinYearTextBox";
this.MinYearTextBox.ReadOnly = true;
this.MinYearTextBox.Size = new System.Drawing.Size(50, 21);
this.MinYearTextBox.TabIndex = 11;
this.MinYearTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// MaxYearTextBox
//
this.MaxYearTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.MaxYearTextBox.Location = new System.Drawing.Point(356, 36);
this.MaxYearTextBox.Name = "MaxYearTextBox";
this.MaxYearTextBox.ReadOnly = true;
this.MaxYearTextBox.Size = new System.Drawing.Size(50, 21);
this.MaxYearTextBox.TabIndex = 12;
this.MaxYearTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// ProcessMessageTextBox
//
this.ProcessMessageTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.ProcessMessageTextBox.Location = new System.Drawing.Point(27, 400);
this.ProcessMessageTextBox.Multiline = true;
this.ProcessMessageTextBox.Name = "ProcessMessageTextBox";
this.ProcessMessageTextBox.ReadOnly = true;
this.ProcessMessageTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.ProcessMessageTextBox.Size = new System.Drawing.Size(566, 149);
this.ProcessMessageTextBox.TabIndex = 17;
//
// MinMonthTextBox
//
this.MinMonthTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.MinMonthTextBox.Location = new System.Drawing.Point(200, 36);
this.MinMonthTextBox.Name = "MinMonthTextBox";
this.MinMonthTextBox.ReadOnly = true;
this.MinMonthTextBox.Size = new System.Drawing.Size(50, 21);
this.MinMonthTextBox.TabIndex = 18;
this.MinMonthTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// MinDayTextBox
//
this.MinDayTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.MinDayTextBox.Location = new System.Drawing.Point(255, 36);
this.MinDayTextBox.Name = "MinDayTextBox";
this.MinDayTextBox.ReadOnly = true;
this.MinDayTextBox.Size = new System.Drawing.Size(50, 21);
this.MinDayTextBox.TabIndex = 19;
this.MinDayTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// MaxMonthTextBox
//
this.MaxMonthTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.MaxMonthTextBox.Location = new System.Drawing.Point(411, 36);
this.MaxMonthTextBox.Name = "MaxMonthTextBox";
this.MaxMonthTextBox.ReadOnly = true;
this.MaxMonthTextBox.Size = new System.Drawing.Size(50, 21);
this.MaxMonthTextBox.TabIndex = 20;
this.MaxMonthTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// MaxDayTextBox
//
this.MaxDayTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.MaxDayTextBox.Location = new System.Drawing.Point(466, 36);
this.MaxDayTextBox.Name = "MaxDayTextBox";
this.MaxDayTextBox.ReadOnly = true;
this.MaxDayTextBox.Size = new System.Drawing.Size(50, 21);
this.MaxDayTextBox.TabIndex = 21;
this.MaxDayTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// LeftShoulder_leftTextBox
//
this.LeftShoulder_leftTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.LeftShoulder_leftTextBox.Location = new System.Drawing.Point(145, 107);
this.LeftShoulder_leftTextBox.Name = "LeftShoulder_leftTextBox";
this.LeftShoulder_leftTextBox.Size = new System.Drawing.Size(76, 21);
this.LeftShoulder_leftTextBox.TabIndex = 22;
this.LeftShoulder_leftTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// LeftShoulder_rightTextBox
//
this.LeftShoulder_rightTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.LeftShoulder_rightTextBox.Location = new System.Drawing.Point(229, 107);
this.LeftShoulder_rightTextBox.Name = "LeftShoulder_rightTextBox";
this.LeftShoulder_rightTextBox.Size = new System.Drawing.Size(76, 21);
this.LeftShoulder_rightTextBox.TabIndex = 23;
this.LeftShoulder_rightTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// RightShoulder_leftTextBox
//
this.RightShoulder_leftTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.RightShoulder_leftTextBox.Location = new System.Drawing.Point(356, 107);
this.RightShoulder_leftTextBox.Name = "RightShoulder_leftTextBox";
this.RightShoulder_leftTextBox.Size = new System.Drawing.Size(76, 21);
this.RightShoulder_leftTextBox.TabIndex = 24;
this.RightShoulder_leftTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// RightShoulder_rightTextBox
//
this.RightShoulder_rightTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.RightShoulder_rightTextBox.Location = new System.Drawing.Point(438, 107);
this.RightShoulder_rightTextBox.Name = "RightShoulder_rightTextBox";
this.RightShoulder_rightTextBox.Size = new System.Drawing.Size(76, 21);
this.RightShoulder_rightTextBox.TabIndex = 25;
this.RightShoulder_rightTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// LeftShoulderLabel
//
this.LeftShoulderLabel.AutoSize = true;
this.LeftShoulderLabel.Location = new System.Drawing.Point(203, 76);
this.LeftShoulderLabel.Name = "LeftShoulderLabel";
this.LeftShoulderLabel.Size = new System.Drawing.Size(53, 12);
this.LeftShoulderLabel.TabIndex = 26;
this.LeftShoulderLabel.Text = "左肩窗口";
//
// RightShoulderLabel
//
this.RightShoulderLabel.AutoSize = true;
this.RightShoulderLabel.Location = new System.Drawing.Point(417, 76);
this.RightShoulderLabel.Name = "RightShoulderLabel";
this.RightShoulderLabel.Size = new System.Drawing.Size(53, 12);
this.RightShoulderLabel.TabIndex = 27;
this.RightShoulderLabel.Text = "右肩窗口";
//
// min_dateTimePicker
//
this.min_dateTimePicker.Location = new System.Drawing.Point(145, 89);
this.min_dateTimePicker.Name = "min_dateTimePicker";
this.min_dateTimePicker.Size = new System.Drawing.Size(160, 21);
this.min_dateTimePicker.TabIndex = 28;
//
// max_dateTimePicker
//
this.max_dateTimePicker.Location = new System.Drawing.Point(356, 89);
this.max_dateTimePicker.Name = "max_dateTimePicker";
this.max_dateTimePicker.Size = new System.Drawing.Size(160, 21);
this.max_dateTimePicker.TabIndex = 29;
//
// groupBox1
//
this.groupBox1.BackColor = System.Drawing.Color.White;
this.groupBox1.Controls.Add(this.max_dateTimePicker);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.min_dateTimePicker);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.MinYearTextBox);
this.groupBox1.Controls.Add(this.MaxYearTextBox);
this.groupBox1.Controls.Add(this.MinMonthTextBox);
this.groupBox1.Controls.Add(this.MinDayTextBox);
this.groupBox1.Controls.Add(this.MaxMonthTextBox);
this.groupBox1.Controls.Add(this.MaxDayTextBox);
this.groupBox1.Location = new System.Drawing.Point(27, 19);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(566, 143);
this.groupBox1.TabIndex = 30;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "数据";
//
// groupBox2
//
this.groupBox2.BackColor = System.Drawing.Color.White;
this.groupBox2.Controls.Add(this.RightShoulder_leftTextBox);
this.groupBox2.Controls.Add(this.label2);
this.groupBox2.Controls.Add(this.RightShoulderLabel);
this.groupBox2.Controls.Add(this.Min_FraunhoferWindowTextBox);
this.groupBox2.Controls.Add(this.LeftShoulderLabel);
this.groupBox2.Controls.Add(this.Max_FraunhoferWindowTextBox);
this.groupBox2.Controls.Add(this.RightShoulder_rightTextBox);
this.groupBox2.Controls.Add(this.FraunhoferPositionTextBox);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Controls.Add(this.LeftShoulder_rightTextBox);
this.groupBox2.Controls.Add(this.LeftShoulder_leftTextBox);
this.groupBox2.Location = new System.Drawing.Point(27, 178);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(566, 198);
this.groupBox2.TabIndex = 31;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "SIF参数";
//
// SVDWindows
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(624, 626);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.ProcessMessageTextBox);
this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.ProcessBtn);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SVDWindows";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SVDWindows";
this.Load += new System.EventHandler(this.SVDWindows_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button ProcessBtn;
private System.Windows.Forms.Button CancelBtn;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox Min_FraunhoferWindowTextBox;
private System.Windows.Forms.TextBox Max_FraunhoferWindowTextBox;
private System.Windows.Forms.TextBox FraunhoferPositionTextBox;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox MinYearTextBox;
private System.Windows.Forms.TextBox MaxYearTextBox;
private System.Windows.Forms.TextBox ProcessMessageTextBox;
private System.Windows.Forms.TextBox MinMonthTextBox;
private System.Windows.Forms.TextBox MinDayTextBox;
private System.Windows.Forms.TextBox MaxMonthTextBox;
private System.Windows.Forms.TextBox MaxDayTextBox;
private System.Windows.Forms.TextBox LeftShoulder_leftTextBox;
private System.Windows.Forms.TextBox LeftShoulder_rightTextBox;
private System.Windows.Forms.TextBox RightShoulder_leftTextBox;
private System.Windows.Forms.TextBox RightShoulder_rightTextBox;
private System.Windows.Forms.Label LeftShoulderLabel;
private System.Windows.Forms.Label RightShoulderLabel;
private System.Windows.Forms.DateTimePicker min_dateTimePicker;
private System.Windows.Forms.DateTimePicker max_dateTimePicker;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
}
}

356
mainProgram/SVDWindows.cs Normal file
View File

@ -0,0 +1,356 @@
//#define debug
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace mainProgram
{
public partial class SVDWindows : Form
{
private ProjectManager mProjectManager = null;//保存打开的/新建的工程对象
private string mSifAlgorithm;
public SVDWindows(ProjectManager projectManager,string sifAlgorithm)
{
InitializeComponent();
mProjectManager = projectManager;
mSifAlgorithm = sifAlgorithm;
this.Text = mSifAlgorithm;//设置界面左上角的窗口名
//准备sif算法默认窗口
switch (mSifAlgorithm)
{
case "svd":
Min_FraunhoferWindowTextBox.Text = "740";
Max_FraunhoferWindowTextBox.Text = "770";
FraunhoferPositionTextBox.Text = "760";
UseLeftShoulder(false);
UseRightShoulder(false);
UseFraunhoferPosition(true);
break;
case "sfm":
Min_FraunhoferWindowTextBox.Text = "759";
Max_FraunhoferWindowTextBox.Text = "770";
FraunhoferPositionTextBox.Text = "760";
UseLeftShoulder(false);
UseRightShoulder(false);
UseFraunhoferPosition(true);
break;
case "sfm_gaussian":
Min_FraunhoferWindowTextBox.Text = "759";
Max_FraunhoferWindowTextBox.Text = "770";
FraunhoferPositionTextBox.Text = "760";
UseLeftShoulder(false);
UseRightShoulder(false);
UseFraunhoferPosition(true);
break;
case "doas":
Min_FraunhoferWindowTextBox.Text = "759";
Max_FraunhoferWindowTextBox.Text = "770";
FraunhoferPositionTextBox.Text = "760";
UseLeftShoulder(false);
UseRightShoulder(false);
UseFraunhoferPosition(true);
break;
case "sfld":
Min_FraunhoferWindowTextBox.Text = "740";
Max_FraunhoferWindowTextBox.Text = "780";
LeftShoulder_leftTextBox.Text = "756";
LeftShoulder_rightTextBox.Text = "759";
UseLeftShoulder(true);
UseRightShoulder(false);
UseFraunhoferPosition(false);
break;
case "3fld":
Min_FraunhoferWindowTextBox.Text = "740";
Max_FraunhoferWindowTextBox.Text = "780";
LeftShoulder_leftTextBox.Text = "756";
LeftShoulder_rightTextBox.Text = "759";
RightShoulder_leftTextBox.Text = "761";
RightShoulder_rightTextBox.Text = "762";
UseLeftShoulder(true);
UseRightShoulder(true);
UseFraunhoferPosition(false);
break;
/* 您可以有任意数量的 case 语句 */
default: /* 可选的 */
//statement(s);
break;
}
}
private void UseLeftShoulder(bool readyToUse)
{
LeftShoulder_leftTextBox.Enabled = readyToUse;
LeftShoulder_rightTextBox.Enabled = readyToUse;
}
private void UseRightShoulder(bool readyToUse)
{
RightShoulder_leftTextBox.Enabled = readyToUse;
RightShoulder_rightTextBox.Enabled = readyToUse;
}
private void UseFraunhoferPosition(bool readyToUse)
{
FraunhoferPositionTextBox.Enabled = readyToUse;
}
private void ProcessBtn_Click(object sender, EventArgs e)
{
//准备需要处理的文件
DateTime min = min_dateTimePicker.Value;
DateTime max = max_dateTimePicker.Value;
if (max < min)
{
MessageBox.Show(this, "选择的数据时间错误!", "提示");
return;
}
string minTime = min.Year.ToString() + "_" + min.Month.ToString() + "_" + min.Day.ToString();
string maxTime = max.Year.ToString() + "_" + max.Month.ToString() + "_" + max.Day.ToString();
ProcessMessageTextBox.Text = "Preparing files ...";
mProjectManager.CopyWantedFiles(minTime, maxTime);
this.ProcessMessageTextBox.Text = this.ProcessMessageTextBox.Text + System.Environment.NewLine + "\tdone ..." + System.Environment.NewLine;
try
{
//构建参数
string programDir = System.Environment.CurrentDirectory;
#if debug//条件编译符号 定义在 此源文件的第一行
string param1 = "D:\\PycharmProjects\\sif\\standard_sif.csv";
#else
string param1 = Path.Combine(programDir, "standard_sif.csv");
#endif
string param2 = mProjectManager.mSifTmpPath;//输入数据文件夹
string outputFileName = mSifAlgorithm + "_" + Min_FraunhoferWindowTextBox.Text + "-" + Max_FraunhoferWindowTextBox.Text + "_" + FraunhoferPositionTextBox.Text + "_" + minTime + "-" + maxTime + ".csv";
string param3 = Path.Combine(mProjectManager.mSifPath, outputFileName);//输出文件名
string param4 = "";
switch (mSifAlgorithm)
{
case "svd":
case "sfm":
case "sfm_gaussian":
case "doas":
//string param4 = "[740,770],760";
param4 = "[" + Min_FraunhoferWindowTextBox.Text + "," + Max_FraunhoferWindowTextBox.Text + "]," + FraunhoferPositionTextBox.Text;
break;
case "sfld":
param4 = "[" + Min_FraunhoferWindowTextBox.Text + "," + Max_FraunhoferWindowTextBox.Text + "]," + "[" + LeftShoulder_leftTextBox.Text + "," + LeftShoulder_rightTextBox.Text + "]";
break;
case "3fld":
param4 = "[" + Min_FraunhoferWindowTextBox.Text + "," + Max_FraunhoferWindowTextBox.Text + "]," + "[" + LeftShoulder_leftTextBox.Text + "," + LeftShoulder_rightTextBox.Text + "]," + "[" + RightShoulder_leftTextBox.Text + "," + RightShoulder_rightTextBox.Text + "]";
break;
/* 您可以有任意数量的 case 语句 */
default: /* 可选的 */
//statement(s);
break;
}
string param5 = "P1";
string param6 = mSifAlgorithm;
int a = 1;
int b = 2;
//执行算法
StartTest(param1, param2, param3, param4, param5, param6);
//this.DialogResult = DialogResult.OK;//这行代码会导致窗口直接关闭
}
catch (Exception e1)
{
MessageBox.Show(e1.Message);
}
}
private Process progressTest;
private void log(string log, bool time)
{
//将参数写入到txt文件中 → 调试使用
string programDir = System.Environment.CurrentDirectory;
string tmp = Path.Combine(programDir, "commandLine.txt");//保存的文件路径
//FileStream mystream = new FileStream(tmp, FileMode.OpenOrCreate);
//StreamWriter sw = new StreamWriter(mystream);
StreamWriter sw = new StreamWriter(tmp, true);
if (time)
{
string tradeTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss ", DateTimeFormatInfo.InvariantInfo);
sw.WriteLine(tradeTime + log);//按行写
}
else
{
sw.WriteLine(" " + log);//按行写
}
sw.Close();//关闭
}
public bool StartTest(string param1, string param2, string param3, string param4, string param5, string param6)
{
bool state = true;
Console.WriteLine("开始执行sif 算法 python+++++++++++++++++++++++\n");
ProcessStartInfo start = new ProcessStartInfo();
string programDir = System.Environment.CurrentDirectory;
#if debug//条件编译符号 定义在 此源文件的第一行
string sifPlgorithm_exe = Path.Combine(@"D:\csharp_vs2017\easySif\sifAlgorithm_Python_exe\dist", "sif_retrieval.exe");
#else
string sifPlgorithm_exe = Path.Combine(programDir, "sif_retrieval.exe");
#endif
start.FileName = sifPlgorithm_exe;
string sArguments = param1 + " " + param2 + " " + param3 + " " + param4 + " " + param5 + " " + param6;
log(sArguments, true);
start.Arguments = sArguments;
start.UseShellExecute = false;
start.RedirectStandardOutput = true;
start.RedirectStandardInput = true;
start.RedirectStandardError = true;
start.CreateNoWindow = true;
using (progressTest = Process.Start(start))
{
// 异步获取命令行内容
progressTest.BeginOutputReadLine();
// 为异步获取订阅事件
progressTest.OutputDataReceived += new DataReceivedEventHandler(outputDataReceived);
progressTest.ErrorDataReceived += new DataReceivedEventHandler(outputDataReceived2);
//progressTest.StandardError += new
}
Console.WriteLine("开始执行sif 算法 python---------------------\n");
//this.DialogResult = DialogResult.OK;//这行代码会导致窗口直接关闭
return state;
}
public void outputDataReceived(object sender, DataReceivedEventArgs e)
{
if (!string.IsNullOrEmpty(e.Data))//System.Environment.NewLine
{
this.Invoke(
new Action(() => { this.ProcessMessageTextBox.AppendText(e.Data + System.Environment.NewLine); log(e.Data, false); })
);
if (e.Data.Contains("Sif compute Completed!"))//当转换完成后
{
this.Invoke(
new Action(() => { MessageBox.Show(this, "sif计算完成", "提示"); this.DialogResult = DialogResult.OK; this.Close(); })
);
}
if (e.Data.Contains("error"))//当转换完成后
{
this.Invoke(
new Action(() => { MessageBox.Show(this, "sif算法发生错误请联系工程师解决", "提示"); this.DialogResult = DialogResult.No; this.Close(); })
);
}
}
//if (this.InvokeRequired)//InvokeRequired属性为真时说明一个创建它以以外的线程想访问它
//{
// if (e.Data.Contains("Completed"))//System.NullReferenceException:“未将对象引用设置到对象的实例。”
// //System.Diagnostics.DataReceivedEventArgs.Data.get 返回 null。
// {
// DataReceivedEventHandler Tmp = new DataReceivedEventHandler(outputDataReceived);
// this.Invoke(Tmp, new object[] { sender, e });
// }
//}
//else
//{
// MessageBox.Show(this, "sif转换完成", "提示");//线程间操作无效: 从不是创建控件“SVDWindows”的线程访问它。
//}
}
public void outputDataReceived2(object sender, DataReceivedEventArgs e)
{
if (!string.IsNullOrEmpty(e.Data))//System.Environment.NewLine
{
string tmp = this.ProcessMessageTextBox.Text + System.Environment.NewLine + e.Data;
this.Invoke(
new Action(() => { this.ProcessMessageTextBox.Text = tmp; log(e.Data, false); })
);
if (e.Data.Contains("Completed"))//当转换完成后
{
this.Invoke(
new Action(() => { MessageBox.Show(this, "sif转换完成", "提示"); this.DialogResult = DialogResult.OK; this.Close(); })
);
}
}
}
private void CancelBtn_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
Close();
}
private void SVDWindows_Load(object sender, EventArgs e)
{
//获取数据的时间范围
mProjectManager.FindTimespan();
string minDate = mProjectManager.GetMinDate();
string maxDate = mProjectManager.GetMaxDate();
string[] minDateList = minDate.Split('_');
string[] maxDateList = maxDate.Split('_');
//显示数据的时间范围
MinYearTextBox.Text = minDateList[0];
MinMonthTextBox.Text = minDateList[1];
MinDayTextBox.Text = minDateList[2];
MaxYearTextBox.Text = maxDateList[0];
MaxMonthTextBox.Text = maxDateList[1];
MaxDayTextBox.Text = maxDateList[2];
//设置默认需要处理的时间范围
DateTime min = new DateTime(int.Parse(minDateList[0]), int.Parse(minDateList[1]), int.Parse(minDateList[2]));
DateTime max = new DateTime(int.Parse(maxDateList[0]), int.Parse(maxDateList[1]), int.Parse(maxDateList[2]));
min_dateTimePicker.MinDate = min;
min_dateTimePicker.MaxDate = max;
min_dateTimePicker.Value = min;
max_dateTimePicker.MinDate = min;
max_dateTimePicker.MaxDate = max;
max_dateTimePicker.Value = max;
}
}
}

1253
mainProgram/SVDWindows.resx Normal file

File diff suppressed because it is too large Load Diff

128
mainProgram/SaveAs.Designer.cs generated Normal file
View File

@ -0,0 +1,128 @@
namespace mainProgram
{
partial class SaveAsWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SaveAsWindow));
this.SelectPathBtn = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.PathTextBox = new System.Windows.Forms.TextBox();
this.OkBtn = new System.Windows.Forms.Button();
this.CancelBtn = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// SelectPathBtn
//
this.SelectPathBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.SelectPathBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.SelectPathBtn.Location = new System.Drawing.Point(367, 32);
this.SelectPathBtn.Margin = new System.Windows.Forms.Padding(2);
this.SelectPathBtn.Name = "SelectPathBtn";
this.SelectPathBtn.Size = new System.Drawing.Size(56, 27);
this.SelectPathBtn.TabIndex = 0;
this.SelectPathBtn.Text = "浏览...";
this.SelectPathBtn.UseVisualStyleBackColor = false;
this.SelectPathBtn.Click += new System.EventHandler(this.SelectPathBtn_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(43, 40);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 1;
this.label1.Text = "保存路径";
//
// PathTextBox
//
this.PathTextBox.BackColor = System.Drawing.Color.WhiteSmoke;
this.PathTextBox.Location = new System.Drawing.Point(114, 36);
this.PathTextBox.Margin = new System.Windows.Forms.Padding(2);
this.PathTextBox.Name = "PathTextBox";
this.PathTextBox.Size = new System.Drawing.Size(234, 21);
this.PathTextBox.TabIndex = 2;
//
// OkBtn
//
this.OkBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.OkBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.OkBtn.Location = new System.Drawing.Point(292, 100);
this.OkBtn.Margin = new System.Windows.Forms.Padding(2);
this.OkBtn.Name = "OkBtn";
this.OkBtn.Size = new System.Drawing.Size(56, 27);
this.OkBtn.TabIndex = 3;
this.OkBtn.Text = "确定";
this.OkBtn.UseVisualStyleBackColor = false;
this.OkBtn.Click += new System.EventHandler(this.OkBtn_Click);
//
// CancelBtn
//
this.CancelBtn.BackColor = System.Drawing.Color.WhiteSmoke;
this.CancelBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.CancelBtn.Location = new System.Drawing.Point(367, 100);
this.CancelBtn.Margin = new System.Windows.Forms.Padding(2);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(56, 27);
this.CancelBtn.TabIndex = 4;
this.CancelBtn.Text = "取消";
this.CancelBtn.UseVisualStyleBackColor = false;
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
//
// SaveAsWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(468, 163);
this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.OkBtn);
this.Controls.Add(this.PathTextBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.SelectPathBtn);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SaveAsWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "另存为";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button SelectPathBtn;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox PathTextBox;
private System.Windows.Forms.Button OkBtn;
private System.Windows.Forms.Button CancelBtn;
}
}

81
mainProgram/SaveAs.cs Normal file
View File

@ -0,0 +1,81 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace mainProgram
{
public partial class SaveAsWindow : Form
{
private string mSource;
public SaveAsWindow(string source)
{
InitializeComponent();
mSource = source;
}
private void SelectPathBtn_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件夹";
if (dialog.ShowDialog() == DialogResult.OK)
{
if (string.IsNullOrEmpty(dialog.SelectedPath))
{
MessageBox.Show(this, "文件夹路径不能为空", "提示");
return;
}
string savePath = dialog.SelectedPath;
PathTextBox.Text = savePath;
}
}
private void CancelBtn_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
Close();
}
private void OkBtn_Click(object sender, EventArgs e)
{
if (!Directory.Exists(PathTextBox.Text))
{
Directory.CreateDirectory(PathTextBox.Text);
}
CopySubFun(mSource, PathTextBox.Text, true);
Close();
}
private void CopySubFun(string sourceName, string destFolderName, bool overwrite)//递归函数
{
if (File.Exists(sourceName))//是文件,直接拷贝
{
string sourceFileName = Path.GetFileName(sourceName);//获取文件名
File.Copy(sourceName, Path.Combine(destFolderName, sourceFileName), overwrite);
}
else if (Directory.Exists(sourceName))//是文件夹,拷贝文件夹;并递归
{
string[] sourceFolders = sourceName.Split('\\');
string lastDirectory = sourceFolders[sourceFolders.Length - 1];
string dest = Path.Combine(destFolderName, lastDirectory);
Directory.CreateDirectory(dest);
string[] sourceFilesPath = Directory.GetFileSystemEntries(sourceName);
for (int i = 0; i < sourceFilesPath.Length; i++)
{
string sourceFilePath = sourceFilesPath[i];
CopySubFun(sourceFilePath, dest, overwrite);
}
}
}
}
}

1253
mainProgram/SaveAs.resx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>leaf.ico</ApplicationIcon>
<ApplicationIcon>
</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="IronPython, Version=2.7.11.0, Culture=neutral, PublicKeyToken=7f709c5b713576e1, processorArchitecture=MSIL">
@ -75,12 +76,24 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AboutWindows.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="AboutWindows.Designer.cs">
<DependentUpon>AboutWindows.cs</DependentUpon>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Form2.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form2.Designer.cs">
<DependentUpon>Form2.cs</DependentUpon>
</Compile>
<Compile Include="NewProjectWindow.cs">
<SubType>Form</SubType>
</Compile>
@ -102,6 +115,11 @@
<DependentUpon>ProjectManagerWindow.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="RadCorrectionWindow.cs">
<SubType>Form</SubType>
</Compile>
@ -121,9 +139,15 @@
<Compile Include="SVDWindows.Designer.cs">
<DependentUpon>SVDWindows.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="AboutWindows.resx">
<DependentUpon>AboutWindows.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form2.resx">
<DependentUpon>Form2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="NewProjectWindow.resx">
<DependentUpon>NewProjectWindow.cs</DependentUpon>
</EmbeddedResource>
@ -135,13 +159,9 @@
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<EmbeddedResource Include="RadCorrectionWindow.resx">
<DependentUpon>RadCorrectionWindow.cs</DependentUpon>
</EmbeddedResource>
@ -183,7 +203,10 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="leaf.ico" />
<None Include="Resources\EasySif_logo1.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\IRIS LOG2.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DynamicLanguageRuntime" version="1.3.0" targetFramework="net472" />
<package id="IronPython" version="2.7.11" targetFramework="net472" />
</packages>