📄 formmain.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
using System.Threading;
using mathfunsharp;
using System.Drawing.Drawing2D;
using OWNERDATASET;
using OWNERGRID;
using System.Xml;
using System.IO;
//using Office;
using NameSpacePetroGA;
using System.Diagnostics;
//using Access;
namespace expert
{
/// <summary>
/// FormMain 的摘要说明。
/// </summary>
public class FormMain : System.Windows.Forms.Form
{
#region field definition
private ProbControl myControl;
private myCriGridCtrl cridg;
private myExamGridCtrl examdg;
private myResultGridCtrl resultdg;
private myTemplateGridCtrl templatedg;
//private myItemValueGridCtrl itemvaluedg;
private System.Windows.Forms.Splitter splitter1;
//protected ImageList imageListtoolbar;
private System.Windows.Forms.MainMenu mainMenu;
private System.Windows.Forms.Splitter splitter2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage critabPage;
private System.Windows.Forms.TabPage examtabPage;
private System.Windows.Forms.TabPage resulttabPage;
private System.Windows.Forms.TabPage templatetabPage;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem AboutMenu;
private YQGA myc;
#endregion
private System.Windows.Forms.TextBox output;
GAGEnomeSetting NomeS;
private TemplateMapping currTemplate;
Thread GAThread;
NameSpacePetroGA.YQGA.__Delegate_OnProgressStep OnProgressStepDelegate;
NameSpacePetroGA.YQGA.__Delegate_OnDone OnDoneDelegate;
NameSpacePetroGA.YQGA.__Delegate_OnSingleGeneration OnSingleGeneration;
public static DataTable tableFuzzyKbfResultType=null;//模糊推理的知识库
public static string strKbfSuperFile=null;//模糊推理的知识库
string SettingFile;
XmlDocument SettingXmlDoc;
private System.Windows.Forms.MenuItem menuAbortCurrentSample;
private System.Windows.Forms.MenuItem menuAbortAllSamples;
private System.Windows.Forms.MenuItem menuGA;
private System.Windows.Forms.MenuItem menuGAStart;
private System.Windows.Forms.MenuItem menuGASuspend;
private System.Windows.Forms.MenuItem menuGAResume;
private System.Windows.Forms.MenuItem menuGAAbort;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem templateReason;
private System.Windows.Forms.MenuItem templatereasonsetting;
private TemplateReasonSetting dlgTemplateReasonSetting;
private progress GAProgress;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem autocreatetemplatemdb;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuSETTING;
private System.Windows.Forms.MenuItem menuSettingEdit;
private System.Windows.Forms.MenuItem report;
private System.Windows.Forms.MenuItem dbmprint;
private System.Windows.Forms.MenuItem simpleprint;
private System.Windows.Forms.MenuItem SaveSetting;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.MenuItem SingleSampleReport;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public unsafe FormMain()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
/// imageListtoolbar = new ImageList () ;
// The default image size is 16 x 16, which sets up a larger
// image size.
// imageListtoolbar.ImageSize = new Size(16,16);
//imageListtoolbar.TransparentColor = Color.White;
// imageListtoolbar.Images.Add(Image.FromFile("btnupdate.bmp"));
NomeS=new GAGEnomeSetting();
initGA();
OnProgressStepDelegate=new NameSpacePetroGA.YQGA.__Delegate_OnProgressStep(GetProgressStep);
OnDoneDelegate=new NameSpacePetroGA.YQGA.__Delegate_OnDone(DoneReport);
OnSingleGeneration=new NameSpacePetroGA.YQGA.__Delegate_OnSingleGeneration(SingleGeneration);
}
private void initGA()
{
myc=new YQGA();
NomeS.fAdvisorBitScore =myc.AdvisorBitScore;
NomeS.fTargetBitScore=myc.TargetBitScore;
NomeS.fNegativeBitScore=myc.NegativeBitScore;
NomeS.fFullMatchScoreCoeff=myc.FullMatchScoreCoeff;
NomeS.nGenerations=myc.NnGenerations;
NomeS.nProgressStep =myc.ProgressStep;
NomeS.nPopulationSize =myc.NpopulationSize;
NomeS.nBestGenomes =myc.NnBestGenomes;
NomeS.nGAWidth =myc.Width;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
NomeS.Dispose();
base.Dispose( disposing );
}
static public FormMain aFormMain=new FormMain();
#region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.splitter1 = new System.Windows.Forms.Splitter();
this.mainMenu = new System.Windows.Forms.MainMenu();
this.menuGA = new System.Windows.Forms.MenuItem();
this.menuGAStart = new System.Windows.Forms.MenuItem();
this.menuGASuspend = new System.Windows.Forms.MenuItem();
this.menuGAResume = new System.Windows.Forms.MenuItem();
this.menuAbortCurrentSample = new System.Windows.Forms.MenuItem();
this.menuAbortAllSamples = new System.Windows.Forms.MenuItem();
this.menuGAAbort = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.templateReason = new System.Windows.Forms.MenuItem();
this.templatereasonsetting = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.autocreatetemplatemdb = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuSETTING = new System.Windows.Forms.MenuItem();
this.menuSettingEdit = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.SaveSetting = new System.Windows.Forms.MenuItem();
this.report = new System.Windows.Forms.MenuItem();
this.dbmprint = new System.Windows.Forms.MenuItem();
this.simpleprint = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.SingleSampleReport = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.AboutMenu = new System.Windows.Forms.MenuItem();
this.splitter2 = new System.Windows.Forms.Splitter();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.critabPage = new System.Windows.Forms.TabPage();
this.resulttabPage = new System.Windows.Forms.TabPage();
this.templatetabPage = new System.Windows.Forms.TabPage();
this.examtabPage = new System.Windows.Forms.TabPage();
this.output = new System.Windows.Forms.TextBox();
this.panel2.SuspendLayout();
this.tabControl1.SuspendLayout();
this.SuspendLayout();
//
// splitter1
//
this.splitter1.BackColor = System.Drawing.SystemColors.Desktop;
this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitter1.Location = new System.Drawing.Point(200, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(6, 734);
this.splitter1.TabIndex = 1;
this.splitter1.TabStop = false;
//
// mainMenu
//
this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuGA,
this.menuItem2,
this.menuItem3,
this.menuItem4,
this.report,
this.menuItem1});
//
// menuGA
//
this.menuGA.Index = 0;
this.menuGA.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuGAStart,
this.menuGASuspend,
this.menuGAResume,
this.menuAbortCurrentSample,
this.menuAbortAllSamples,
this.menuGAAbort});
this.menuGA.Text = "知识学习";
this.menuGA.Popup += new System.EventHandler(this.menuGA_Popup);
//
// menuGAStart
//
this.menuGAStart.Index = 0;
this.menuGAStart.Text = "启动遗传算法生成模板";
this.menuGAStart.Click += new System.EventHandler(this.menuGAStart_Click);
//
// menuGASuspend
//
this.menuGASuspend.Index = 1;
this.menuGASuspend.Text = "暂停(挂起)";
this.menuGASuspend.Click += new System.EventHandler(this.menuGASuspend_Click);
//
// menuGAResume
//
this.menuGAResume.Index = 2;
this.menuGAResume.Text = "恢复";
this.menuGAResume.Click += new System.EventHandler(this.menuGAResume_Click);
//
// menuAbortCurrentSample
//
this.menuAbortCurrentSample.Index = 3;
this.menuAbortCurrentSample.Text = "终止当前样本的计算";
this.menuAbortCurrentSample.Click += new System.EventHandler(this.menuAbortCurrentSample_Click);
//
// menuAbortAllSamples
//
this.menuAbortAllSamples.Index = 4;
this.menuAbortAllSamples.Text = "终止剩余样本的计算";
this.menuAbortAllSamples.Click += new System.EventHandler(this.menuAbortAllSamples_Click);
//
// menuGAAbort
//
this.menuGAAbort.Index = 5;
this.menuGAAbort.Text = "立即终止";
this.menuGAAbort.Click += new System.EventHandler(this.menuGAAbort_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.templateReason,
this.templatereasonsetting});
this.menuItem2.Text = "专家推理";
//
// templateReason
//
this.templateReason.Index = 0;
this.templateReason.Text = "模板推理";
this.templateReason.Click += new System.EventHandler(this.templateReason_Click);
//
// templatereasonsetting
//
this.templatereasonsetting.Index = 1;
this.templatereasonsetting.Text = "推理参数设置";
this.templatereasonsetting.Click += new System.EventHandler(this.templatereasonsetting_Click);
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.autocreatetemplatemdb});
this.menuItem3.Text = "工具";
//
// autocreatetemplatemdb
//
this.autocreatetemplatemdb.Index = 0;
this.autocreatetemplatemdb.Text = "自动产生模板库文件";
this.autocreatetemplatemdb.Click += new System.EventHandler(this.autocreatetemplatemdb_Click);
//
// menuItem4
//
this.menuItem4.Index = 3;
this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuSETTING,
this.menuSettingEdit,
this.menuItem6,
this.SaveSetting});
this.menuItem4.Text = "软件设置";
//
// menuSETTING
//
this.menuSETTING.Index = 0;
this.menuSETTING.Text = "装入设置文件";
this.menuSETTING.Click += new System.EventHandler(this.menuSETTING_Click);
//
// menuSettingEdit
//
this.menuSettingEdit.Index = 1;
this.menuSettingEdit.Text = "编辑设置文件";
this.menuSettingEdit.Click += new System.EventHandler(this.menuSettingEdit_Click);
//
// menuItem6
//
this.menuItem6.Index = 2;
this.menuItem6.Text = "-";
//
// SaveSetting
//
this.SaveSetting.Index = 3;
this.SaveSetting.Text = "保存当前设置";
this.SaveSetting.Click += new System.EventHandler(this.SaveSetting_Click);
//
// report
//
this.report.Index = 4;
this.report.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.dbmprint,
this.simpleprint,
this.menuItem7,
this.SingleSampleReport});
this.report.Text = "报表打印";
//
// dbmprint
//
this.dbmprint.Index = 0;
this.dbmprint.Text = "自定义输出";
this.dbmprint.Click += new System.EventHandler(this.reportprint);
//
// simpleprint
//
this.simpleprint.Index = 1;
this.simpleprint.Text = "简单输出";
this.simpleprint.Click += new System.EventHandler(this.simpleprint_Click);
//
// menuItem7
//
this.menuItem7.Index = 2;
this.menuItem7.Text = "-";
//
// SingleSampleReport
//
this.SingleSampleReport.Index = 3;
this.SingleSampleReport.Text = "单样本解析结论报告";
this.SingleSampleReport.Click += new System.EventHandler(this.SingleSampleReport_Click);
//
// menuItem1
//
this.menuItem1.Index = 5;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.AboutMenu});
this.menuItem1.Text = "帮助";
//
// AboutMenu
//
this.AboutMenu.Index = 0;
this.AboutMenu.Text = "关于软件...";
this.AboutMenu.Popup += new System.EventHandler(this.AboutMenu_Popup);
this.AboutMenu.Click += new System.EventHandler(this.AboutMenu_Click);
//
// splitter2
//
this.splitter2.BackColor = System.Drawing.SystemColors.Desktop;
this.splitter2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitter2.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter2.Location = new System.Drawing.Point(206, 256);
this.splitter2.Name = "splitter2";
this.splitter2.Size = new System.Drawing.Size(914, 6);
this.splitter2.TabIndex = 3;
this.splitter2.TabStop = false;
//
// panel1
//
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(206, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(914, 256);
this.panel1.TabIndex = 4;
//
// panel2
//
this.panel2.Controls.Add(this.tabControl1);
this.panel2.Dock = System.Windows.Forms.DockStyle.Left;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(200, 734);
this.panel2.TabIndex = 5;
//
// tabControl1
//
this.tabControl1.Controls.Add(this.critabPage);
this.tabControl1.Controls.Add(this.resulttabPage);
this.tabControl1.Controls.Add(this.templatetabPage);
this.tabControl1.Controls.Add(this.examtabPage);
this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl1.Location = new System.Drawing.Point(0, 0);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(200, 734);
this.tabControl1.TabIndex = 0;
//
// critabPage
//
this.critabPage.Location = new System.Drawing.Point(4, 25);
this.critabPage.Name = "critabPage";
this.critabPage.Size = new System.Drawing.Size(192, 705);
this.critabPage.TabIndex = 0;
this.critabPage.Text = "标准样本";
//
// resulttabPage
//
this.resulttabPage.Location = new System.Drawing.Point(4, 25);
this.resulttabPage.Name = "resulttabPage";
this.resulttabPage.Size = new System.Drawing.Size(192, 705);
this.resulttabPage.TabIndex = 2;
this.resulttabPage.Text = "解释结果";
//
// templatetabPage
//
this.templatetabPage.Location = new System.Drawing.Point(4, 25);
this.templatetabPage.Name = "templatetabPage";
this.templatetabPage.Size = new System.Drawing.Size(192, 705);
this.templatetabPage.TabIndex = 2;
this.templatetabPage.Text = "模板";
//
// examtabPage
//
this.examtabPage.Location = new System.Drawing.Point(4, 25);
this.examtabPage.Name = "examtabPage";
this.examtabPage.Size = new System.Drawing.Size(192, 705);
this.examtabPage.TabIndex = 1;
this.examtabPage.Text = "待测样本";
//
// output
//
this.output.Dock = System.Windows.Forms.DockStyle.Fill;
this.output.Location = new System.Drawing.Point(206, 262);
this.output.Multiline = true;
this.output.Name = "output";
this.output.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.output.Size = new System.Drawing.Size(914, 472);
this.output.TabIndex = 6;
this.output.Text = "";
//
// FormMain
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.Application;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.BackColor = System.Drawing.SystemColors.Info;
this.ClientSize = new System.Drawing.Size(1120, 734);
this.Controls.Add(this.output);
this.Controls.Add(this.splitter2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel2);
this.Menu = this.mainMenu;
this.Name = "FormMain";
this.Text = "录井解释专家系统";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Resize += new System.EventHandler(this.FormMain_Resize);
this.Closing += new System.ComponentModel.CancelEventHandler(this.FormMain_Closing);
this.Load += new System.EventHandler(this.FormMain_Load);
this.panel2.ResumeLayout(false);
this.tabControl1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
try
{
int i=0;
Application.Run(aFormMain);
i++;
}
catch(System.Configuration.ConfigurationException e)
{
throw e;
}
catch(Exception e)
{
throw e;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -