| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764 | using Microsoft.WindowsAPICodePack.Shell;using PaintDotNet.Base.CommTool;using PaintDotNet.Base.Functionodel;using PaintDotNet.Base.SettingModel;using PaintDotNet.CustomControl;using PaintDotNet.DbOpreate.DbBll;using PaintDotNet.DbOpreate.DbModel;using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Drawing.Imaging;using System.IO;using System.Linq;using System.Windows.Forms;using static PaintDotNet.Base.Functionodel.AnalyzeSettingModel;namespace PaintDotNet.Instrument{    /// <summary>    /// 项目工程    /// </summary>    internal class ProjectEngineering : FloatingToolForm    {        #region 控件        private Panel panel3;        private ToolTip toolTip1;        private IContainer components;        private Button button8;        private Button button7;        private Button button6;        private Button button5;        private Button button4;        private Button button3;        private Button button2;        private Button button1;        private TreeView treeView1;        private ListView listView1;        private GroupBox groupBox1;        private GroupBox groupBox2;        private GroupBox groupBox3;        private Label label1;        private Label label2;        private Label label3;        private Label label4;        private Label label5;        private Label label6;        private Label label8;        private Label label7;        private Label label12;        private Label label11;        private Label label10;        private Label label9;        private DataGridView dataGridView1;        private ImageList imageList1;        private void InitializeLanguageText()        {            this.groupBox1.Text = PdnResources.GetString("Menu.thebasicinformationofproject.text");            this.label2.Text = PdnResources.GetString("Menu.Ratingdate.text") + ":";            this.label1.Text = PdnResources.GetString("Menu.projectnumber.text") + ":";            this.groupBox2.Text = PdnResources.GetString("Menu.Inspectioninformation.text");            this.label6.Text = PdnResources.GetString("Menu.Inspectiondate.text") + ":";            this.label5.Text = PdnResources.GetString("Menu.inspectiondepartment.text") + ":";            this.label4.Text = PdnResources.GetString("Menu.Contactperson.text") + ":";            this.label3.Text = PdnResources.GetString("Menu.Sender.text") + ":";            this.groupBox3.Text = PdnResources.GetString("Menu.other.text");            this.Text = PdnResources.GetString("Menu.Tools.OpenProject.Text");        }        private void InitializeComponent()        {            this.components = new System.ComponentModel.Container();            this.panel3 = new System.Windows.Forms.Panel();            this.button8 = new System.Windows.Forms.Button();            this.button7 = new System.Windows.Forms.Button();            this.button6 = new System.Windows.Forms.Button();            this.button5 = new System.Windows.Forms.Button();            this.button4 = new System.Windows.Forms.Button();            this.button3 = new System.Windows.Forms.Button();            this.button2 = new System.Windows.Forms.Button();            this.button1 = new System.Windows.Forms.Button();            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);            this.treeView1 = new System.Windows.Forms.TreeView();            this.listView1 = new System.Windows.Forms.ListView();            this.imageList1 = new System.Windows.Forms.ImageList(this.components);            this.groupBox1 = new System.Windows.Forms.GroupBox();            this.label8 = new System.Windows.Forms.Label();            this.label7 = new System.Windows.Forms.Label();            this.label2 = new System.Windows.Forms.Label();            this.label1 = new System.Windows.Forms.Label();            this.groupBox2 = new System.Windows.Forms.GroupBox();            this.label12 = new System.Windows.Forms.Label();            this.label11 = new System.Windows.Forms.Label();            this.label10 = new System.Windows.Forms.Label();            this.label9 = new System.Windows.Forms.Label();            this.label6 = new System.Windows.Forms.Label();            this.label5 = new System.Windows.Forms.Label();            this.label4 = new System.Windows.Forms.Label();            this.label3 = new System.Windows.Forms.Label();            this.groupBox3 = new System.Windows.Forms.GroupBox();            this.dataGridView1 = new System.Windows.Forms.DataGridView();            this.panel3.SuspendLayout();            this.groupBox1.SuspendLayout();            this.groupBox2.SuspendLayout();            this.groupBox3.SuspendLayout();            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();            this.SuspendLayout();            //             // panel3            //             this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;            this.panel3.Controls.Add(this.button8);            this.panel3.Controls.Add(this.button7);            this.panel3.Controls.Add(this.button6);            this.panel3.Controls.Add(this.button5);            this.panel3.Controls.Add(this.button4);            this.panel3.Controls.Add(this.button3);            this.panel3.Controls.Add(this.button2);            this.panel3.Controls.Add(this.button1);            this.panel3.Location = new System.Drawing.Point(13, 12);            this.panel3.Name = "panel3";            this.panel3.Size = new System.Drawing.Size(255, 37);            this.panel3.TabIndex = 0;            //             // button8            //             this.button8.Location = new System.Drawing.Point(222, 5);            this.button8.Name = "button8";            this.button8.Size = new System.Drawing.Size(25, 25);            this.button8.TabIndex = 13;            this.button8.UseVisualStyleBackColor = true;            this.button8.Click += new System.EventHandler(this.button8_click);            //             // button7            //             this.button7.Location = new System.Drawing.Point(191, 5);            this.button7.Name = "button7";            this.button7.Size = new System.Drawing.Size(25, 25);            this.button7.TabIndex = 14;            this.button7.UseVisualStyleBackColor = true;            this.button7.Click += new System.EventHandler(this.button7_click);            //             // button6            //             this.button6.Location = new System.Drawing.Point(160, 5);            this.button6.Name = "button6";            this.button6.Size = new System.Drawing.Size(25, 25);            this.button6.TabIndex = 15;            this.button6.UseVisualStyleBackColor = true;            this.button6.Click += new System.EventHandler(this.button6_click);            //             // button5            //             this.button5.Location = new System.Drawing.Point(129, 5);            this.button5.Name = "button5";            this.button5.Size = new System.Drawing.Size(25, 25);            this.button5.TabIndex = 16;            this.button5.UseVisualStyleBackColor = true;            this.button5.Click += new System.EventHandler(this.button5_click);            //             // button4            //             this.button4.Location = new System.Drawing.Point(98, 5);            this.button4.Name = "button4";            this.button4.Size = new System.Drawing.Size(25, 25);            this.button4.TabIndex = 18;            this.button4.UseVisualStyleBackColor = true;            this.button4.Click += new System.EventHandler(this.button4_click);            //             // button3            //             this.button3.Location = new System.Drawing.Point(67, 5);            this.button3.Name = "button3";            this.button3.Size = new System.Drawing.Size(25, 25);            this.button3.TabIndex = 20;            this.button3.UseVisualStyleBackColor = true;            this.button3.Click += new System.EventHandler(this.button3_click);            //             // button2            //             this.button2.Location = new System.Drawing.Point(36, 5);            this.button2.Name = "button2";            this.button2.Size = new System.Drawing.Size(25, 25);            this.button2.TabIndex = 19;            this.button2.UseVisualStyleBackColor = true;            this.button2.Click += new System.EventHandler(this.button2_click);            //             // button1            //             this.button1.Location = new System.Drawing.Point(5, 5);            this.button1.Name = "button1";            this.button1.Size = new System.Drawing.Size(25, 25);            this.button1.TabIndex = 12;            this.button1.UseVisualStyleBackColor = true;            this.button1.Click += new System.EventHandler(this.button1_click);            //             // treeView1            //             this.treeView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)));            this.treeView1.DrawMode = System.Windows.Forms.TreeViewDrawMode.OwnerDrawText;            this.treeView1.HideSelection = false;            this.treeView1.Location = new System.Drawing.Point(12, 55);            this.treeView1.Name = "treeView1";            this.treeView1.Size = new System.Drawing.Size(256, 445);            this.treeView1.TabIndex = 3;            this.treeView1.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView1_BeforeExpand);            this.treeView1.DrawNode += new System.Windows.Forms.DrawTreeNodeEventHandler(this.treeView1_DrawNode);            this.treeView1.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeView1_NodeMouseClick);            //             // listView1            //             this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.listView1.HideSelection = false;            this.listView1.LargeImageList = this.imageList1;            this.listView1.Location = new System.Drawing.Point(283, 12);            this.listView1.Name = "listView1";            this.listView1.Size = new System.Drawing.Size(856, 371);            this.listView1.TabIndex = 4;            this.listView1.UseCompatibleStateImageBehavior = false;            this.listView1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.listView1_MouseDoubleClick);            //             // imageList1            //             this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;            this.imageList1.ImageSize = new System.Drawing.Size(48, 48);            this.imageList1.TransparentColor = System.Drawing.Color.Transparent;            //             // groupBox1            //             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));            this.groupBox1.BackColor = System.Drawing.Color.White;            this.groupBox1.Controls.Add(this.label8);            this.groupBox1.Controls.Add(this.label7);            this.groupBox1.Controls.Add(this.label2);            this.groupBox1.Controls.Add(this.label1);            this.groupBox1.Location = new System.Drawing.Point(283, 389);            this.groupBox1.Name = "groupBox1";            this.groupBox1.Size = new System.Drawing.Size(228, 111);            this.groupBox1.TabIndex = 5;            this.groupBox1.TabStop = false;            this.groupBox1.Text = "项目基本信息";            //             // label8            //             this.label8.AutoSize = true;            this.label8.Location = new System.Drawing.Point(81, 70);            this.label8.Name = "label8";            this.label8.Size = new System.Drawing.Size(41, 12);            this.label8.TabIndex = 3;            this.label8.Text = "label8";            //             // label7            //             this.label7.AutoSize = true;            this.label7.Location = new System.Drawing.Point(79, 38);            this.label7.Name = "label7";            this.label7.Size = new System.Drawing.Size(41, 12);            this.label7.TabIndex = 2;            this.label7.Text = "label7";            //             // label2            //             this.label2.AutoSize = true;            this.label2.Location = new System.Drawing.Point(7, 70);            this.label2.Name = "label2";            this.label2.Size = new System.Drawing.Size(65, 12);            this.label2.TabIndex = 1;            this.label2.Text = "评级日期:";            //             // label1            //             this.label1.AutoSize = true;            this.label1.Location = new System.Drawing.Point(7, 38);            this.label1.Name = "label1";            this.label1.Size = new System.Drawing.Size(65, 12);            this.label1.TabIndex = 0;            this.label1.Text = "项目编号:";            //             // groupBox2            //             this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));            this.groupBox2.BackColor = System.Drawing.Color.White;            this.groupBox2.Controls.Add(this.label12);            this.groupBox2.Controls.Add(this.label11);            this.groupBox2.Controls.Add(this.label10);            this.groupBox2.Controls.Add(this.label9);            this.groupBox2.Controls.Add(this.label6);            this.groupBox2.Controls.Add(this.label5);            this.groupBox2.Controls.Add(this.label4);            this.groupBox2.Controls.Add(this.label3);            this.groupBox2.Location = new System.Drawing.Point(517, 389);            this.groupBox2.Name = "groupBox2";            this.groupBox2.Size = new System.Drawing.Size(373, 111);            this.groupBox2.TabIndex = 6;            this.groupBox2.TabStop = false;            this.groupBox2.Text = "送检信息";            //             // label12            //             this.label12.AutoSize = true;            this.label12.Location = new System.Drawing.Point(251, 69);            this.label12.Name = "label12";            this.label12.Size = new System.Drawing.Size(47, 12);            this.label12.TabIndex = 7;            this.label12.Text = "label12";            //             // label11            //             this.label11.AutoEllipsis = true;            this.label11.Location = new System.Drawing.Point(250, 37);            this.label11.Name = "label11";            this.label11.Size = new System.Drawing.Size(113, 12);            this.label11.TabIndex = 6;            this.label11.Text = "label11";            //             // label10            //             this.label10.AutoEllipsis = true;            this.label10.Location = new System.Drawing.Point(69, 69);            this.label10.Name = "label10";            this.label10.Size = new System.Drawing.Size(117, 12);            this.label10.TabIndex = 5;            this.label10.Text = "label10";            //             // label9            //             this.label9.AutoEllipsis = true;            this.label9.Location = new System.Drawing.Point(67, 37);            this.label9.Name = "label9";            this.label9.Size = new System.Drawing.Size(117, 12);            this.label9.TabIndex = 4;            this.label9.Text = "label9";            //             // label6            //             this.label6.AutoSize = true;            this.label6.Location = new System.Drawing.Point(192, 69);            this.label6.Name = "label6";            this.label6.Size = new System.Drawing.Size(65, 12);            this.label6.TabIndex = 3;            this.label6.Text = "送检日期:";            //             // label5            //             this.label5.AutoSize = true;            this.label5.Location = new System.Drawing.Point(7, 69);            this.label5.Name = "label5";            this.label5.Size = new System.Drawing.Size(65, 12);            this.label5.TabIndex = 2;            this.label5.Text = "送检单位:";            //             // label4            //             this.label4.AutoSize = true;            this.label4.Location = new System.Drawing.Point(190, 37);            this.label4.Name = "label4";            this.label4.Size = new System.Drawing.Size(53, 12);            this.label4.TabIndex = 1;            this.label4.Text = "联系人:";            //             // label3            //             this.label3.AutoSize = true;            this.label3.Location = new System.Drawing.Point(7, 37);            this.label3.Name = "label3";            this.label3.Size = new System.Drawing.Size(53, 12);            this.label3.TabIndex = 0;            this.label3.Text = "送检人:";            //             // groupBox3            //             this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.groupBox3.BackColor = System.Drawing.Color.White;            this.groupBox3.Controls.Add(this.dataGridView1);            this.groupBox3.Location = new System.Drawing.Point(896, 389);            this.groupBox3.Name = "groupBox3";            this.groupBox3.Size = new System.Drawing.Size(243, 111);            this.groupBox3.TabIndex = 7;            this.groupBox3.TabStop = false;            this.groupBox3.Text = "其它";            //             // dataGridView1            //             this.dataGridView1.AllowUserToAddRows = false;            this.dataGridView1.AllowUserToDeleteRows = false;            this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)             | System.Windows.Forms.AnchorStyles.Left)             | System.Windows.Forms.AnchorStyles.Right)));            this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;            this.dataGridView1.BackgroundColor = System.Drawing.Color.White;            this.dataGridView1.GridColor = System.Drawing.SystemColors.Control;            this.dataGridView1.Location = new System.Drawing.Point(6, 14);            this.dataGridView1.MultiSelect = false;            this.dataGridView1.Name = "dataGridView1";            this.dataGridView1.ReadOnly = true;            this.dataGridView1.RowHeadersVisible = false;            this.dataGridView1.RowTemplate.Height = 23;            this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;            this.dataGridView1.Size = new System.Drawing.Size(231, 91);            this.dataGridView1.TabIndex = 0;            //             // ProjectEngineering            //             this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);            this.ClientSize = new System.Drawing.Size(1151, 512);            this.Controls.Add(this.groupBox3);            this.Controls.Add(this.groupBox2);            this.Controls.Add(this.groupBox1);            this.Controls.Add(this.listView1);            this.Controls.Add(this.treeView1);            this.Controls.Add(this.panel3);            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;            this.MinimumSize = new System.Drawing.Size(295, 39);            this.Name = "ProjectEngineering";            this.Text = "项目工程";            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ProjectEngineering_FormClosing);            this.Controls.SetChildIndex(this.panel3, 0);            this.Controls.SetChildIndex(this.treeView1, 0);            this.Controls.SetChildIndex(this.listView1, 0);            this.Controls.SetChildIndex(this.groupBox1, 0);            this.Controls.SetChildIndex(this.groupBox2, 0);            this.Controls.SetChildIndex(this.groupBox3, 0);            this.panel3.ResumeLayout(false);            this.groupBox1.ResumeLayout(false);            this.groupBox1.PerformLayout();            this.groupBox2.ResumeLayout(false);            this.groupBox2.PerformLayout();            this.groupBox3.ResumeLayout(false);            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();            this.ResumeLayout(false);        }        #endregion        /// <summary>        /// 主控件        /// </summary>        private AppWorkspace appWorkspace;        /// <summary>        /// 常规操作路径        /// </summary>        private string NormalOperationPath = Startup.instance.configModel.NormalOperation;        /// <summary>        /// 通用分析路径        /// </summary>        private string GeneralAnalysisPath = Startup.instance.configModel.GeneralAnalysis;        /// <summary>        /// 专用分析路径        /// </summary>        private string DedicatedAnalysisPath = Startup.instance.configModel.DedicatedAnalysis;        /// <summary>        /// 三个根节点        /// </summary>        private TreeNode anime1, anime2, anime3, anime4;        /// <summary>        /// 新建文件夹窗口        /// </summary>        private CreateNameDialog createNameDialog;        /// <summary>        /// 新建项目窗口        /// </summary>        private CreateProjectDialog createProjectDialog;        /// <summary>        /// 1新建文件夹 2搜索        /// </summary>        private int createType = 1;        /// <summary>        /// 节点信息类,用于判断节点类型        /// </summary>        private class NodeInfo        {            /// <summary>            /// 根节点类型 1常规 2通用 3专用 4搜索            /// </summary>            public int rootType;            /// <summary>            /// 文件夹类型 1文件夹 2项目 3内置不允许删除            /// </summary>            public int folderType;            /// <summary>            /// tag,用于拼接好的存储路径等            /// </summary>            public string tag;            /// <summary>            /// 数据库的主键(通用、专用及其下的内容)            /// </summary>            public int id;        }        public class NodeItem        {            /// <summary>            /// 父级id            /// </summary>            public int parentId;            /// <summary>            /// 完整路径            /// </summary>            public string path;            /// <summary>            /// 项目编号            /// </summary>            public string code;        }        public ProjectEngineering(AppWorkspace appWorkspace)        {            this.appWorkspace = appWorkspace;            InitializeComponent();            InitializeLanguageText();            InitializeButtonBackgroudImage();            InitializeToolTipAndEvent();            InitializeTreeViewRootData();            InitializeTreeViewDetailData();            InitListViewHeader();            ClearLabelAndDataGridView();            InitGridHeader();        }        private void InitializeButtonBackgroudImage()        {            this.button1.FlatStyle = FlatStyle.Flat;            this.button1.FlatAppearance.BorderSize = 0;            this.button1.BackgroundImageLayout = ImageLayout.Center;            this.button1.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.Folder.png").Reference;            this.button2.FlatStyle = FlatStyle.Flat;            this.button2.FlatAppearance.BorderSize = 0;            this.button2.BackgroundImageLayout = ImageLayout.Center;            this.button2.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.Project.png").Reference;            this.button3.FlatStyle = FlatStyle.Flat;            this.button3.FlatAppearance.BorderSize = 0;            this.button3.BackgroundImageLayout = ImageLayout.Center;            this.button3.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.Search.png").Reference;            this.button4.FlatStyle = FlatStyle.Flat;            this.button4.FlatAppearance.BorderSize = 0;            this.button4.BackgroundImageLayout = ImageLayout.Center;            this.button4.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.Refresh.png").Reference;            this.button5.FlatStyle = FlatStyle.Flat;            this.button5.FlatAppearance.BorderSize = 0;            this.button5.BackgroundImageLayout = ImageLayout.Center;            this.button5.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.Delete.png").Reference;            this.button6.FlatStyle = FlatStyle.Flat;            this.button6.FlatAppearance.BorderSize = 0;            this.button6.BackgroundImageLayout = ImageLayout.Center;            this.button6.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.FullScreen.png").Reference;            this.button7.FlatStyle = FlatStyle.Flat;            this.button7.FlatAppearance.BorderSize = 0;            this.button7.BackgroundImageLayout = ImageLayout.Center;            this.button7.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.ListMode.png").Reference;            this.button8.FlatStyle = FlatStyle.Flat;            this.button8.FlatAppearance.BorderSize = 0;            this.button8.BackgroundImageLayout = ImageLayout.Center;            this.button8.BackgroundImage = PdnResources.GetImageResource("Icons.ProjectEngineering.PicMode.png").Reference;        }        private void ClearLabelAndDataGridView()        {            this.label7.Text = "";            this.label8.Text = "";            this.label9.Text = "";            this.label10.Text = "";            this.label11.Text = "";            this.label12.Text = "";            this.dataGridView1.Rows.Clear();        }        /// <summary>        /// 初始化右侧表头        /// </summary>        private void InitListViewHeader()        {            /*ColumnHeader header = new ColumnHeader();            header.Text = "缩略图";            header.Width = this.listView1.Width / 3 - 7;            this.listView1.Columns.Add(header);*/            ColumnHeader header = new ColumnHeader();            header.Text = PdnResources.GetString("Menu.name.text");            header.Width = this.listView1.Width / 3 - 7;            this.listView1.Columns.Add(header);            header = new ColumnHeader();            header.Text = PdnResources.GetString("Menu.user.text");            header.Width = this.listView1.Width / 3 - 7;            this.listView1.Columns.Add(header);            header = new ColumnHeader();            header.Text = PdnResources.GetString("Menu.Createtime.text");            header.Width = this.listView1.Width / 3 - 7;            this.listView1.Columns.Add(header);            this.listView1.View = View.Details;        }        /// <summary>        /// 初始化项目工程树形菜单        /// </summary>        private void InitializeTreeViewRootData()        {            NodeInfo info1 = new NodeInfo();            info1.rootType = 1;            info1.tag = NormalOperationPath;            anime1 = new TreeNode();            anime1.Text = PdnResources.GetString("Menu.Normaloperation.text");            anime1.Tag = info1;            this.treeView1.Nodes.Add(anime1);            NodeInfo info2 = new NodeInfo();            info2.rootType = 2;            info2.tag = GeneralAnalysisPath;            anime2 = new TreeNode();            anime2.Text = PdnResources.GetString("Menu.GeneralAnalysis.Text");            anime2.Tag = info2;            this.treeView1.Nodes.Add(anime2);            NodeInfo info3 = new NodeInfo();            info3.rootType = 3;            info3.tag = DedicatedAnalysisPath;            anime3 = new TreeNode();            anime3.Text = PdnResources.GetString("Menu.DedicatedAnalysis.Text");            anime3.Tag = info3;            this.treeView1.Nodes.Add(anime3);            NodeInfo info4 = new NodeInfo();            info4.rootType = 4;            anime4 = new TreeNode();            anime4.Text = PdnResources.GetString("Menu.searchresults.text");            anime4.Tag = info4;            this.treeView1.Nodes.Add(anime4);        }        /// <summary>        /// 初始化项目工程详细菜单        /// </summary>        public void InitializeTreeViewDetailData()        {            this.NormalOperationPath = Startup.instance.configModel.NormalOperation;            this.GeneralAnalysisPath = Startup.instance.configModel.GeneralAnalysis;            this.DedicatedAnalysisPath = Startup.instance.configModel.DedicatedAnalysis;            this.treeView1.Nodes[0].Nodes.Clear();            this.treeView1.Nodes[1].Nodes.Clear();            this.treeView1.Nodes[2].Nodes.Clear();            this.listView1.Items.Clear();            if (NormalOperationPath != null && !NormalOperationPath.Equals(""))            {                if (!System.IO.Directory.Exists(NormalOperationPath))                {                    string root = System.IO.Directory.GetDirectoryRoot(NormalOperationPath);                    if (System.IO.Directory.Exists(root))                        System.IO.Directory.CreateDirectory(NormalOperationPath);                }                else                {                    InitializeTreeViewDetailDataThree(anime1);                }            }            if (GeneralAnalysisPath != null && !GeneralAnalysisPath.Equals(""))            {                if (!System.IO.Directory.Exists(GeneralAnalysisPath))                {                    string root = System.IO.Directory.GetDirectoryRoot(GeneralAnalysisPath);                    if (System.IO.Directory.Exists(root))                        System.IO.Directory.CreateDirectory(GeneralAnalysisPath);                }                else                {                    InitializeGeneralAnalysisTreeViewDetailData(anime2);                }            }            if (DedicatedAnalysisPath != null && !DedicatedAnalysisPath.Equals(""))            {                if (!System.IO.Directory.Exists(DedicatedAnalysisPath))                {                    string root = System.IO.Directory.GetDirectoryRoot(DedicatedAnalysisPath);                    if (System.IO.Directory.Exists(root))                        System.IO.Directory.CreateDirectory(DedicatedAnalysisPath);                }                else                {                    InitializeDedicatedAnalysisPathTreeViewDetailData(anime3);                }            }        }        /// <summary>        /// 常规操作        /// </summary>        /// <param name="anime1"></param>        private void InitializeTreeViewDetailDataThree(TreeNode treeNode)        {            List<string> dirs = new List<string>(Directory.GetDirectories(NormalOperationPath, "*", System.IO.SearchOption.TopDirectoryOnly));            foreach (var dir in dirs)            {                try                {                    this.anime1.Nodes.Add(this.AddFolderTreeNode(1, dir, 0));                }                catch (Exception)                {                }            }        }        /// <summary>        /// 通用分析        /// </summary>        private void InitializeGeneralAnalysisTreeViewDetailData(TreeNode treeNode)        {            List<mic_project> mic_Projects = mic_project_BLL.FindAllByParentId(1);            if (mic_Projects != null && mic_Projects.Count > 0)            {                foreach (mic_project mic_Project in mic_Projects)                {                    if (mic_Project.project_path == null)                    {                        this.anime2.Nodes.Add(this.AddProjectTreeNode(3, 2, GeneralAnalysisPath + "\\" + PdnResources.GetString(mic_Project.project_name), mic_Project));                    }                    else                    {                        this.anime2.Nodes.Add(this.AddProjectTreeNode(3, 2, GeneralAnalysisPath + "\\" + mic_Project.project_name, mic_Project));                    }                                    }            }        }        /// <summary>        /// 专用分析        /// </summary>        private void InitializeDedicatedAnalysisPathTreeViewDetailData(TreeNode treeNode)        {            List<mic_project> mic_Projects = mic_project_BLL.FindAllByParentId(2);            if (mic_Projects != null && mic_Projects.Count > 0)            {                foreach (mic_project mic_Project in mic_Projects)                {                    if (mic_Project.project_path == null)                    {                        this.anime3.Nodes.Add(this.AddProjectTreeNode(3, 3, DedicatedAnalysisPath + "\\" + PdnResources.GetString(mic_Project.project_name), mic_Project));                    }                    else                    {                        this.anime3.Nodes.Add(this.AddProjectTreeNode(3, 3, DedicatedAnalysisPath + "\\" + mic_Project.project_name, mic_Project));                    }                                    }            }        }        public TreeNode TreeNode        {            get            {                return this.treeView1.SelectedNode;            }        }        /// <summary>        /// 初始化提示信息及按钮事件        /// </summary>        private void InitializeToolTipAndEvent()        {            this.toolTip1 = new ToolTip();            this.toolTip1.SetToolTip(this.button1, PdnResources.GetString("Menu.Newfolder.Text"));            this.toolTip1.SetToolTip(this.button2, PdnResources.GetString("Menu.Newproject.Text"));            this.toolTip1.SetToolTip(this.button3, PdnResources.GetString("Menu.Itemsearch.Text"));            this.toolTip1.SetToolTip(this.button4, PdnResources.GetString("Menu.Refresh.text"));            this.toolTip1.SetToolTip(this.button5, PdnResources.GetString("Menu.Edit.Delete.Text"));            this.toolTip1.SetToolTip(this.button6, PdnResources.GetString("Menu.Fullscreen.Text"));            this.toolTip1.SetToolTip(this.button7, PdnResources.GetString("Menu.tool.Templatemanent.Listmode.text"));            this.toolTip1.SetToolTip(this.button8, PdnResources.GetString("Menu.tool.Templategement.Thumbnailmode.text"));            this.toolTip1.ShowAlways = true;        }        /// <summary>        /// 新建文件夹        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button1_click(object sender, EventArgs e)        {            if (this.treeView1.SelectedNode == null)            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectnode.Text"));                return;            }            if (this.treeView1.SelectedNode.Index == 0 && this.treeView1.SelectedNode.Parent==null)            {                if (NormalOperationPath == null || NormalOperationPath.Equals(""))                {                    MessageBox.Show(PdnResources.GetString("Menu.Pleasesavepathorchivefilefirst.Text"));                    return;                }            }            this.createType = 1;            this.createNameDialog = new CreateNameDialog(this);            this.createNameDialog.Text = PdnResources.GetString("Menu.Newfolder.Text");            this.createNameDialog.StartPosition = FormStartPosition.CenterScreen;            this.createNameDialog.ShowDialog();        }        /// <summary>        /// 新建项目        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button2_click(object sender, EventArgs e)        {            if (this.treeView1.SelectedNode == null)            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectnode.Text"));                return;            }            this.createProjectDialog = new CreateProjectDialog(this);            this.createProjectDialog.parentId = ((NodeInfo)this.treeView1.SelectedNode.Tag).id;            this.createProjectDialog.Text = PdnResources.GetString("Menu.Newproject.Text");            this.createProjectDialog.StartPosition = FormStartPosition.CenterScreen;            this.createProjectDialog.ShowDialog();        }        /// <summary>        /// 新建文件夹的结果函数        /// </summary>        /// <param name="name"></param>        public override void GetCreateName(string name)        {            if(this.createType==1)            {                //如果是常规操作                if (((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 1)                {                    string newPath = ((NodeInfo)this.treeView1.SelectedNode.Tag).tag + "\\" + name;                    if (!System.IO.Directory.Exists(newPath))                    {                        System.IO.Directory.CreateDirectory(newPath);                        this.treeView1.SelectedNode.Nodes.Add(this.AddFolderTreeNode(1, newPath, 0));                        //this.treeView1.Nodes[0].Nodes.Clear();                        //InitializeTreeViewDetailDataThree(anime1);                    }                    else                    {                        MessageBox.Show("已经存在同名文件夹");                    }                }                //如果是通用、专用分析                else                {                    //文件夹内可以建文件夹,项目内不允许建文件夹                    //如果不是项目,则允许创建文件夹                    if (((NodeInfo)this.treeView1.SelectedNode.Tag).folderType == 1 || ((NodeInfo)this.treeView1.SelectedNode.Tag).folderType == 3)                    {                        string parentPath = ((NodeInfo)this.treeView1.SelectedNode.Tag).tag;                        if (!System.IO.Directory.Exists(parentPath))                        {                            System.IO.Directory.CreateDirectory(parentPath);                        }                        string newPath = parentPath + "\\" + name;                        if (!System.IO.Directory.Exists(newPath))                        {                            //创建文件夹                            System.IO.Directory.CreateDirectory(newPath);                            //添加到数据库                            mic_project project = new mic_project();                            project.parent_id = ((NodeInfo)this.treeView1.SelectedNode.Tag).id;                            project.project_name = name;                            project.project_path = newPath;                            project.project_type = 3;                            mic_project_BLL.Add(project);                            this.treeView1.SelectedNode.Nodes.Add(this.AddFolderTreeNode(((NodeInfo)this.treeView1.SelectedNode.Tag).rootType, newPath, project.id));                        }                        else                        {                            MessageBox.Show("已经存在同名文件夹");                        }                    }                }            }            //如果是进行搜索            else if(this.createType == 2)            {                //先清空搜索节点的数据                this.treeView1.Nodes[3].Nodes.Clear();                //搜索                if (!string.IsNullOrEmpty(name))                {                    List<mic_project_info> infos = mic_project_info_BLL.FindAllByKey(name);                    if (infos!=null && infos.Count>0)                    {                        int[] arr = infos.Select(a => a.project_id).ToArray();                        List<mic_project> mic_Projects =  mic_project_BLL.FindAllByIds(arr);                        if (mic_Projects!=null && mic_Projects.Count>0)                        {                            foreach (mic_project mic_Project in mic_Projects)                            {                                this.anime4.Nodes.Add(this.AddProjectTreeNode(2, 4, mic_Project.project_path, mic_Project));                            }                        }                    }                    else                    {                        MessageBox.Show("没有搜索结果");                    }                }                                if(this.treeView1.Nodes[3].Nodes.Count>0)                {                    this.treeView1.Nodes[3].Expand();                }            }            this.createNameDialog.Close();        }        /// <summary>        /// 新建项目的结果函数        /// </summary>        public override void CreateProjectName(AnalyzeSettingModel model, int id)        {            if (((NodeInfo)this.treeView1.SelectedNode.Tag).rootType > 1)            {                //文件夹内可以建项目,项目内不能建项目                if (((NodeInfo)this.treeView1.SelectedNode.Tag).folderType == 1 || ((NodeInfo)this.treeView1.SelectedNode.Tag).folderType == 3)                {                    string parentPath = ((NodeInfo)this.treeView1.SelectedNode.Tag).tag;                    if (!System.IO.Directory.Exists(parentPath))                    {                        System.IO.Directory.CreateDirectory(parentPath);                    }                    string newPath = parentPath + "\\" + model.itemNumber;                    if (!System.IO.Directory.Exists(newPath))                    {                        //创建文件夹                        System.IO.Directory.CreateDirectory(newPath);                        //获取数据                        mic_project project = mic_project_BLL.FindDefault(id);                        project.project_path = newPath;                        mic_project_BLL.Update(project);                        this.treeView1.SelectedNode.Nodes.Add(this.AddProjectTreeNode(2, ((NodeInfo)this.treeView1.SelectedNode.Tag).rootType, newPath, project));                    }                    else                    {                        MessageBox.Show("已经存在同名项目");                    }                }            }            if (createProjectDialog != null && !createProjectDialog.IsDisposed)                createProjectDialog.Close();        }        /// <summary>        /// 搜索        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button3_click(object sender, EventArgs e)        {            this.createType = 2;            this.createNameDialog = new CreateNameDialog(this);            this.createNameDialog.Text = PdnResources.GetString("Menu.Itemsearch.Text");            this.createNameDialog.StartPosition = FormStartPosition.CenterScreen;            this.createNameDialog.ShowDialog();        }        /// <summary>        /// 刷新        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button4_click(object sender, EventArgs e)        {            this.InitializeTreeViewDetailData();        }        /// <summary>        /// 删除        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button5_click(object sender, EventArgs e)        {            if (this.treeView1.SelectedNode == null)            {                MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectnode.Text"));                return;            }            if (((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 1)            {                if (MessageBox.Show(PdnResources.GetString("Menu.Areyousurethecurrentfolder.Text")+"?", PdnResources.GetString("Menu.Unrecoverableafterdeletion.text"), MessageBoxButtons.YesNo) == DialogResult.Yes)                {                    //删除文件夹及其内部的文件                    FileOperationHelper.DeleteFolder(((NodeInfo)this.treeView1.SelectedNode.Tag).tag);                    //移除node                    this.treeView1.SelectedNode.Remove();                }             }            else if(((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 2 || ((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 3)            {                if (this.treeView1.SelectedNode.Parent == null)                {                    MessageBox.Show(PdnResources.GetString("Menu.easeselectanothernodeTherootno.Text"));                }                else                {                    if (((NodeInfo)this.treeView1.SelectedNode.Tag).folderType == 3)                    {                        MessageBox.Show(PdnResources.GetString("Menu.eselectnothernodeStandardnodecannotbedele.Text"));                    }                    else                    {                        if (MessageBox.Show(PdnResources.GetString("Menu.Areyousurethecurrentfolder.Text")+"?", PdnResources.GetString("Menu.Unrecoverableafterdeletion.text"), MessageBoxButtons.YesNo) == DialogResult.Yes)                        {                            NodeInfo info = ((NodeInfo)this.treeView1.SelectedNode.Tag);                            //删除数据库                            this.RecursionDelDbData(info.id);                            //删除文件夹及其内部的文件                            FileOperationHelper.DeleteFolder(info.tag);                            //移除node                            this.treeView1.SelectedNode.Remove();                        }                    }                }            }            else if (((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 4)            {                MessageBox.Show(PdnResources.GetString("Menu.Searchandsearchresutsnodescannotbedeleted.Text"));            }        }        /// <summary>        /// 递归删除数据库内容        /// </summary>        /// <param name="id"></param>        private void RecursionDelDbData(int id)        {            mic_project project = mic_project_BLL.FindDefault(id);            mic_project_info project_info = mic_project_info_BLL.FindByProjectCode(project.project_name);            if (project_info != null)            {                List<mic_project_info_item> items = mic_project_info_item_BLL.FindAllByInfoId(project_info.id);                foreach (mic_project_info_item item in items)                {                    mic_project_info_item_BLL.Del(item.id);                }                mic_project_info_BLL.Del(project_info.id);            }            mic_project_BLL.Del(project.id);            List<mic_project> projects = mic_project_BLL.FindAllByParentId(id);            if (projects!=null && projects.Count>0)            {                foreach (mic_project p in projects)                {                    this.RecursionDelDbData(p.id);                }            }        }        /// <summary>        /// 全屏        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button6_click(object sender, EventArgs e)        {            if(this.WindowState == FormWindowState.Maximized)            {                this.WindowState = FormWindowState.Normal;            }            else            {                this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);                this.WindowState = FormWindowState.Maximized;            }        }        /// <summary>        /// 列表模式        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button7_click(object sender, EventArgs e)        {            this.listView1.View = View.Details;        }        /// <summary>        ///         /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void button8_click(object sender, EventArgs e)        {            this.listView1.View = View.LargeIcon;        }        /// <summary>        /// 左侧节点点击事件,需要刷新右侧listview内容        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)        {            this.listView1.Items.Clear();            this.imageList1.Images.Clear();            //如果是常规操作,则不允许建立项目,不允许删除,从文件夹读取内容            if (e.Node.Index==0 && e.Node.Parent==null)            {                this.button1.Enabled = true;                this.button2.Enabled = false;                this.button5.Enabled = false;                this.showFileList(e.Node.Tag);            }            //如果是抖索结果,则什么都不允许操作            else if (e.Node.Index == 3 && e.Node.Parent == null)            {                this.button1.Enabled = false;                this.button2.Enabled = false;                this.button5.Enabled = false;            }            //如果是常规操作下的文件夹,从文件夹读取内容            else if(((NodeInfo)e.Node.Tag).rootType == 1)            {                this.button1.Enabled = true;                this.button2.Enabled = false;                this.button5.Enabled = true;                this.showFileList(e.Node.Tag);            }            else            {                //如果是通用分析和专用分析根节点,就什么都不干                if (e.Node.Parent==null)                {                    this.button1.Enabled = false;                    this.button2.Enabled = false;                    this.button5.Enabled = false;                }                 //如果是通用分析或专用下内置的标准,则不读取内容                else if (((NodeInfo)e.Node.Tag).folderType == 3)                {                    this.button1.Enabled = true;                    this.button2.Enabled = true;                    this.button5.Enabled = false;                }                //如果是通用分析或专用下的文件夹,则从文件夹读取内容                else if (((NodeInfo)e.Node.Tag).folderType == 1)                {                    this.button1.Enabled = true;                    this.button2.Enabled = true;                    this.button5.Enabled = true;                    this.showFileList(e.Node.Tag);                }                //如果是通用分析或专用下的项目,则从文件夹读取内容                else if (((NodeInfo)e.Node.Tag).folderType == 2)                {                    this.button1.Enabled = false;                    this.button2.Enabled = false;                    this.button5.Enabled = true;                    this.showFileList(e.Node.Tag);                    this.showProjectDetail(e.Node.Tag);                }                //如果是常规操作下,则从文件夹里面读                else                {                    this.button1.Enabled = true;                    this.button2.Enabled = false;                    this.button5.Enabled = true;                    this.showFileList(e.Node.Tag);                }            }        }        /// <summary>        /// 读取文件夹的内容,展示在右侧listview中        /// </summary>        /// <param name="info"></param>        private void showFileList(Object info)        {            NodeInfo nodeInfo = (NodeInfo)info;            string path = nodeInfo.tag;            if (path!=null && !path.Equals(""))            {                if (!System.IO.Directory.Exists(path))                {                    MessageBox.Show(PdnResources.GetString("Menu.Thefolderdoesnotexistorwasremo.Text"));                    return;                }                /*if (nodeInfo.folderType == 3)                {                    if (!System.IO.Directory.Exists(path))                    {                        System.IO.Directory.CreateDirectory(path);                    }                }*/                                DirectoryInfo TheFolder = new DirectoryInfo(path);                int j = 0;                foreach (FileInfo NextFile in TheFolder.GetFiles())                {                    /*if (NextFile.Extension.Equals(".doc") || NextFile.Extension.Equals(".docx"))                    {                        this.imageList1.Images.Add("img" + j, PdnResources.GetImageResource("Icons.TypeWordA.png").Reference);                    }                    else if (NextFile.Extension.Equals(".xls") || NextFile.Extension.Equals(".xlsx"))                    {                        this.imageList1.Images.Add("img" + j, PdnResources.GetImageResource("Icons.TypeExcelA.png").Reference);                    }                    else                    {                        this.imageList1.Images.Add("img" + j, PdnResources.GetImageResource("Icons.TypeOtherA.png").Reference);                    }*/                                        ShellFile shellFile = ShellFile.FromFilePath(NextFile.FullName);                    this.imageList1.Images.Add("img" + j, shellFile.Thumbnail.SmallBitmap);                    this.listView1.Items.Add(NextFile.Name, j);                    this.listView1.Items[j].ImageIndex = j;                    this.listView1.Items[j].SubItems.Add(FileOperationHelper.ReadFileOwner(NextFile.FullName));                    this.listView1.Items[j].SubItems.Add(NextFile.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"));                    j++;                }            }        }        /// <summary>        /// 从数据库获取项目详细信息        /// </summary>        /// <param name="info"></param>        private void showProjectDetail(Object info)        {            int id = ((NodeInfo)info).id;            mic_project project = mic_project_BLL.FindDefault(id);            mic_project_info project_info = mic_project_info_BLL.FindByProjectCodeAndProjectId(project.project_name, project.id);                        this.ClearLabelAndDataGridView();            if (project_info!=null)            {                this.label7.Text = project_info.project_code;                this.label8.Text = project_info.project_rating.ToString();                this.label9.Text = project_info.project_sender;                this.label11.Text = project_info.project_contact;                this.label10.Text = project_info.project_company;                this.label12.Text = project_info.project_date.ToString();                List<mic_project_info_item> items = mic_project_info_item_BLL.FindAllByInfoId(project_info.id);                if (items!=null && items.Count>0)                {                    foreach (mic_project_info_item item in items)                    {                        DataGridViewRow row = new DataGridViewRow();                        row.Cells.Add(CreateTextBoxCell(item.item_key, "name"));                        row.Cells.Add(CreateTextBoxCell(item.item_value, "content"));                        this.dataGridView1.Rows.Add(row);                    }                    this.dataGridView1.ClearSelection();                }            }        }        /// <summary>        /// 添加内容单元格        /// </summary>        /// <param name="text"></param>        /// <param name="tag"></param>        /// <returns></returns>        private DataGridViewTextBoxCell CreateTextBoxCell(string text, object tag)        {            DataGridViewTextBoxCell textboxcell = new DataGridViewTextBoxCell();            textboxcell.Value = text;            textboxcell.Tag = tag;            return textboxcell;        }        /// <summary>        /// 初始化表头        /// </summary>        private void InitGridHeader()        {            this.dataGridView1.ColumnHeadersHeight = 25;            DataGridViewTextBoxColumn h1 = new DataGridViewTextBoxColumn();            h1.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h1.Width = 200;            DataGridViewTextBoxColumn h2 = new DataGridViewTextBoxColumn();            h2.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;            h2.Width = 200;            this.dataGridView1.Columns.Add(h1);            this.dataGridView1.Columns.Add(h2);            DataGridViewHelper helper = new DataGridViewHelper(this.dataGridView1);            helper.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, PdnResources.GetString("Menu.name.text")));            helper.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, PdnResources.GetString("Menu.content.text")));            this.dataGridView1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[0].ReadOnly = true;            this.dataGridView1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;            this.dataGridView1.Columns[1].ReadOnly = true;            this.dataGridView1.AllowUserToResizeRows = false;            this.dataGridView1.AllowUserToResizeColumns = false;        }        /// <summary>        /// listview1的双击事件,如果在item上,则尝试打开文件        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)        {            try            {                ListViewHitTestInfo info = this.listView1.HitTest(e.X, e.Y);                if (info.Item != null)                {                    string path = ((NodeInfo)this.treeView1.SelectedNode.Tag).tag;                                        if (info.Item.Text.IndexOf("jpg") > 0 || info.Item.Text.IndexOf("png") > 0                        || info.Item.Text.IndexOf("BMP") > 0)                    {                        Image img = new Bitmap(path + "\\" + info.Item.Text);                        Document document = Document.FromImage(img);                        DocumentWorkspace documentWorkspace = this.appWorkspace.AddNewDocumentWorkspace();                        documentWorkspace.fileText = info.Item.Text;                        documentWorkspace.Document = document;                                                //判断是否存在xml,进行读取                        PicConfigModel configModel = null;                        string fileName = path + "\\" + info.Item.Text;                        string xmlPath = path + "\\" + Path.GetFileNameWithoutExtension(fileName) + ".xml";                        //如果xml存在                        if (System.IO.File.Exists(xmlPath))                        {                            configModel = XmlSerializeHelper.DESerializer<PicConfigModel>(FileOperationHelper.ReadStringFromFile(xmlPath, FileMode.Open));                            documentWorkspace.RuleAttribute(configModel);                            if (configModel != null)                            {                                this.appWorkspace.RestoreLabelAndMeasure(configModel, documentWorkspace);                            }                        }                        //如果不存在,则判断                        //(1)是否自动添加ZEN标尺                        //(2)是否自动添加AxioVision标尺                        else                        {                            documentWorkspace.xmlSaveModel = Startup.instance.ruleDB;                            documentWorkspace.InitRulerInfo();                        }                        this.appWorkspace.ActiveDocumentWorkspace = documentWorkspace;                    }                    else if (info.Item.Text.IndexOf(".xlsx") > 0 || info.Item.Text.IndexOf(".docx") > 0                        || info.Item.Text.IndexOf(".xls") > 0 || info.Item.Text.IndexOf(".doc") > 0)                    {                        if (!OfficeFileHandleHelper.OpenOfficeFile(path + "\\" + info.Item.Text))                            MessageBox.Show(PdnResources.GetString("Menu.Fileopenfailed.Text"));                    }                    //MessageBox.Show(info.Item.Text);                }            }            catch(Exception)            {            }        }        /// <summary>        /// 将要展开节点时的事件        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e)        {            //如果不是顶级节点            if(e.Node.Parent != null)            {                if(e.Node.Nodes.Count==1)                {                    if(((NodeInfo)e.Node.Tag).rootType == 1)                    {                        List<string> dirs = new List<string>(Directory.GetDirectories(((NodeInfo)e.Node.Tag).tag, "*", System.IO.SearchOption.TopDirectoryOnly));                        foreach (var dir in dirs)                        {                            try                            {                                NodeInfo nodeInfo = new NodeInfo();                                nodeInfo.rootType = ((NodeInfo)e.Node.Tag).rootType;                                nodeInfo.folderType = 1;                                nodeInfo.tag = dir;                                TreeNode node = new TreeNode();                                node.Text = Path.GetFileName(dir);                                node.Tag = nodeInfo;                                if (Directory.GetDirectories(dir).Length > 0)                                {                                    TreeNode temp = new TreeNode();                                    temp.Text = "";                                    node.Nodes.Add(temp);                                }                                e.Node.Nodes.Add(node);                            }                            catch (Exception)                            {                            }                        }                    }                    else if (((NodeInfo)e.Node.Tag).rootType == 2 || ((NodeInfo)e.Node.Tag).rootType == 3)                    {                        //从数据库读取下级                        List<mic_project> list = mic_project_BLL.FindAllByParentId(((NodeInfo)e.Node.Tag).id);                        if(list!=null && list.Count>0)                        {                            foreach (mic_project p in list)                            {                                int folderType = (p.project_type == 4)? 2 : 1;                                 e.Node.Nodes.Add(this.AddProjectTreeNode(folderType, ((NodeInfo)e.Node.Tag).rootType, p.project_path, p));                            }                        }                    }                    e.Node.Nodes.RemoveAt(0);                }            }        }        /// <summary>        /// 绘制节点事件        /// </summary>        /// <param name="sender"></param>        /// <param name="e"></param>        private void treeView1_DrawNode(object sender, DrawTreeNodeEventArgs e)        {            if ((e.State & TreeNodeStates.Selected) != 0)            {                //绿底白字                e.Graphics.FillRectangle(Brushes.Green, e.Node.Bounds);                Font nodeFont = e.Node.NodeFont;                if (nodeFont == null) nodeFont = ((TreeView)sender).Font;                e.Graphics.DrawString(e.Node.Text, nodeFont, Brushes.White, Rectangle.Inflate(e.Bounds, 2, 0));            }            else            {                e.DrawDefault = true;            }            if ((e.State & TreeNodeStates.Focused) != 0)            {                using (Pen focusPen = new Pen(Color.Black))                {                    focusPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;                    Rectangle focusBounds = e.Node.Bounds;                    focusBounds.Size = new System.Drawing.Size(focusBounds.Width - 1,                    focusBounds.Height - 1);                    e.Graphics.DrawRectangle(focusPen, focusBounds);                }            }        }        /// <summary>        /// 添加到工程        /// </summary>        public void AddToProject()        {            if(((NodeInfo)this.treeView1.SelectedNode.Tag).tag==null || ((NodeInfo)this.treeView1.SelectedNode.Tag).tag.Equals(""))            {                MessageBox.Show(PdnResources.GetString("Menu.Pleasesetiirst.Text") + PdnResources.GetString("Menu.Set.Generalsettings.Thearchivefilesavesthepath.text"));                return;            }            //如果选择的节点是常规操作,选择什么路径就存储到什么路径            if (((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 1)            {                this.saveBitmapToFolder();                //刷新节点                this.listView1.Items.Clear();                this.imageList1.Images.Clear();                this.showFileList(this.treeView1.SelectedNode.Tag);            }            //如果选择的节点是通用分析、专用分析            else if (((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 2 || ((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 3)            {                if (this.treeView1.SelectedNode.Parent==null)                {                    MessageBox.Show(PdnResources.GetString("Menu.selewhichcannotbetoredintheroot.Text"));                }                else                {                    if (((NodeInfo)this.treeView1.SelectedNode.Tag).folderType==3)                    {                        MessageBox.Show(PdnResources.GetString("Menu.selectanothernodewhtbestoredinhestan.Text"));                    }                    else                    {                        this.saveBitmapToFolder();                        //刷新节点                        this.listView1.Items.Clear();                        this.imageList1.Images.Clear();                        this.showFileList(this.treeView1.SelectedNode.Tag);                    }                }            }            //如果选择的节点是搜索结果,则提示用户,不能添加到这里            else if (((NodeInfo)this.treeView1.SelectedNode.Tag).rootType == 4)            {                MessageBox.Show(PdnResources.GetString("Menu.dwhichcannotbestoredinthesearchresu.Text"));            }        }        private void saveBitmapToFolder()        {            if (this.appWorkspace.ActiveDocumentWorkspace == null)                return;            using (Bitmap bitmap = this.appWorkspace.ActiveDocumentWorkspace.CompositionSurface.CreateAliasedBitmap())            {                //获取文件后缀名                string extension = Path.GetExtension(this.appWorkspace.ActiveDocumentWorkspace.GetFriendlyName());                //获取不带后缀的文件名                string noExtension = Path.GetFileNameWithoutExtension(this.appWorkspace.ActiveDocumentWorkspace.GetFriendlyName());                using (Bitmap dstBitmap = bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), bitmap.PixelFormat))                {                    //保存图片                    ImageCodecInfo icf = GdiPlusFileType.GetImageCodecInfo(ImageFormat.Jpeg);                    if (extension.Equals(".jpg"))                    {                        icf = GdiPlusFileType.GetImageCodecInfo(ImageFormat.Jpeg);                    }                    else if (extension.Equals(".bmp"))                    {                        icf = GdiPlusFileType.GetImageCodecInfo(ImageFormat.Bmp);                    }                    else if (extension.Equals(".tiff"))                    {                        icf = GdiPlusFileType.GetImageCodecInfo(ImageFormat.Tiff);                    }                    EncoderParameters parms = new EncoderParameters(1);                    EncoderParameter parm = new EncoderParameter(Encoder.Quality, 100L);                    parms.Param[0] = parm;                    dstBitmap.Save(((NodeInfo)this.treeView1.SelectedNode.Tag).tag +"\\"+ this.appWorkspace.ActiveDocumentWorkspace.GetFriendlyName(), icf, parms);                    //组织配置文件的数据                    PicConfigModel picConfigModel = new PicConfigModel();                    picConfigModel.rule = new PicConfigModel.Rule();                    if (this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel != null && this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel.pixel_length != 0)                    {                        picConfigModel.rule.ruler_name = this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel.ruler_name;                        picConfigModel.rule.gain_multiple = this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel.gain_multiple;                        picConfigModel.rule.pixel_length = (int)this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel.pixel_length;                        picConfigModel.rule.physical_length = this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel.physical_length;                        picConfigModel.rule.ruler_units = this.appWorkspace.ActiveDocumentWorkspace.xmlSaveModel.ruler_units;                    }                    //按路径和名称保存xml文件                    string userInfoXml = XmlSerializeHelper.XmlSerialize<PicConfigModel>(picConfigModel);                    //xml保存路径                    string filePath = ((NodeInfo)this.treeView1.SelectedNode.Tag).tag + "\\" + noExtension + ".xml";                    //保存xml                    FileOperationHelper.WriteStringToFile(userInfoXml, filePath, FileMode.Create);                }            }        }        /// <summary>        /// 添加文件夹类型的node节点        /// </summary>        /// <param name="rootType"></param>        /// <param name="dir"></param>        /// <returns></returns>        private TreeNode AddFolderTreeNode(int rootType, string dir, int id)        {            NodeInfo info = new NodeInfo();            info.rootType = rootType;            info.folderType = 1;            info.tag = dir;            info.id = id;            TreeNode node = new TreeNode();            node.Text = Path.GetFileName(dir);            node.Tag = info;            if (Directory.GetDirectories(dir).Length > 0)            {                TreeNode temp = new TreeNode();                temp.Text = "";                node.Nodes.Add(temp);            }            return node;        }        private void ProjectEngineering_FormClosing(object sender, FormClosingEventArgs e)        {            this.appWorkspace.toolBar.RefreshBtnSelect(false, "OpenProject");            this.appWorkspace.toolsPanel.RefreshBtnSelect(false, "OpenProject");        }        /// <summary>        /// 添加项目类型的node节点        /// </summary>        /// <param name="rootType"></param>        /// <param name="dir"></param>        /// <returns></returns>        private TreeNode AddProjectTreeNode(int folderType, int rootType, string path, mic_project mic_Project)        {            NodeInfo info = new NodeInfo();            info.rootType = rootType;            info.folderType = folderType;            info.tag = path;            info.id = mic_Project.id;            TreeNode node = new TreeNode();            if (mic_Project.project_path == null)            {                node.Text = PdnResources.GetString(mic_Project.project_name);            }            else             {                node.Text = mic_Project.project_name;            }                        node.Tag = info;                        if (folderType==3 && !System.IO.Directory.Exists(path))                System.IO.Directory.CreateDirectory(path);            //这里应该判断是否再数据库中有下级            if(mic_project_BLL.FindCountByParentId(mic_Project.id)>0)            //if (Directory.GetDirectories(path).Length > 0)            {                TreeNode temp = new TreeNode();                temp.Text = "";                node.Nodes.Add(temp);            }            return node;        }        /// <summary>        /// 获取存储路径        /// </summary>        /// <param name="type">1通用分析 2专用分析</param>        /// <param name="analysis">分析的名称</param>        /// <returns></returns>        public NodeItem GetProjectPath(int type, string analysis, string originPath)        {            // TODO ZYH 这里数据库内应该存储多语言的key,创建的文件夹也应该是相应位置            //获取数据库信息            string languagePath = PdnResources.GetString(analysis);            if (string.IsNullOrEmpty(languagePath)) return null;                                    mic_project mic_Project = mic_project_BLL.FindItenByNameAndPath(Path.GetFileName(originPath), originPath);            if (mic_Project == null)            {                MessageBox.Show("项目目录不存在,请检查!");                return null;            }            //创建一个编号            int num = Startup.instance.configModel.ProjectCodeNum;            int addNum = 1000000 + num;            string code = "P" + addNum;            //获取路径            //string parentPath = "";            //if (type == 1) parentPath = GeneralAnalysisPath;            //if (type == 2) parentPath = DedicatedAnalysisPath;            //创建相应文件夹            //string path = parentPath + "\\" + PdnResources.GetString(analysis) + "\\" + code;            string path = originPath + "\\" + code;            if (!System.IO.Directory.Exists(path))            {                System.IO.Directory.CreateDirectory(path);            }            //更新配置文件编号+1            Startup.instance.configModel.ProjectCodeNum += 1;            string configXml = XmlSerializeHelper.XmlSerialize<ConfigModel>(Startup.instance.configModel);            string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Config.xml";            FileOperationHelper.WriteStringToFile(configXml, filePath, FileMode.Create);            NodeItem info = new NodeItem();            info.path = path;            info.code = code;            info.parentId = mic_Project.id;            return info;        }        /// <summary>        /// 通用专用分析,插入到数据库,添加节点        /// </summary>        /// <param name="analyzeSettingModel">分析的model</param>        /// <param name="folder">项目编号</param>        public void InsertIntoDB(AnalyzeSettingModel analyzeSettingModel, NodeItem item)        {            //添加目录主表            mic_project mic_Project = new mic_project();            mic_Project.parent_id = item.parentId;            mic_Project.project_name = item.code;            mic_Project.project_path = item.path;            mic_Project.project_type = 4;            mic_project_BLL.Add(mic_Project);            //添加项目主表            mic_project_info mic_Project_Info = new mic_project_info();            mic_Project_Info.project_code = item.code;            mic_Project_Info.project_company = analyzeSettingModel.inspectionDepartment;            mic_Project_Info.project_contact = analyzeSettingModel.contact;            mic_Project_Info.project_date = analyzeSettingModel.inspectionDate;            mic_Project_Info.project_id = mic_Project.id;            mic_Project_Info.project_rating = analyzeSettingModel.ratingDate;            mic_Project_Info.project_sender = analyzeSettingModel.inspectionPerson;            mic_project_info_BLL.Add(mic_Project_Info);            //添加项目子表            if (analyzeSettingModel.otherList!=null && analyzeSettingModel.otherList.Count>0)            {                foreach (OthersInfo othersInfo in analyzeSettingModel.otherList)                {                    mic_project_info_item s = new mic_project_info_item();                    s.info_id = mic_Project_Info.id;                    s.item_key = othersInfo.name;                    s.item_value = othersInfo.content;                    mic_project_info_item_BLL.Add(s);                }            }        }    }}
 |