Compare commits
5 Commits
cb638a0908
...
ec35cccc21
Author | SHA1 | Date | |
---|---|---|---|
ec35cccc21 | |||
7a449b7533 | |||
24cce6e49a | |||
f36c5eaa39 | |||
b43227dc58 |
145
.gitignore
vendored
145
.gitignore
vendored
@ -1,4 +1,141 @@
|
||||
./0easySifProject
|
||||
./0sifRawData
|
||||
./MyComputers.xml
|
||||
./packages
|
||||
# tc
|
||||
packages/
|
||||
sifAlgorithm_Python_exe/
|
||||
Setup/
|
||||
*.docx
|
||||
|
||||
.vs
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
*.azurePubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
packages/
|
||||
## TODO: If the tool you use requires repositories.config, also uncomment the next line
|
||||
!packages/repositories.config
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
![Ss]tyle[Cc]op.targets
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
||||
|
||||
_NCrunch*
|
36
TreeViewTc/Properties/AssemblyInfo.cs
Normal file
36
TreeViewTc/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("TreeViewTc")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TreeViewTc")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("d8ed957e-4b79-4c20-a2aa-c70008e5dad8")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
|
||||
// 方法是按如下所示使用“*”: :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
60
TreeViewTc/TreeViewTc.csproj
Normal file
60
TreeViewTc/TreeViewTc.csproj
Normal file
@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D8ED957E-4B79-4C20-A2AA-C70008E5DAD8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>TreeViewTc</RootNamespace>
|
||||
<AssemblyName>TreeViewTc</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TreeViewTc2.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TreeViewTc2.Designer.cs">
|
||||
<DependentUpon>TreeViewTc2.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="TreeViewTc2.resx">
|
||||
<DependentUpon>TreeViewTc2.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
99
TreeViewTc/TreeViewTc2.Designer.cs
generated
Normal file
99
TreeViewTc/TreeViewTc2.Designer.cs
generated
Normal file
@ -0,0 +1,99 @@
|
||||
namespace TreeViewTc
|
||||
{
|
||||
partial class TreeViewTc2
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.treeView1 = new System.Windows.Forms.TreeView();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// treeView1
|
||||
//
|
||||
this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeView1.HotTracking = true;
|
||||
this.treeView1.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeView1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.treeView1.Name = "treeView1";
|
||||
this.treeView1.Size = new System.Drawing.Size(209, 539);
|
||||
this.treeView1.TabIndex = 0;
|
||||
this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeExpand);
|
||||
this.treeView1.AfterExpand += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterExpand);
|
||||
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect);
|
||||
this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);
|
||||
this.treeView1.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseDoubleClick);
|
||||
this.treeView1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.treeView1_MouseUp);
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.deleteToolStripMenuItem,
|
||||
this.saveAsToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(211, 80);
|
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
//
|
||||
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(210, 24);
|
||||
this.deleteToolStripMenuItem.Text = "delete";
|
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
|
||||
//
|
||||
// saveAsToolStripMenuItem
|
||||
//
|
||||
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
|
||||
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(210, 24);
|
||||
this.saveAsToolStripMenuItem.Text = "saveAs";
|
||||
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.saveAsToolStripMenuItem_Click);
|
||||
//
|
||||
// TreeViewTc2
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.treeView1);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.Name = "TreeViewTc2";
|
||||
this.Size = new System.Drawing.Size(209, 539);
|
||||
this.Load += new System.EventHandler(this.TreeViewTc2_Load);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public System.Windows.Forms.TreeView treeView1;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveAsToolStripMenuItem;
|
||||
}
|
||||
}
|
256
TreeViewTc/TreeViewTc2.cs
Normal file
256
TreeViewTc/TreeViewTc2.cs
Normal file
@ -0,0 +1,256 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
//自定义封装控件:
|
||||
//(1)控件为成员【本代码使用此方法】:https://blog.csdn.net/wanlong360599336/article/details/7578447
|
||||
//(2)继承控件:https://blog.csdn.net/aoshilang2249/article/details/41252781?utm_medium=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-2.nonecase&depth_1-utm_source=distribute.pc_relevant_bbs_down.none-task-blog-baidujs-2.nonecase
|
||||
namespace TreeViewTc
|
||||
{
|
||||
public delegate void Delegate1(string vinfo);//申明委托类型:用于进度条的更新
|
||||
|
||||
public partial class TreeViewTc2 : UserControl
|
||||
{
|
||||
public TreeViewTc2()
|
||||
{
|
||||
InitializeComponent();
|
||||
treeView1.ExpandAll();
|
||||
//treeView1.NodeMouseClick += new TreeNodeMouseClickEventHandler(treeView1_NodeMouseClick);
|
||||
|
||||
//this.treeView1.ContextMenuStrip = this.contextMenuStrip1;//这行代码有问题:在控件treeView1任何位置鼠标右击都会显示右键菜单
|
||||
}
|
||||
|
||||
void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Right) return;
|
||||
if (e.Node.Parent == null || e.Node == null) return;
|
||||
treeView1.SelectedNode = e.Node;
|
||||
contextMenuStrip1.Show(treeView1, e.X, e.Y);
|
||||
}
|
||||
|
||||
public event Delegate1 PlotSifEvent;//申明事件
|
||||
private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left) return;
|
||||
if (e.Node.Parent == null || e.Node == null) return;
|
||||
treeView1.SelectedNode = e.Node;
|
||||
|
||||
string nodeName = treeView1.SelectedNode.Name;
|
||||
|
||||
if (PlotSifEvent != null)
|
||||
{
|
||||
PlotSifEvent(nodeName);
|
||||
}
|
||||
}
|
||||
|
||||
private void TreeViewTc2_Load(object sender, EventArgs e)
|
||||
{
|
||||
////实例化TreeNode类 TreeNode(string text,int imageIndex,int selectImageIndex)
|
||||
//TreeNode rootNode = new TreeNode("我的电脑"); //载入显示 选择显示
|
||||
//rootNode.Tag = "我的电脑"; //树节点数据
|
||||
//rootNode.Text = "我的电脑"; //树节点标签内容
|
||||
//treeView1.Nodes.Add(rootNode); //树中添加根目录
|
||||
|
||||
////显示MyDocuments(我的文档)结点
|
||||
//var myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);//获取计算机我的文档文件夹
|
||||
//TreeNode DocNode = new TreeNode(myDocuments);
|
||||
//DocNode.Tag = "我的文档"; //设置结点名称
|
||||
//DocNode.Text = "我的文档";
|
||||
////DocNode.ImageIndex = IconIndexes.MyDocuments; //设置获取结点显示图片
|
||||
////DocNode.SelectedImageIndex = IconIndexes.MyDocuments; //设置选择显示图片
|
||||
//rootNode.Nodes.Add(DocNode); //rootNode目录下加载节点
|
||||
//DocNode.Nodes.Add("");
|
||||
|
||||
////循环遍历计算机所有逻辑驱动器名称(盘符)
|
||||
//foreach (string drive in Environment.GetLogicalDrives())
|
||||
//{
|
||||
// //实例化DriveInfo对象 命名空间System.IO
|
||||
// var dir = new DriveInfo(drive);
|
||||
// switch (dir.DriveType) //判断驱动器类型
|
||||
// {
|
||||
// case DriveType.Fixed: //仅取固定磁盘盘符 Removable-U盘
|
||||
// {
|
||||
// //Split仅获取盘符字母
|
||||
// TreeNode tNode = new TreeNode(dir.Name.Split(':')[0]);
|
||||
// tNode.Name = dir.Name;
|
||||
// tNode.Tag = tNode.Name;
|
||||
// //tNode.ImageIndex = IconIndexes.FixedDrive; //获取结点显示图片
|
||||
// //tNode.SelectedImageIndex = IconIndexes.FixedDrive; //选择显示图片
|
||||
// treeView1.Nodes.Add(tNode); //加载驱动节点
|
||||
// tNode.Nodes.Add("");
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
//rootNode.Expand();//展开树状视图
|
||||
|
||||
|
||||
//string path = @"D:\Desktop\0easySifProject";
|
||||
//Initialize(path);
|
||||
}
|
||||
|
||||
private string mPath;
|
||||
public void Initialize(string path)
|
||||
{
|
||||
string[] dics = Directory.GetDirectories(path);
|
||||
foreach (string dic in dics)
|
||||
{
|
||||
if (dic.Contains("sifTmp"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
TreeNode subNode = new TreeNode(new DirectoryInfo(dic).Name);//实例化
|
||||
subNode.Name = new DirectoryInfo(dic).FullName;//完整目录
|
||||
subNode.Tag = subNode.Name;
|
||||
treeView1.Nodes.Add(subNode);
|
||||
subNode.Nodes.Add("");//加载空节点 实现+号
|
||||
}
|
||||
|
||||
mPath = path;
|
||||
}
|
||||
|
||||
public void reInitialize()
|
||||
{
|
||||
clearAll();
|
||||
Initialize(mPath);
|
||||
}
|
||||
|
||||
public void clearAll()
|
||||
{
|
||||
treeView1.Nodes.Clear();
|
||||
}
|
||||
|
||||
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void AddRootNode(string NodeName)
|
||||
{
|
||||
//添加根节点
|
||||
treeView1.Nodes.Add(NodeName.Trim());
|
||||
}
|
||||
|
||||
private void btnAddSonNode_Click(string SonNodeName)
|
||||
{
|
||||
if (treeView1.SelectedNode == null)
|
||||
{
|
||||
MessageBox.Show("请选择要添加子节点的节点!");
|
||||
return;
|
||||
}
|
||||
treeView1.SelectedNode.Nodes.Add(SonNodeName.Trim());
|
||||
}
|
||||
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void treeView1_AfterExpand(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
e.Node.Expand();
|
||||
}
|
||||
|
||||
private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
TreeViewItems.Add(e.Node);
|
||||
|
||||
}
|
||||
|
||||
public event Delegate1 DeleteEvent;//申明事件
|
||||
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string nodeName = treeView1.SelectedNode.Name;
|
||||
|
||||
if (MessageBox.Show("确认删除?", "此删除不可恢复", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
if (DeleteEvent != null)
|
||||
{
|
||||
DeleteEvent(nodeName);
|
||||
treeView1.SelectedNode.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void treeView1_MouseUp(object sender, MouseEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public event Delegate1 SaveAsEvent;//申明事件
|
||||
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string nodeName = treeView1.SelectedNode.Name;
|
||||
|
||||
if (SaveAsEvent != null)
|
||||
{
|
||||
SaveAsEvent(nodeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class TreeViewItems
|
||||
{
|
||||
public static void Add(TreeNode treeNode)
|
||||
{
|
||||
//try..catch异常处理
|
||||
try
|
||||
{
|
||||
//判断"我的电脑"Tag 上面加载的该结点没指定其路径
|
||||
if (treeNode.Tag.ToString() != "我的电脑")
|
||||
{
|
||||
treeNode.Nodes.Clear();//清除空节点再加载子节点
|
||||
TreeNode tNode = treeNode;//获取选中\展开\折叠结点
|
||||
string path = tNode.Name;//路径
|
||||
|
||||
//获取"我的文档"路径
|
||||
if (treeNode.Tag.ToString() == "我的文档")
|
||||
{
|
||||
path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);//获取计算机我的文档文件夹
|
||||
}
|
||||
|
||||
//获取指定目录中的子目录名称并加载结点
|
||||
string[] dics = Directory.GetDirectories(path);
|
||||
foreach (string dic in dics)
|
||||
{
|
||||
TreeNode subNode = new TreeNode(new DirectoryInfo(dic).Name);//实例化
|
||||
subNode.Name = new DirectoryInfo(dic).FullName;//完整目录
|
||||
subNode.Tag = subNode.Name;
|
||||
//subNode.ImageIndex = IconIndexes.ClosedFolder;//获取节点显示图片
|
||||
//subNode.SelectedImageIndex = IconIndexes.OpenFolder;//选择节点显示图片
|
||||
tNode.Nodes.Add(subNode);
|
||||
subNode.Nodes.Add("");//加载空节点 实现+号
|
||||
}
|
||||
|
||||
//获取目录中的文件
|
||||
string[] files = Directory.GetFiles(path);
|
||||
foreach (string file in files)
|
||||
{
|
||||
string[] nameTmp = file.Split('\\');
|
||||
string name = nameTmp[nameTmp.Length - 1];
|
||||
|
||||
TreeNode subNode = new TreeNode(name);//实例化
|
||||
subNode.Name = file;//完整目录
|
||||
subNode.Tag = subNode.Name;
|
||||
//subNode.ImageIndex = IconIndexes.ClosedFolder;//获取节点显示图片
|
||||
//subNode.SelectedImageIndex = IconIndexes.OpenFolder;//选择节点显示图片
|
||||
tNode.Nodes.Add(subNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception msg)
|
||||
{
|
||||
MessageBox.Show(msg.Message);//异常处理
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
123
TreeViewTc/TreeViewTc2.resx
Normal file
123
TreeViewTc/TreeViewTc2.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?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>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
36
chartTC/Properties/AssemblyInfo.cs
Normal file
36
chartTC/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("chartTC")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("chartTC")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("79fb5f64-9da8-42bf-b1e5-749aea345c7e")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
|
||||
// 方法是按如下所示使用“*”: :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
98
chartTC/chartTC.Designer.cs
generated
Normal file
98
chartTC/chartTC.Designer.cs
generated
Normal file
@ -0,0 +1,98 @@
|
||||
namespace chartTC
|
||||
{
|
||||
partial class chartTC
|
||||
{
|
||||
/// <summary>
|
||||
/// 必需的设计器变量。
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 清理所有正在使用的资源。
|
||||
/// </summary>
|
||||
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 组件设计器生成的代码
|
||||
|
||||
/// <summary>
|
||||
/// 设计器支持所需的方法 - 不要修改
|
||||
/// 使用代码编辑器修改此方法的内容。
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
|
||||
System.Windows.Forms.DataVisualization.Charting.Legend legend1 = new System.Windows.Forms.DataVisualization.Charting.Legend();
|
||||
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
|
||||
this.chart1 = new System.Windows.Forms.DataVisualization.Charting.Chart();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.clearAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// chart1
|
||||
//
|
||||
chartArea1.Name = "ChartArea1";
|
||||
this.chart1.ChartAreas.Add(chartArea1);
|
||||
this.chart1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
legend1.Name = "Legend1";
|
||||
this.chart1.Legends.Add(legend1);
|
||||
this.chart1.Location = new System.Drawing.Point(0, 0);
|
||||
this.chart1.Name = "chart1";
|
||||
series1.ChartArea = "ChartArea1";
|
||||
series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
|
||||
series1.Legend = "Legend1";
|
||||
series1.Name = "Series1";
|
||||
this.chart1.Series.Add(series1);
|
||||
this.chart1.Size = new System.Drawing.Size(800, 450);
|
||||
this.chart1.TabIndex = 0;
|
||||
this.chart1.Text = "chart1";
|
||||
this.chart1.Click += new System.EventHandler(this.chart1_Click);
|
||||
this.chart1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseClick);
|
||||
this.chart1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseDoubleClick);
|
||||
this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseMove);
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.clearAllToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(121, 26);
|
||||
//
|
||||
// clearAllToolStripMenuItem
|
||||
//
|
||||
this.clearAllToolStripMenuItem.Name = "clearAllToolStripMenuItem";
|
||||
this.clearAllToolStripMenuItem.Size = new System.Drawing.Size(120, 22);
|
||||
this.clearAllToolStripMenuItem.Text = "ClearAll";
|
||||
this.clearAllToolStripMenuItem.Click += new System.EventHandler(this.clearAllToolStripMenuItem_Click);
|
||||
//
|
||||
// chartTC
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.chart1);
|
||||
this.Name = "chartTC";
|
||||
this.Size = new System.Drawing.Size(800, 450);
|
||||
this.Load += new System.EventHandler(this.chartTC_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public System.Windows.Forms.DataVisualization.Charting.Chart chart1;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem clearAllToolStripMenuItem;
|
||||
}
|
||||
}
|
450
chartTC/chartTC.cs
Normal file
450
chartTC/chartTC.cs
Normal file
@ -0,0 +1,450 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
using System.Collections;
|
||||
|
||||
namespace chartTC
|
||||
{
|
||||
public delegate void clickEventHandler(Stack name, Stack x, Stack y);
|
||||
|
||||
public partial class chartTC: UserControl
|
||||
{
|
||||
public chartTC()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void chart1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void chartTC_Load(object sender, EventArgs e)
|
||||
{
|
||||
chart1.Series.Clear();
|
||||
//ChartHelper.AddSeries(chart1, "曲线图", SeriesChartType.Line, Color.Red, Color.Red);
|
||||
//ChartHelper.SetTitle(chart1, "sif", new Font("微软雅黑", 12), Docking.Bottom, Color.White);
|
||||
ChartHelper.SetStyle(chart1, Color.Transparent, Color.White);
|
||||
//ChartHelper.SetLegend(chart1, Docking.Top, StringAlignment.Center, Color.Transparent, Color.White);
|
||||
//ChartHelper.SetXY(chart1, "波长", "值", StringAlignment.Far, Color.Black, Color.Black, AxisArrowStyle.None/*AxisArrowStyle.SharpTriangle*/, 10, 5);
|
||||
ChartHelper.SetMajorGrid(chart1, Color.Gray, 20, 2);
|
||||
|
||||
|
||||
//chart1.GetToolTipText += new EventHandler<ToolTipEventArgs>(chart_GetToolTipText);//https://bbs.csdn.net/topics/390754014
|
||||
|
||||
|
||||
chart1.ChartAreas[0].CursorX.Interval = 0;
|
||||
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
|
||||
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
|
||||
}
|
||||
|
||||
void chart_GetToolTipText(object sender, ToolTipEventArgs e)
|
||||
{
|
||||
if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint)
|
||||
{
|
||||
int i = e.HitTestResult.PointIndex;
|
||||
DataPoint dp = e.HitTestResult.Series.Points[i];
|
||||
e.Text = string.Format("{1:F3}", dp.XValue, dp.YValues[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Point? prevPosition = null;
|
||||
ToolTip tooltip = new ToolTip();
|
||||
void chart1_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var pos = e.Location;
|
||||
if (prevPosition.HasValue && pos == prevPosition.Value)
|
||||
return;
|
||||
tooltip.RemoveAll();
|
||||
prevPosition = pos;
|
||||
|
||||
var results = chart1.HitTest(pos.X, pos.Y, false, ChartElementType.DataPoint);
|
||||
|
||||
//double XVuale = chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.X);
|
||||
|
||||
//chart1.Series[0].
|
||||
|
||||
//tooltip.Show("X=" + prop.AxisLabel + ", Y=" + prop.YValues[0], this.chart1, pos.X, pos.Y - 15);
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
if (result.ChartElementType == ChartElementType.DataPoint)
|
||||
{
|
||||
var prop = result.Object as DataPoint;
|
||||
if (prop != null)
|
||||
{
|
||||
var pointXPixel = result.ChartArea.AxisX.ValueToPixelPosition(prop.XValue);
|
||||
var pointYPixel = result.ChartArea.AxisY.ValueToPixelPosition(prop.YValues[0]);
|
||||
|
||||
// check if the cursor is really close to the point (2 pixels around the point)
|
||||
//if (Math.Abs(pos.X - pointXPixel) < 2 &&
|
||||
// Math.Abs(pos.Y - pointYPixel) < 2)
|
||||
//{
|
||||
// tooltip.Show("X=" + prop.XValue + ", Y=" + prop.YValues[0], this.chart1,
|
||||
// pos.X, pos.Y - 15);
|
||||
//}
|
||||
|
||||
tooltip.Show("X=" + prop.AxisLabel + ", Y=" + prop.YValues[0], this.chart1, pos.X, pos.Y - 15);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void chart_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
//labX.Text = e.X.ToString();
|
||||
//labY.Text = e.Y.ToString();
|
||||
|
||||
//if (e.HitTestResult.ChartElementType == ChartElementType.DataPoint)
|
||||
//{
|
||||
// int i = e.HitTestResult.PointIndex;
|
||||
// DataPoint dp = e.HitTestResult.Series.Points[i];
|
||||
// e.Text = string.Format("{1:F3}", dp.XValue, dp.YValues[0]);
|
||||
//}
|
||||
|
||||
|
||||
//ChartHitInfo hitInfo = chartControl4.CalcHitInfo(e.Location);
|
||||
//if (hitInfo.SeriesPoint != null)
|
||||
//{
|
||||
// MessageBox.Show(hitInfo.SeriesPoint.Values[0].ToString());
|
||||
//}
|
||||
}
|
||||
|
||||
private void chart_Wave1_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
HitTestResult myTestResult = chart1.HitTest(e.X, e.Y);
|
||||
if (myTestResult.ChartElementType == ChartElementType.DataPoint)
|
||||
{
|
||||
this.Cursor = Cursors.Cross;
|
||||
int i = myTestResult.PointIndex;
|
||||
DataPoint dp = myTestResult.Series.Points[i];
|
||||
|
||||
double doubleXValue = (dp.XValue);
|
||||
double doubleYValue = dp.YValues[0];
|
||||
//自我实现值的显示
|
||||
MessageBox.Show(doubleYValue.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public event clickEventHandler clickPointEvent;
|
||||
private void chart1_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (chart1.Series.Count == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
//var collection = chart1.Series.Select(series => series.Points.Where(point => point.XValue == 0).ToList()).ToList();//????????????????????????????????????????????????????????
|
||||
//chart1.Series.ElementAt
|
||||
|
||||
|
||||
|
||||
////方式1:遍历x坐标处的所有y坐标
|
||||
//var pos = e.Location;
|
||||
|
||||
//var yAxis = chart1.ChartAreas[0].AxisY;
|
||||
//int yMin = (int)yAxis.ValueToPixelPosition(yAxis.Maximum) - 1;
|
||||
//int yMax = (int)yAxis.ValueToPixelPosition(yAxis.Minimum);
|
||||
|
||||
//for (int i = yMin; i < yMax + 1; i++)
|
||||
//{
|
||||
// var results = chart1.HitTest(pos.X, pos.Y, true, ChartElementType.DataPoint);
|
||||
|
||||
// foreach (var result in results)
|
||||
// {
|
||||
// if (result.ChartElementType == ChartElementType.DataPoint)
|
||||
// {
|
||||
// var prop = result.Object as DataPoint;
|
||||
// if (prop != null)
|
||||
// {
|
||||
// var pointXPixel = result.ChartArea.AxisX.ValueToPixelPosition(prop.XValue);
|
||||
// var pointYPixel = result.ChartArea.AxisY.ValueToPixelPosition(prop.YValues[0]);
|
||||
|
||||
// int b = 1;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//方式2:
|
||||
double cursorPos = chart1.ChartAreas[0].CursorX.Position;
|
||||
|
||||
var xAxis = chart1.ChartAreas[0].AxisX;
|
||||
|
||||
double XVuale1 = chart1.ChartAreas[0].AxisX.ValueToPixelPosition(e.X);
|
||||
double XVuale2 = chart1.ChartAreas[0].AxisX.GetPosition(e.X);
|
||||
|
||||
double XVuale3 = Math.Round(chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.X));
|
||||
|
||||
if (XVuale3-1 < xAxis.Minimum)//XVuale3-1:因为在chart上绘制的曲线的第一个点的x坐标为1而不是0;
|
||||
XVuale3 = 1;
|
||||
else if (chart1.Series[0].Points.Count - 1 < XVuale3 - 1)
|
||||
XVuale3= chart1.Series[0].Points.Count;
|
||||
|
||||
chart1.ChartAreas[0].CursorX.Position = XVuale3;
|
||||
|
||||
Stack name = new Stack();
|
||||
Stack x = new Stack();
|
||||
Stack y = new Stack();
|
||||
for (int i = 0; i < chart1.Series.Count; i++)
|
||||
{
|
||||
DataPoint p1 = chart1.Series[i].Points.ElementAt((int)XVuale3 - 1);
|
||||
|
||||
name.Push(chart1.Series[i].Name);
|
||||
x.Push(p1.AxisLabel);
|
||||
y.Push(p1.YValues[0]);
|
||||
}
|
||||
|
||||
if(clickPointEvent != null)
|
||||
clickPointEvent(name, x, y);
|
||||
}
|
||||
else if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
contextMenuStrip1.Show(chart1, e.X, e.Y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private double calcCursorGraphX(int clientX)
|
||||
{
|
||||
var xAxis = chart1.ChartAreas[0].AxisX;
|
||||
int xRight = (int)xAxis.ValueToPixelPosition(xAxis.Maximum) - 1;
|
||||
int xLeft = (int)xAxis.ValueToPixelPosition(xAxis.Minimum);
|
||||
|
||||
if (clientX > xRight)
|
||||
{
|
||||
return xAxis.Maximum;
|
||||
}
|
||||
else if (clientX < xLeft)
|
||||
{
|
||||
return xAxis.Minimum;
|
||||
}
|
||||
else
|
||||
{
|
||||
return xAxis.PixelPositionToValue(clientX);
|
||||
}
|
||||
}
|
||||
|
||||
//private int nearestPreceedingValue(double x)
|
||||
//{
|
||||
// var bpData = chart1.Series[0].Points;
|
||||
// int bpIndex = bpData.BinarySearch(x, (xVal, point) => Math.Sign(x - point.XValue));
|
||||
|
||||
// if (bpIndex < 0)
|
||||
// {
|
||||
// bpIndex = ~bpIndex; // BinarySearch() returns the index of the next element LARGER than the target.
|
||||
// bpIndex = Math.Max(0, bpIndex - 1); // We want the value of the previous element, so we must decrement the returned index.
|
||||
// } // If this is before the start of the graph, use the first valid data point.
|
||||
|
||||
// return bpIndex;
|
||||
//}
|
||||
|
||||
private void clearAllToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
chart1.Series.Clear();
|
||||
}
|
||||
|
||||
public void clearAll()
|
||||
{
|
||||
chart1.Series.Clear();
|
||||
}
|
||||
|
||||
private Color ss()
|
||||
{
|
||||
int iSeed = 10;
|
||||
Random ro = new Random(10);
|
||||
long tick = DateTime.Now.Ticks;
|
||||
Random ran = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
|
||||
|
||||
int R = ran.Next(255);
|
||||
int G = ran.Next(255);
|
||||
int B = ran.Next(255);
|
||||
B = (R + G > 400) ? R + G - 400 : B;//0 : 380 - R - G;
|
||||
B = (B > 255) ? 255 : B;
|
||||
return Color.FromArgb(R, G, B);
|
||||
|
||||
|
||||
|
||||
//return or.FromArgb(random.Next(255), random.Next(255), random.Next(255));
|
||||
}
|
||||
|
||||
public Color GetRandomColor()
|
||||
{
|
||||
Random RandomNum_First = new Random((int)DateTime.Now.Ticks);
|
||||
// 对于C#的随机数,没什么好说的
|
||||
System.Threading.Thread.Sleep(RandomNum_First.Next(50));
|
||||
Random RandomNum_Sencond = new Random((int)DateTime.Now.Ticks);
|
||||
|
||||
// 为了在白色背景上显示,尽量生成深色
|
||||
int int_Red = RandomNum_First.Next(256);
|
||||
int int_Green = RandomNum_Sencond.Next(256);
|
||||
int int_Blue = (int_Red + int_Green > 400) ? 0 : 400 - int_Red - int_Green;
|
||||
int_Blue = (int_Blue > 255) ? 255 : int_Blue;
|
||||
|
||||
return Color.FromArgb(int_Red, int_Green, int_Blue);
|
||||
}
|
||||
|
||||
public void addSeries(string[] x, double[] y,string name)
|
||||
{
|
||||
int count = chart1.Series.Count;
|
||||
|
||||
//ChartHelper.AddSeries(chart1, name, SeriesChartType.Line, Color.Green, Color.Red, false);
|
||||
//ChartHelper.AddSeries(chart1, name, SeriesChartType.Line, ss(), ss(), false);
|
||||
ChartHelper.AddSeries(chart1, name, SeriesChartType.Line, GetRandomColor(), GetRandomColor(), false);
|
||||
|
||||
chart1.Series[count].Points.DataBindXY(x, y);
|
||||
//chart1.Series[count].Points.DataBindY(y);
|
||||
}
|
||||
|
||||
private void chart1_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
//Chart chart1 = sender as Chart;
|
||||
//右键恢复事件
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
chart1.ChartAreas[0].AxisX.ScaleView.ZoomReset(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//https://blog.csdn.net/boxuming/article/details/89678159?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-4.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-4.pc_relevant_default&utm_relevant_index=9
|
||||
public class ChartHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// Name:添加序列
|
||||
/// Author:by boxuming 2019-04-28 13:59
|
||||
/// </summary>
|
||||
/// <param name="chart">图表对象</param>
|
||||
/// <param name="seriesName">序列名称</param>
|
||||
/// <param name="chartType">图表类型</param>
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="markColor">标记点颜色</param>
|
||||
/// <param name="showValue">是否显示数值</param>
|
||||
public static void AddSeries(Chart chart, string seriesName, SeriesChartType chartType, Color color, Color markColor, bool showValue = false)
|
||||
{
|
||||
chart.Series.Add(seriesName);
|
||||
chart.Series[seriesName].ChartType = chartType;
|
||||
chart.Series[seriesName].Color = color;
|
||||
|
||||
if (showValue)
|
||||
{
|
||||
chart.Series[seriesName].IsValueShownAsLabel = true;
|
||||
chart.Series[seriesName].MarkerStyle = MarkerStyle.Circle;
|
||||
chart.Series[seriesName].MarkerColor = markColor;
|
||||
chart.Series[seriesName].LabelForeColor = color;
|
||||
chart.Series[seriesName].LabelAngle = -90;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name:设置标题
|
||||
/// Author:by boxuming 2019-04-28 14:25
|
||||
/// </summary>
|
||||
/// <param name="chart">图表对象</param>
|
||||
/// <param name="chartName">图表名称</param>
|
||||
public static void SetTitle(Chart chart, string chartName, Font font, Docking docking, Color foreColor)
|
||||
{
|
||||
chart.Titles.Add(chartName);
|
||||
chart.Titles[0].Font = font;
|
||||
chart.Titles[0].Docking = docking;
|
||||
chart.Titles[0].ForeColor = foreColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name:设置样式
|
||||
/// Author:by boxuming 2019-04-23 14:04
|
||||
/// </summary>
|
||||
/// <param name="chart">图表对象</param>
|
||||
/// <param name="backColor">背景颜色</param>
|
||||
/// <param name="foreColor">字体颜色</param>
|
||||
public static void SetStyle(Chart chart, Color backColor, Color foreColor)
|
||||
{
|
||||
chart.BackColor = backColor;
|
||||
chart.ChartAreas[0].BackColor = backColor;
|
||||
chart.ForeColor = Color.Red;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name:设置图例
|
||||
/// Author:by boxuming 2019-04-23 14:30
|
||||
/// </summary>
|
||||
/// <param name="chart">图表对象</param>
|
||||
/// <param name="docking">停靠位置</param>
|
||||
/// <param name="align">对齐方式</param>
|
||||
/// <param name="backColor">背景颜色</param>
|
||||
/// <param name="foreColor">字体颜色</param>
|
||||
public static void SetLegend(Chart chart, Docking docking, StringAlignment align, Color backColor, Color foreColor)
|
||||
{
|
||||
chart.Legends[0].Docking = docking;
|
||||
chart.Legends[0].Alignment = align;
|
||||
chart.Legends[0].BackColor = backColor;
|
||||
chart.Legends[0].ForeColor = foreColor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name:设置XY轴
|
||||
/// Author:by boxuming 2019-04-23 14:35
|
||||
/// </summary>
|
||||
/// <param name="chart">图表对象</param>
|
||||
/// <param name="xTitle">X轴标题</param>
|
||||
/// <param name="yTitle">Y轴标题</param>
|
||||
/// <param name="align">坐标轴标题对齐方式</param>
|
||||
/// <param name="foreColor">坐标轴字体颜色</param>
|
||||
/// <param name="lineColor">坐标轴颜色</param>
|
||||
/// <param name="arrowStyle">坐标轴箭头样式</param>
|
||||
/// <param name="xInterval">X轴的间距</param>
|
||||
/// <param name="yInterval">Y轴的间距</param>
|
||||
public static void SetXY(Chart chart, string xTitle, string yTitle, StringAlignment align, Color foreColor, Color lineColor, AxisArrowStyle arrowStyle, double xInterval, double yInterval)
|
||||
{
|
||||
chart.ChartAreas[0].AxisX.Title = xTitle;
|
||||
chart.ChartAreas[0].AxisY.Title = yTitle;
|
||||
chart.ChartAreas[0].AxisX.TitleAlignment = align;
|
||||
chart.ChartAreas[0].AxisY.TitleAlignment = align;
|
||||
chart.ChartAreas[0].AxisX.TitleForeColor = foreColor;
|
||||
chart.ChartAreas[0].AxisY.TitleForeColor = foreColor;
|
||||
chart.ChartAreas[0].AxisX.LabelStyle = new LabelStyle() { ForeColor = foreColor };
|
||||
chart.ChartAreas[0].AxisY.LabelStyle = new LabelStyle() { ForeColor = foreColor };
|
||||
chart.ChartAreas[0].AxisX.LineColor = lineColor;
|
||||
chart.ChartAreas[0].AxisY.LineColor = lineColor;
|
||||
chart.ChartAreas[0].AxisX.ArrowStyle = arrowStyle;
|
||||
chart.ChartAreas[0].AxisY.ArrowStyle = arrowStyle;
|
||||
//chart.ChartAreas[0].AxisX.Interval = xInterval;
|
||||
//chart.ChartAreas[0].AxisY.Interval = yInterval;
|
||||
chart.ChartAreas[0].AxisY.IsStartedFromZero = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name:设置网格
|
||||
/// Author:by boxuming 2019-04-23 14:55
|
||||
/// </summary>
|
||||
/// <param name="chart">图表对象</param>
|
||||
/// <param name="lineColor">网格线颜色</param>
|
||||
/// <param name="xInterval">X轴网格的间距</param>
|
||||
/// <param name="yInterval">Y轴网格的间距</param>
|
||||
public static void SetMajorGrid(Chart chart, Color lineColor, double xInterval, double yInterval)
|
||||
{
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.LineColor = lineColor;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.LineColor = lineColor;
|
||||
chart.ChartAreas[0].AxisX.MajorGrid.Interval = xInterval;
|
||||
chart.ChartAreas[0].AxisY.MajorGrid.Interval = yInterval;
|
||||
}
|
||||
}
|
||||
}
|
61
chartTC/chartTC.csproj
Normal file
61
chartTC/chartTC.csproj
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{79FB5F64-9DA8-42BF-B1E5-749AEA345C7E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>chartTC</RootNamespace>
|
||||
<AssemblyName>chartTC</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Windows.Forms.DataVisualization" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="chartTC.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="chartTC.Designer.cs">
|
||||
<DependentUpon>chartTC.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="chartTC.resx">
|
||||
<DependentUpon>chartTC.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
123
chartTC/chartTC.resx
Normal file
123
chartTC/chartTC.resx
Normal file
@ -0,0 +1,123 @@
|
||||
<?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>
|
||||
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
BIN
easySif安装教程.docx
BIN
easySif安装教程.docx
Binary file not shown.
BIN
ico/EasySif_logo.ico
Normal file
BIN
ico/EasySif_logo.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
BIN
ico/EasySif_logo1.png
Normal file
BIN
ico/EasySif_logo1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
ico/IRIS LOG.jpg
Normal file
BIN
ico/IRIS LOG.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 661 KiB |
BIN
ico/IRIS LOG2.png
Normal file
BIN
ico/IRIS LOG2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
147
mainProgram/AboutWindows.Designer.cs
generated
Normal file
147
mainProgram/AboutWindows.Designer.cs
generated
Normal 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;
|
||||
}
|
||||
}
|
26
mainProgram/AboutWindows.cs
Normal file
26
mainProgram/AboutWindows.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
1316
mainProgram/AboutWindows.resx
Normal file
1316
mainProgram/AboutWindows.resx
Normal file
File diff suppressed because it is too large
Load Diff
7
mainProgram/Form1.Designer.cs
generated
7
mainProgram/Form1.Designer.cs
generated
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,19 @@ namespace mainProgram
|
||||
}
|
||||
|
||||
|
||||
private void ss()
|
||||
private void SetProjectNameAndProjectPath()
|
||||
{
|
||||
//PrejectTreeView
|
||||
this.Text = this.Text + "-" + mProjectManager.ProjectName;
|
||||
this.projectPath_toolStripStatusLabel.Text = this.projectPath_toolStripStatusLabel.Text + mProjectManager.ProjectPath;
|
||||
}
|
||||
|
||||
private void ClearProjectNameAndProjectPath()
|
||||
{
|
||||
int index = this.Text.IndexOf(mProjectManager.ProjectName);
|
||||
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 +133,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 +151,12 @@ namespace mainProgram
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时,2rad文件夹为空,就不能打开算法窗口
|
||||
{
|
||||
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
SVDWindows w = new SVDWindows(mProjectManager, "svd");
|
||||
//w.TransferEvent += RecieveProjectManager;
|
||||
|
||||
@ -154,6 +175,12 @@ namespace mainProgram
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时,2rad文件夹为空,就不能打开算法窗口
|
||||
{
|
||||
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
SVDWindows w = new SVDWindows(mProjectManager, "doas");
|
||||
//w.TransferEvent += RecieveProjectManager;
|
||||
|
||||
@ -172,6 +199,12 @@ namespace mainProgram
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时,2rad文件夹为空,就不能打开算法窗口
|
||||
{
|
||||
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
SVDWindows w = new SVDWindows(mProjectManager, "sfm");
|
||||
//w.TransferEvent += RecieveProjectManager;
|
||||
|
||||
@ -190,6 +223,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 +247,12 @@ namespace mainProgram
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时,2rad文件夹为空,就不能打开算法窗口
|
||||
{
|
||||
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
SVDWindows w = new SVDWindows(mProjectManager, "sfld");
|
||||
//w.TransferEvent += RecieveProjectManager;
|
||||
|
||||
@ -226,6 +271,12 @@ namespace mainProgram
|
||||
return;
|
||||
}
|
||||
|
||||
if (mProjectManager.GetDateFolderCount() == 0)//当没有做福亮度校正时,2rad文件夹为空,就不能打开算法窗口
|
||||
{
|
||||
MessageBox.Show(this, "请先进行预处理-福亮度校正!", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
SVDWindows w = new SVDWindows(mProjectManager, "3fld");
|
||||
//w.TransferEvent += RecieveProjectManager;
|
||||
|
||||
@ -391,6 +442,7 @@ namespace mainProgram
|
||||
|
||||
private void main_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
treeViewTc21.DeleteEvent += DeleteFiles;
|
||||
treeViewTc21.PlotSifEvent += PlotSif;
|
||||
treeViewTc21.SaveAsEvent += SaveAs;
|
||||
@ -398,6 +450,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 +527,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 +673,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 +801,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 +870,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 +884,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
46
mainProgram/Form2.Designer.cs
generated
Normal 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
20
mainProgram/Form2.cs
Normal 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
120
mainProgram/Form2.resx
Normal 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>
|
58
mainProgram/NewProjectWindow.Designer.cs
generated
58
mainProgram/NewProjectWindow.Designer.cs
generated
@ -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();
|
||||
|
@ -34,6 +34,15 @@ namespace mainProgram
|
||||
string projectPath = ProjectPathTextBox.Text;
|
||||
string calFilePath = CalFilePathTextBox.Text;
|
||||
|
||||
//当创建工程时,工程文件夹必须为空
|
||||
DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(projectPath));
|
||||
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos();
|
||||
if (fileinfo.Length != 0)
|
||||
{
|
||||
MessageBox.Show(this, "工程文件夹中有内容", "提示");
|
||||
return;
|
||||
}
|
||||
|
||||
if (dataPath != null && dataPath.Length == 0)
|
||||
{
|
||||
MessageBox.Show(this, "数据文件夹路径不能为空", "提示");
|
||||
@ -50,15 +59,35 @@ namespace mainProgram
|
||||
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 +110,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
30
mainProgram/OpenProjectWindow.Designer.cs
generated
30
mainProgram/OpenProjectWindow.Designer.cs
generated
@ -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();
|
||||
|
@ -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
@ -9,7 +9,6 @@ using System.Windows.Forms;
|
||||
|
||||
namespace mainProgram
|
||||
{
|
||||
public delegate void UpdateProgressBarInfoDelegate(int ipos, string vinfo);//申明委托类型:用于进度条的更新
|
||||
public delegate void RadCompleteDelegate();//申明委托类型:福亮度完成后调用的委托
|
||||
|
||||
public class DateFolder : IComparable//接口
|
||||
@ -170,11 +169,17 @@ namespace mainProgram
|
||||
|
||||
public class ProjectManager
|
||||
{
|
||||
public ProjectManager(string xx)
|
||||
public ProjectManager(string projectFile)
|
||||
{
|
||||
mProjectPath = xx;
|
||||
string sourceFileName = Path.GetFileName(projectFile);//获取文件名
|
||||
mProjectFile = projectFile;
|
||||
mProjectPath = Path.GetDirectoryName(projectFile);
|
||||
mProjectName = Path.GetFileNameWithoutExtension(projectFile);
|
||||
}
|
||||
|
||||
private string mProjectFile;
|
||||
private string mProjectName;
|
||||
|
||||
private string mProjectPath;
|
||||
private string mMetadataPath;
|
||||
private string mRawPath;
|
||||
@ -196,6 +201,18 @@ namespace mainProgram
|
||||
}
|
||||
}
|
||||
|
||||
public string ProjectName
|
||||
{
|
||||
get
|
||||
{
|
||||
return mProjectName;
|
||||
}
|
||||
set
|
||||
{
|
||||
mProjectName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string MetadataPath
|
||||
{
|
||||
get
|
||||
@ -241,18 +258,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);//复制原始数据文件到工程结构对应文件夹
|
||||
//DelectDir(mProjectPath);//删除工程路径下的所有内容 → 应该删除此行代码,删除数据太危险
|
||||
|
||||
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 +305,7 @@ namespace mainProgram
|
||||
////删除指定节点信息
|
||||
//DeleteXmlInformation(myXMLFilePath);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool OpenProject()
|
||||
@ -285,7 +321,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 +538,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 +563,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 +574,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 +638,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)
|
||||
@ -656,138 +759,28 @@ namespace mainProgram
|
||||
}
|
||||
}
|
||||
|
||||
public int getNonLinearFileCount()
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(mMetadataPath);
|
||||
int txtFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
txtFileCount++;
|
||||
}
|
||||
}
|
||||
return txtFileCount;
|
||||
}
|
||||
|
||||
public int getCalFileCount()
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(mMetadataPath);
|
||||
int datFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
datFileCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return datFileCount;
|
||||
}
|
||||
|
||||
//如果一个委托不需要再其定义的类之外被触发,那么就可以将其转化为事件,这样可以保证它不会在外部被随意触发。
|
||||
//public UpdateProgressBarInfoDelegate UpdateProgressBarInfo;//申明委托变量
|
||||
public event UpdateProgressBarInfoDelegate UpdateProgressBarInfoEvent;//申明事件
|
||||
//public RadCompleteDelegate RadComplete;//申明委托变量
|
||||
public event RadPercentCompleteDelegate UpdateProgressBarInfoEvent;//申明事件
|
||||
public event RadCompleteDelegate RadCompleteEvent;//申明委托变量
|
||||
|
||||
private void EventRelay(int ipos, string vinfo)
|
||||
{
|
||||
UpdateProgressBarInfoEvent(ipos, vinfo);
|
||||
}
|
||||
|
||||
//处理工程中的数据
|
||||
public void Rad()
|
||||
{
|
||||
int counter = 0;
|
||||
//读取标定文件:辐射定标文件 + 非线性校正文件
|
||||
int datFileCount = getCalFileCount();
|
||||
int txtFileCount = getNonLinearFileCount();
|
||||
|
||||
CalData[] calDatas = new CalData[datFileCount];
|
||||
NonLinearData[] nonLinearDatas = new NonLinearData[txtFileCount];
|
||||
|
||||
int d1 = 0, d2 = 0;
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(mMetadataPath);
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
nonLinearDatas[d1] = ReadNonLinearFile(metaFilesPath[i]);
|
||||
d1++;
|
||||
}
|
||||
else if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
calDatas[d2] = ReadCalFile(metaFilesPath[i]);
|
||||
d2++;
|
||||
}
|
||||
}
|
||||
CalData[] calDatas;
|
||||
NonLinearData[] nonLinearDatas;
|
||||
calAndNonLinearFileReader.readCalAndNonLinearFile(mMetadataPath, out calDatas, out nonLinearDatas);
|
||||
|
||||
//对文件夹中的文件遍历处理:非线性校正 + 辐射定标
|
||||
Console.WriteLine("工程目录为" + mProjectPath);
|
||||
DelectDir(mRadPath);
|
||||
string[] sourceFilesPath = Directory.GetFileSystemEntries(mRawPath);
|
||||
|
||||
for (int i = 0; i < sourceFilesPath.Length; i++)//mRawPath下的每个日期文件夹
|
||||
{
|
||||
//构建rad中的输出文件夹
|
||||
string[] forlders = sourceFilesPath[i].Split('\\');
|
||||
string lastDirectory = forlders[forlders.Length - 1];
|
||||
string dest = Path.Combine(mRadPath, lastDirectory);
|
||||
|
||||
if (!Directory.Exists(dest))
|
||||
{
|
||||
Directory.CreateDirectory(dest);
|
||||
}
|
||||
|
||||
|
||||
string[] rawFiles = Directory.GetFileSystemEntries(Path.Combine(mRawPath, lastDirectory));
|
||||
foreach (string rawFileName in rawFiles)//日期文件夹下的每个DN值csv文件
|
||||
{
|
||||
string[] nameTmp = rawFileName.Split('\\');
|
||||
string name = nameTmp[nameTmp.Length - 1];
|
||||
|
||||
SpectralDataReaderWriter spectralDataReaderWriter = new SpectralDataReaderWriter(rawFileName);
|
||||
for (int j = 1; j <= spectralDataReaderWriter.TotalSpectralCount; j++)//处理 csv文件中的每条光谱
|
||||
{
|
||||
SpectralData spectralData = spectralDataReaderWriter.GetSpectral(j);
|
||||
|
||||
int nonLinearData_index = GetnonLinearDataIndex(spectralData, nonLinearDatas);
|
||||
int calData_index = GetCalDataIndex(spectralData, calDatas);
|
||||
|
||||
SpectralProcessor sp = new SpectralProcessor();
|
||||
|
||||
if (nonLinearData_index >= 0)//非线性校正
|
||||
{
|
||||
sp.NonLinearCorrection(nonLinearDatas[nonLinearData_index].nonLinearData, spectralData.spectral, spectralData.spectralDataLength);
|
||||
}
|
||||
if (calData_index >= 0)//福亮度转换
|
||||
{
|
||||
sp.RadCorrection(calDatas[calData_index].gain, calDatas[calData_index].exposureTime, spectralData.spectral, spectralData.exposureTime, spectralData.spectralDataLength);
|
||||
}
|
||||
spectralDataReaderWriter.UpdateSpectral(j, spectralData);
|
||||
}
|
||||
|
||||
string destFileName = Path.Combine(dest, name);
|
||||
spectralDataReaderWriter.SaveCSV(destFileName);
|
||||
|
||||
counter++;
|
||||
float tmp1 = (float)counter / (float)mCsvFileCount;
|
||||
float tmp2 = tmp1 * 100;
|
||||
|
||||
|
||||
//if (UpdateProgressBarInfo != null)//确认委托有方法
|
||||
//{
|
||||
// UpdateProgressBarInfo((int)tmp2, name + "\r\n");
|
||||
//}
|
||||
|
||||
if (UpdateProgressBarInfoEvent != null)
|
||||
{
|
||||
UpdateProgressBarInfoEvent((int)tmp2, name + "\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////福亮度转换完成后,需要做得动作
|
||||
//if (RadComplete != null)//确认委托有方法
|
||||
//{
|
||||
// RadComplete();
|
||||
//}
|
||||
SpectralProcessor sp = new SpectralProcessor();
|
||||
sp.RadPercentCompleteEvent += EventRelay;
|
||||
sp.processDirectory_dn2rad(mRawPath, mRadPath, calDatas, nonLinearDatas, true, mCsvFileCount);
|
||||
|
||||
if (RadCompleteEvent != null)//确认事件有方法可以执行
|
||||
{
|
||||
@ -796,118 +789,6 @@ namespace mainProgram
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
返回值:-1代表没有匹配项
|
||||
*/
|
||||
public int GetnonLinearDataIndex(SpectralData spectralData, NonLinearData[] nonLinearData)
|
||||
{
|
||||
for (int i = 0; i < nonLinearData.GetLength(0); i++)
|
||||
{
|
||||
if (nonLinearData[i].SN.Contains(spectralData.SN))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
返回值:-1代表没有匹配项
|
||||
*/
|
||||
public int GetCalDataIndex(SpectralData spectralData, CalData[] calData)
|
||||
{
|
||||
for (int i = 0; i < calData.GetLength(0); i++)
|
||||
{
|
||||
if (calData[i].SN.Contains(spectralData.SN) && calData[i].position==spectralData.position)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
public CalData ReadCalFile(string calFilePath)
|
||||
{
|
||||
CalData calFile;
|
||||
|
||||
string[] forlders = calFilePath.Split('\\');
|
||||
string filename = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
string[] tmp = filename.Split('_');
|
||||
calFile.SN = tmp[0];
|
||||
|
||||
calFile.SN = filename;
|
||||
calFile.position = int.Parse(tmp[tmp.Length - 1]);
|
||||
|
||||
FileStream fs2 = new FileStream(calFilePath, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fs2);
|
||||
calFile.exposureTime = br.ReadUInt32();
|
||||
calFile.temperature = br.ReadSingle();
|
||||
calFile.pixelCount = br.ReadInt32();
|
||||
calFile.waveLengthInNM = new float[calFile.pixelCount];
|
||||
calFile.gain = new double[calFile.pixelCount];
|
||||
calFile.offset = new double[calFile.pixelCount];
|
||||
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.waveLengthInNM[ii] = br.ReadSingle();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.gain[ii] = br.ReadDouble();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.offset[ii] = br.ReadDouble();
|
||||
}
|
||||
|
||||
return calFile;
|
||||
}
|
||||
|
||||
public NonLinearData ReadNonLinearFile(string nonLinearFilePath)
|
||||
{
|
||||
NonLinearData nonLinearData;
|
||||
string[] forlders = nonLinearFilePath.Split('\\');
|
||||
nonLinearData.SN = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
|
||||
int lineCount = FindMaxRowCount(nonLinearFilePath);
|
||||
nonLinearData.nonLinearData = new double[lineCount];
|
||||
|
||||
FileStream fs = new FileStream(nonLinearFilePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
string strLine = "";//记录每次读取的一行记录
|
||||
|
||||
int i = 0;
|
||||
while ((strLine = sr.ReadLine()) != null)//逐行读取CSV中的数据
|
||||
{
|
||||
nonLinearData.nonLinearData[i] = double.Parse(strLine);
|
||||
i++;
|
||||
}
|
||||
|
||||
return nonLinearData;
|
||||
}
|
||||
|
||||
public int FindMaxRowCount(string filePath)
|
||||
{
|
||||
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
|
||||
string strLine = "";
|
||||
int maxColunmCount = 0;
|
||||
|
||||
while ((strLine = sr.ReadLine()) != null)
|
||||
{
|
||||
maxColunmCount++;
|
||||
}
|
||||
|
||||
sr.Close();
|
||||
fs.Close();
|
||||
|
||||
return maxColunmCount;
|
||||
}
|
||||
|
||||
DateFolder[] df;
|
||||
public void FindTimespan()//因为此函数会递归,所以把它摘出来
|
||||
{
|
||||
@ -936,14 +817,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 +907,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
6
mainProgram/ProjectManagerWindow.Designer.cs
generated
6
mainProgram/ProjectManagerWindow.Designer.cs
generated
@ -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
80
mainProgram/Properties/Resources.Designer.cs
generated
80
mainProgram/Properties/Resources.Designer.cs
generated
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
110
mainProgram/RadCorrectionWindow.Designer.cs
generated
Normal file
110
mainProgram/RadCorrectionWindow.Designer.cs
generated
Normal 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;
|
||||
}
|
||||
}
|
87
mainProgram/RadCorrectionWindow.cs
Normal file
87
mainProgram/RadCorrectionWindow.cs
Normal file
@ -0,0 +1,87 @@
|
||||
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.UpdateProgressBarInfoEvent += UpdateWidgetInfo;//向事件中注册事件处理程序
|
||||
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)想访问它
|
||||
{
|
||||
RadPercentCompleteDelegate setpos = new RadPercentCompleteDelegate(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");
|
||||
}
|
||||
}
|
||||
}
|
1253
mainProgram/RadCorrectionWindow.resx
Normal file
1253
mainProgram/RadCorrectionWindow.resx
Normal file
File diff suppressed because it is too large
Load Diff
BIN
mainProgram/Resources/EasySif_logo1.png
Normal file
BIN
mainProgram/Resources/EasySif_logo1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.7 KiB |
BIN
mainProgram/Resources/IRIS LOG2.png
Normal file
BIN
mainProgram/Resources/IRIS LOG2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
384
mainProgram/SVDWindows.Designer.cs
generated
Normal file
384
mainProgram/SVDWindows.Designer.cs
generated
Normal 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
356
mainProgram/SVDWindows.cs
Normal 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
1253
mainProgram/SVDWindows.resx
Normal file
File diff suppressed because it is too large
Load Diff
128
mainProgram/SaveAs.Designer.cs
generated
Normal file
128
mainProgram/SaveAs.Designer.cs
generated
Normal 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
81
mainProgram/SaveAs.cs
Normal 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
1253
mainProgram/SaveAs.resx
Normal file
File diff suppressed because it is too large
Load Diff
@ -8,18 +8,10 @@ using System.IO;
|
||||
|
||||
namespace mainProgram
|
||||
{
|
||||
public delegate void RadPercentCompleteDelegate(int ipos, string vinfo);//申明委托类型:用于通知福亮度校正的进度
|
||||
|
||||
class SpectralProcessor
|
||||
{
|
||||
public void OpenNolinerData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OpenCalData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void NonLinearCorrection(double[] coefficient, double[] rawData, int bandnumber)
|
||||
{
|
||||
for (int i = 0; i < bandnumber; i++)
|
||||
@ -51,6 +43,258 @@ namespace mainProgram
|
||||
|
||||
}
|
||||
|
||||
public void DelectDir(string srcPath)
|
||||
{
|
||||
DirectoryInfo dir = new DirectoryInfo(srcPath);
|
||||
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录
|
||||
foreach (FileSystemInfo i in fileinfo)
|
||||
{
|
||||
if (i is DirectoryInfo) //判断是否文件夹
|
||||
{
|
||||
DirectoryInfo subdir = new DirectoryInfo(i.FullName);
|
||||
subdir.Delete(true); //删除子目录和文件
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Delete(i.FullName); //删除指定文件
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public event RadPercentCompleteDelegate RadPercentCompleteEvent;//申明事件
|
||||
public void processDirectory_dn2rad(string sourceDirectory, string destDirectory, CalData[] calDatas, NonLinearData[] nonLinearDatas, bool isdeleteDest = false, int CsvFileCounter = 0)//包含了工程目录结构
|
||||
{
|
||||
if(isdeleteDest)
|
||||
DelectDir(destDirectory);
|
||||
|
||||
string[] sourceFilesPath = Directory.GetFileSystemEntries(sourceDirectory);
|
||||
|
||||
int counter = 0;
|
||||
for (int i = 0; i < sourceFilesPath.Length; i++)//sourceDirectory下的每个日期文件夹
|
||||
{
|
||||
//构建rad中的输出文件夹
|
||||
string[] forlders = sourceFilesPath[i].Split('\\');
|
||||
string lastDirectory = forlders[forlders.Length - 1];
|
||||
string dest = Path.Combine(destDirectory, lastDirectory);
|
||||
|
||||
if (!Directory.Exists(dest))
|
||||
{
|
||||
Directory.CreateDirectory(dest);
|
||||
}
|
||||
|
||||
|
||||
string[] rawFiles = Directory.GetFileSystemEntries(Path.Combine(sourceDirectory, lastDirectory));
|
||||
foreach (string rawFileName in rawFiles)//日期文件夹下的每个DN值csv文件
|
||||
{
|
||||
string[] nameTmp = rawFileName.Split('\\');
|
||||
string name = nameTmp[nameTmp.Length - 1];
|
||||
|
||||
SpectralDataReaderWriter spectralDataReaderWriter = new SpectralDataReaderWriter(rawFileName);
|
||||
for (int j = 1; j <= spectralDataReaderWriter.TotalSpectralCount; j++)//处理 csv文件中的每条光谱
|
||||
{
|
||||
SpectralData spectralData = spectralDataReaderWriter.GetSpectral(j);
|
||||
|
||||
int nonLinearData_index = calAndNonLinearFileReader.GetnonLinearDataIndex(spectralData, nonLinearDatas);
|
||||
int calData_index = calAndNonLinearFileReader.GetCalDataIndex(spectralData, calDatas);
|
||||
|
||||
if (nonLinearData_index >= 0)//非线性校正
|
||||
{
|
||||
NonLinearCorrection(nonLinearDatas[nonLinearData_index].nonLinearData, spectralData.spectral, spectralData.spectralDataLength);
|
||||
}
|
||||
if (calData_index >= 0)//福亮度转换
|
||||
{
|
||||
RadCorrection(calDatas[calData_index].gain, calDatas[calData_index].exposureTime, spectralData.spectral, spectralData.exposureTime, spectralData.spectralDataLength);
|
||||
}
|
||||
spectralDataReaderWriter.UpdateSpectral(j, spectralData);
|
||||
}
|
||||
|
||||
string destFileName = Path.Combine(dest, name);
|
||||
spectralDataReaderWriter.SaveCSV(destFileName);
|
||||
|
||||
counter++;
|
||||
|
||||
if (CsvFileCounter != 0)
|
||||
{
|
||||
float tmp1 = (float)counter / (float)CsvFileCounter;
|
||||
float tmp2 = tmp1 * 100;
|
||||
|
||||
if (RadPercentCompleteEvent != null)
|
||||
{
|
||||
RadPercentCompleteEvent((int)tmp2, name + "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class calAndNonLinearFileReader
|
||||
{
|
||||
static private int FindMaxRowCount(string filePath)
|
||||
{
|
||||
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
|
||||
string strLine = "";
|
||||
int maxColunmCount = 0;
|
||||
|
||||
while ((strLine = sr.ReadLine()) != null)
|
||||
{
|
||||
maxColunmCount++;
|
||||
}
|
||||
|
||||
sr.Close();
|
||||
fs.Close();
|
||||
|
||||
return maxColunmCount;
|
||||
}
|
||||
|
||||
static public NonLinearData ReadNonLinearFile(string nonLinearFilePath)
|
||||
{
|
||||
NonLinearData nonLinearData;
|
||||
string[] forlders = nonLinearFilePath.Split('\\');
|
||||
nonLinearData.SN = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
|
||||
int lineCount = FindMaxRowCount(nonLinearFilePath);
|
||||
nonLinearData.nonLinearData = new double[lineCount];
|
||||
|
||||
FileStream fs = new FileStream(nonLinearFilePath, FileMode.Open, FileAccess.Read);
|
||||
StreamReader sr = new StreamReader(fs);
|
||||
string strLine = "";//记录每次读取的一行记录
|
||||
|
||||
int i = 0;
|
||||
while ((strLine = sr.ReadLine()) != null)//逐行读取CSV中的数据
|
||||
{
|
||||
nonLinearData.nonLinearData[i] = double.Parse(strLine);
|
||||
i++;
|
||||
}
|
||||
|
||||
return nonLinearData;
|
||||
}
|
||||
|
||||
static public CalData ReadCalFile(string calFilePath)
|
||||
{
|
||||
CalData calFile;
|
||||
|
||||
string[] forlders = calFilePath.Split('\\');
|
||||
string filename = forlders[forlders.Length - 1].Split('.')[0];
|
||||
|
||||
string[] tmp = filename.Split('_');
|
||||
calFile.SN = tmp[0];
|
||||
|
||||
calFile.SN = filename;
|
||||
calFile.position = int.Parse(tmp[tmp.Length - 1]);
|
||||
|
||||
FileStream fs2 = new FileStream(calFilePath, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader br = new BinaryReader(fs2);
|
||||
calFile.exposureTime = br.ReadUInt32();
|
||||
calFile.temperature = br.ReadSingle();
|
||||
calFile.pixelCount = br.ReadInt32();
|
||||
calFile.waveLengthInNM = new float[calFile.pixelCount];
|
||||
calFile.gain = new double[calFile.pixelCount];
|
||||
calFile.offset = new double[calFile.pixelCount];
|
||||
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.waveLengthInNM[ii] = br.ReadSingle();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.gain[ii] = br.ReadDouble();
|
||||
}
|
||||
for (int ii = 0; ii < calFile.pixelCount; ii++)
|
||||
{
|
||||
calFile.offset[ii] = br.ReadDouble();
|
||||
}
|
||||
|
||||
return calFile;
|
||||
}
|
||||
|
||||
static public int getNonLinearFileCount(string directory)
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(directory);
|
||||
int txtFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
txtFileCount++;
|
||||
}
|
||||
}
|
||||
return txtFileCount;
|
||||
}
|
||||
|
||||
static public int getCalFileCount(string directory)//
|
||||
{
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(directory);
|
||||
int datFileCount = 0;
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)//
|
||||
{
|
||||
if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
datFileCount++;
|
||||
}
|
||||
}
|
||||
|
||||
return datFileCount;
|
||||
}
|
||||
|
||||
static public bool readCalAndNonLinearFile(string directory, out CalData[] calDatas, out NonLinearData[] nonLinearDatas)
|
||||
{
|
||||
int datFileCount = getCalFileCount(directory);
|
||||
int txtFileCount = getNonLinearFileCount(directory);
|
||||
|
||||
calDatas = new CalData[datFileCount];
|
||||
nonLinearDatas = new NonLinearData[txtFileCount];
|
||||
|
||||
int d1 = 0, d2 = 0;
|
||||
string[] metaFilesPath = Directory.GetFileSystemEntries(directory);
|
||||
for (int i = 0; i < metaFilesPath.Length; i++)
|
||||
{
|
||||
if (metaFilesPath[i].Contains("nonLinear"))
|
||||
{
|
||||
nonLinearDatas[d1] = ReadNonLinearFile(metaFilesPath[i]);
|
||||
d1++;
|
||||
}
|
||||
else if (metaFilesPath[i].Contains("cal"))
|
||||
{
|
||||
calDatas[d2] = ReadCalFile(metaFilesPath[i]);
|
||||
d2++;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//返回值:-1代表没有匹配项
|
||||
static public int GetnonLinearDataIndex(SpectralData spectralData, NonLinearData[] nonLinearData)
|
||||
{
|
||||
for (int i = 0; i < nonLinearData.GetLength(0); i++)
|
||||
{
|
||||
if (nonLinearData[i].SN.Contains(spectralData.SN))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//返回值:-1代表没有匹配项
|
||||
static public int GetCalDataIndex(SpectralData spectralData, CalData[] calData)
|
||||
{
|
||||
for (int i = 0; i < calData.GetLength(0); i++)
|
||||
{
|
||||
if (calData[i].SN.Contains(spectralData.SN) && calData[i].position == spectralData.position)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public enum DataStatus { NoData, Raw, NonLinearCorrection, Rad, Sif };
|
||||
|
Binary file not shown.
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
Binary file not shown.
@ -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>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
a13c43c237bef274b47edaf091a7574045af724e
|
@ -1,36 +0,0 @@
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\mainProgram.exe.config
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\mainProgram.exe
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\mainProgram.pdb
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.Properties.Resources.resources
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.csproj.GenerateResource.cache
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.csproj.CoreCompileInputs.cache
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.exe
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.pdb
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.main.resources
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.NewProjectWindow.resources
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.ProjectManagerWindow.resources
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.OpenProjectWindow.resources
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.Modules.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.SQLite.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.Wpf.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\Microsoft.Dynamic.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\Microsoft.Scripting.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\Microsoft.Scripting.Metadata.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.xml
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.Modules.xml
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.SQLite.xml
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\IronPython.Wpf.xml
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\Microsoft.Dynamic.xml
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\Microsoft.Scripting.xml
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\Microsoft.Scripting.Metadata.xml
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.csproj.CopyComplete
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.RadCorrectionWindow.resources
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.SVDWindows.resources
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.csproj.ResolveComReference.cache
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\TreeViewTc.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\TreeViewTc.pdb
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.csprojAssemblyReference.cache
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\chartTC.dll
|
||||
D:\csharp_vs2017\easySif\mainProgram\bin\Debug\chartTC.pdb
|
||||
D:\csharp_vs2017\easySif\mainProgram\obj\Debug\mainProgram.SaveAsWindow.resources
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
mainProgram/packages.config
Normal file
5
mainProgram/packages.config
Normal 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>
|
Reference in New Issue
Block a user