using Metis.ParameterSet; using PaintDotNet; using PaintDotNet.Annotation; using PaintDotNet.Annotation.Enum; using PaintDotNet.Annotation.Measure; using PaintDotNet.Base.CommTool; using PaintDotNet.Base.SettingModel; using PaintDotNet.Menus; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Metis.Measuring { internal partial class GeometryMeasureDialog : FloatingToolForm { /// /// 展开前宽度 /// private int smallHeight = 339; /// /// 展开后宽度 /// private int bigHelght = 996; /// /// 是否展开 /// private bool isEnlarge = false; /// /// 测量属性实体 /// private MeasureListSetModel measureListSetModel; private ImageList imageList1 = new ImageList(); /// /// 工具集合 /// private List toolNameList = new List(); /// /// 工具别名集合 /// private List toolNickNameList = new List(); private Dictionary> filterDict = new Dictionary>(); private AppWorkspace appWorkspace; DocumentWorkspaceWindow _p2Document => MeasureActionMenu._p2Form?._document; private MeasureListInteractiveDataModel measureListInteractiveDataModel; private MeasureStyleModel measureStyleModel = Startup.instance.measureStyleModel; /// /// 多值类型 /// private List moreTypeList = new List() { "MeasureMulLine", "MeasureMulHVLine", "MeasureMulSegment", "MeasureMulVLine", "MeasureMulPLine", "MeasureHMulPLine","MeasureVMulPLine","MeasureMulParallelLine","MeasureVMulParallelLine","MeasureHMulParallelLine", }; #region 控件 private GroupBox groupBox2; private GroupBox groupBox3; private Label label1; private ComboBox comboBox1; private Label label6; private Label label5; private Label label4; private Label label3; private Label label2; public NumericUpDown numericUpDown5; private Button button3; private Button button2; private Button button1; private GroupBox groupBox4; private GroupBox groupBox5; private GroupBox groupBox6; private GroupBox groupBox7; private GroupBox groupBox8; private Button button4; private PaintDotNet.CustomControl.TreeViewEnhanced treeView1; private PaintDotNet.CustomControl.TreeViewEnhanced treeView2; private Button button8; private Button button7; private Button button6; private Button button5; private Button button12; private Button button11; private Button button10; private Button button9; private ListView listView2; private RadioButton radioButton8; private RadioButton radioButton7; private RadioButton radioButton6; private RadioButton radioButton5; private RadioButton radioButton4; private RadioButton radioButton3; private RadioButton radioButton2; private RadioButton radioButton1; private TextBox textBox2; private TextBox textBox1; private TextBox textBox4; private TextBox textBox3; private TextBox textBox8; private TextBox textBox7; private TextBox textBox6; private TextBox textBox5; private ListView listView1; private GroupBox groupBox1; #endregion public GeometryMeasureDialog(AppWorkspace appWorkspace) { InitializeComponent(); InitializeLanguageText(); this.Width = this.smallHeight; this.textBox1.Focus(); this.appWorkspace = appWorkspace; this.comboBox1.SelectedIndex = 0; #region [初始化listView1] this.listView1.View = View.Details; ColumnHeader header1 = new ColumnHeader(); header1.Text = PdnResources.GetString("Menu.params.text"); header1.TextAlign = HorizontalAlignment.Center; header1.Width = 0; this.listView1.Columns.Add(header1); ColumnHeader header5 = new ColumnHeader(); header5.Text = PdnResources.GetString("Menu.params.text"); header5.TextAlign = HorizontalAlignment.Center; header5.Width = 73; this.listView1.Columns.Add(header5); ColumnHeader header2 = new ColumnHeader(); header2.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text"); header2.TextAlign = HorizontalAlignment.Center; header2.Width = 73; this.listView1.Columns.Add(header2); ColumnHeader header3 = new ColumnHeader(); header3.Text = PdnResources.GetString("Menu.TheAngle.text"); header3.TextAlign = HorizontalAlignment.Center; header3.Width = 73; this.listView1.Columns.Add(header3); ColumnHeader header4 = new ColumnHeader(); header4.Text = PdnResources.GetString("Menu.area.text"); header4.TextAlign = HorizontalAlignment.Center; header4.Width = 73; this.listView1.Columns.Add(header4); this.imageList1.ImageSize = new System.Drawing.Size(2, 30); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.listView1.SmallImageList = this.imageList1; #endregion #region [初始化listView2] this.listView2.View = View.Details; ColumnHeader header = new ColumnHeader(); header.Text = PdnResources.GetString("Menu.Type.text"); header.TextAlign = HorizontalAlignment.Center; header.Width = 70; this.listView2.Columns.Add(header); this.imageList1.ImageSize = new System.Drawing.Size(2, 30); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; this.listView2.SmallImageList = this.imageList1; #endregion #region [获取测量属性实体] measureListSetModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListInteractiveModel.xml", FileMode.Open)); #endregion #region [数据属性初始化] this.treeView1.ItemHeight = 18; this.treeView2.ItemHeight = 18; this.allDataTree(); #endregion #region [元素属性初始化] this.allToolTree(); #endregion #region [默认展示长度及角度] if (this.appWorkspace.Units == null) { label3.Text = "µm"; } else { switch (this.appWorkspace.Units) { case MeasurementUnit.Inch://英寸 label3.Text = "in"; break; case MeasurementUnit.Mil://米尔 label3.Text = "mil"; break; case MeasurementUnit.Centimeter://厘米 label3.Text = "cm"; break; case MeasurementUnit.Millimeter://毫米 label3.Text = "mm"; break; case MeasurementUnit.Micron://微米 label3.Text = "µm"; break; case MeasurementUnit.Nano://纳米 label3.Text = "nm"; break; default: label3.Text = "µm"; break; } } MeasureStyleModel model = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\Measure\\" + Startup.instance.configModel.MeasurementStyle, FileMode.Open)); label5.Text = model.measureThreePointAngle.isAngle ? PdnResources.GetString("GeometryMeasure.mil") : PdnResources.GetString("Menu.degree.Text"); #endregion #region [获取参数] this.getLastData(); #endregion this.appWorkspace.ActiveDocumentWorkspaceChanged += new EventHandler(RefreshListView); this.FormClosing += new FormClosingEventHandler(this.saveLastData); } private new void InitializeLanguageText() { //this.groupBox13.Text = PdnResources.GetString("Menu.Puzzleeffect.text"); this.groupBox8.Text = PdnResources.GetString("Menu.imagecapture.Imagestitching.Focus.text"); this.comboBox1.Items.AddRange(new object[] { PdnResources.GetString("GeometryMeasure.Whole"), PdnResources.GetString("GeometryMeasure.SingleValue"), PdnResources.GetString("GeometryMeasure.Multivalued")}); this.groupBox1.Text = PdnResources.GetString("Menu.Tools.ToolsFast.Text"); this.radioButton8.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.radioButton7.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.radioButton6.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.radioButton5.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.radioButton4.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.radioButton3.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.radioButton2.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.radioButton1.Text = PdnResources.GetString("Menu.Isnotset.Text"); this.groupBox2.Text = PdnResources.GetString("MeasureAction.DataSheet"); this.label1.Text = PdnResources.GetString("Menu.filter.text") + ":"; this.groupBox3.Text = PdnResources.GetString("Menu.operation.text"); this.button3.Text = PdnResources.GetString("Menu.Edit.Delete.Text"); this.button2.Text = PdnResources.GetString("Menu.Empty.text"); this.button1.Text = PdnResources.GetString("MeasureAction.output"); this.label6.Text = PdnResources.GetString("MeasureAction.DecimalPlaces") + ":"; this.label5.Text = PdnResources.GetString("Menu.degree.Text"); this.label4.Text = PdnResources.GetString("Menu.TheAngle.text") + ":"; this.label2.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text") + ":"; this.groupBox4.Text = PdnResources.GetString("Menu.Tools.ToolsFast.Text"); this.groupBox5.Text = PdnResources.GetString("Menu.Dataattrs.text"); this.groupBox6.Text = PdnResources.GetString("Menu.Tools.Text"); this.button8.Text = PdnResources.GetString("Menu.down.Text"); this.button7.Text = PdnResources.GetString("Menu.upward.Text"); this.button6.Text = ">" + PdnResources.GetString("MeasureAction.Remove"); this.button5.Text = "<" + PdnResources.GetString("Menu.Addto.text"); this.groupBox7.Text = PdnResources.GetString("MeasureAction.Data"); this.button12.Text = PdnResources.GetString("Menu.down.Text"); this.button11.Text = PdnResources.GetString("Menu.upward.Text"); this.button10.Text = ">" + PdnResources.GetString("MeasureAction.Remove"); this.button9.Text = "<" + PdnResources.GetString("Menu.Addto.text"); this.groupBox8.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.Elementattributes.text"); this.Text = PdnResources.GetString("MeasureAction.InteractiveMeasurement"); } private void InitializeComponent() { this.groupBox1 = new System.Windows.Forms.GroupBox(); this.textBox8 = new System.Windows.Forms.TextBox(); this.textBox7 = new System.Windows.Forms.TextBox(); this.textBox6 = new System.Windows.Forms.TextBox(); this.textBox5 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox4 = new System.Windows.Forms.TextBox(); this.textBox3 = new System.Windows.Forms.TextBox(); this.radioButton8 = new System.Windows.Forms.RadioButton(); this.radioButton7 = new System.Windows.Forms.RadioButton(); this.radioButton6 = new System.Windows.Forms.RadioButton(); this.radioButton5 = new System.Windows.Forms.RadioButton(); this.radioButton4 = new System.Windows.Forms.RadioButton(); this.radioButton3 = new System.Windows.Forms.RadioButton(); this.radioButton2 = new System.Windows.Forms.RadioButton(); this.radioButton1 = new System.Windows.Forms.RadioButton(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.listView1 = new System.Windows.Forms.ListView(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label1 = new System.Windows.Forms.Label(); this.groupBox3 = new System.Windows.Forms.GroupBox(); 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.numericUpDown5 = new System.Windows.Forms.NumericUpDown(); 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.label2 = new System.Windows.Forms.Label(); this.groupBox4 = new System.Windows.Forms.GroupBox(); this.listView2 = new System.Windows.Forms.ListView(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.treeView1 = new PaintDotNet.CustomControl.TreeViewEnhanced(); this.groupBox6 = new System.Windows.Forms.GroupBox(); 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.groupBox7 = new System.Windows.Forms.GroupBox(); this.button12 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.button10 = new System.Windows.Forms.Button(); this.button9 = new System.Windows.Forms.Button(); this.groupBox8 = new System.Windows.Forms.GroupBox(); this.treeView2 = new PaintDotNet.CustomControl.TreeViewEnhanced(); this.groupBox1.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).BeginInit(); this.groupBox4.SuspendLayout(); this.groupBox5.SuspendLayout(); this.groupBox6.SuspendLayout(); this.groupBox7.SuspendLayout(); this.groupBox8.SuspendLayout(); this.SuspendLayout(); // // groupBox1 // this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox1.Controls.Add(this.textBox8); this.groupBox1.Controls.Add(this.textBox7); this.groupBox1.Controls.Add(this.textBox6); this.groupBox1.Controls.Add(this.textBox5); this.groupBox1.Controls.Add(this.textBox2); this.groupBox1.Controls.Add(this.textBox1); this.groupBox1.Controls.Add(this.textBox4); this.groupBox1.Controls.Add(this.textBox3); this.groupBox1.Controls.Add(this.radioButton8); this.groupBox1.Controls.Add(this.radioButton7); this.groupBox1.Controls.Add(this.radioButton6); this.groupBox1.Controls.Add(this.radioButton5); this.groupBox1.Controls.Add(this.radioButton4); this.groupBox1.Controls.Add(this.radioButton3); this.groupBox1.Controls.Add(this.radioButton2); this.groupBox1.Controls.Add(this.radioButton1); this.groupBox1.Location = new System.Drawing.Point(8, 3); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(310, 181); this.groupBox1.TabIndex = 3; this.groupBox1.TabStop = false; this.groupBox1.Text = "快捷工具"; // // textBox8 // this.textBox8.Location = new System.Drawing.Point(238, 130); this.textBox8.Name = "textBox8"; this.textBox8.ReadOnly = true; this.textBox8.Size = new System.Drawing.Size(61, 21); this.textBox8.TabIndex = 15; this.textBox8.Leave += new System.EventHandler(this.textBox1_TextChanged); // // textBox7 // this.textBox7.Location = new System.Drawing.Point(83, 130); this.textBox7.Name = "textBox7"; this.textBox7.ReadOnly = true; this.textBox7.Size = new System.Drawing.Size(70, 21); this.textBox7.TabIndex = 14; this.textBox7.Leave += new System.EventHandler(this.textBox1_TextChanged); // // textBox6 // this.textBox6.Location = new System.Drawing.Point(238, 96); this.textBox6.Name = "textBox6"; this.textBox6.ReadOnly = true; this.textBox6.Size = new System.Drawing.Size(61, 21); this.textBox6.TabIndex = 13; this.textBox6.Leave += new System.EventHandler(this.textBox1_TextChanged); // // textBox5 // this.textBox5.Location = new System.Drawing.Point(84, 96); this.textBox5.Name = "textBox5"; this.textBox5.ReadOnly = true; this.textBox5.Size = new System.Drawing.Size(69, 21); this.textBox5.TabIndex = 12; this.textBox5.Leave += new System.EventHandler(this.textBox1_TextChanged); // // textBox2 // this.textBox2.Location = new System.Drawing.Point(238, 26); this.textBox2.Name = "textBox2"; this.textBox2.ReadOnly = true; this.textBox2.Size = new System.Drawing.Size(61, 21); this.textBox2.TabIndex = 11; this.textBox2.Leave += new System.EventHandler(this.textBox1_TextChanged); // // textBox1 // this.textBox1.Location = new System.Drawing.Point(84, 26); this.textBox1.Name = "textBox1"; this.textBox1.ReadOnly = true; this.textBox1.Size = new System.Drawing.Size(69, 21); this.textBox1.TabIndex = 10; this.textBox1.Leave += new System.EventHandler(this.textBox1_TextChanged); // // textBox4 // this.textBox4.Location = new System.Drawing.Point(238, 61); this.textBox4.Name = "textBox4"; this.textBox4.ReadOnly = true; this.textBox4.Size = new System.Drawing.Size(61, 21); this.textBox4.TabIndex = 9; this.textBox4.Leave += new System.EventHandler(this.textBox1_TextChanged); // // textBox3 // this.textBox3.Location = new System.Drawing.Point(84, 62); this.textBox3.Name = "textBox3"; this.textBox3.ReadOnly = true; this.textBox3.Size = new System.Drawing.Size(69, 21); this.textBox3.TabIndex = 8; this.textBox3.Leave += new System.EventHandler(this.textBox1_TextChanged); // // radioButton8 // this.radioButton8.AutoSize = true; this.radioButton8.Location = new System.Drawing.Point(165, 132); this.radioButton8.Name = "radioButton8"; this.radioButton8.Size = new System.Drawing.Size(59, 16); this.radioButton8.TabIndex = 7; this.radioButton8.TabStop = true; this.radioButton8.Text = "未设置"; this.radioButton8.UseVisualStyleBackColor = true; this.radioButton8.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // radioButton7 // this.radioButton7.AutoSize = true; this.radioButton7.Location = new System.Drawing.Point(11, 132); this.radioButton7.Name = "radioButton7"; this.radioButton7.Size = new System.Drawing.Size(59, 16); this.radioButton7.TabIndex = 6; this.radioButton7.TabStop = true; this.radioButton7.Text = "未设置"; this.radioButton7.UseVisualStyleBackColor = true; this.radioButton7.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // radioButton6 // this.radioButton6.AutoSize = true; this.radioButton6.Location = new System.Drawing.Point(165, 97); this.radioButton6.Name = "radioButton6"; this.radioButton6.Size = new System.Drawing.Size(59, 16); this.radioButton6.TabIndex = 5; this.radioButton6.TabStop = true; this.radioButton6.Text = "未设置"; this.radioButton6.UseVisualStyleBackColor = true; this.radioButton6.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // radioButton5 // this.radioButton5.AutoSize = true; this.radioButton5.Location = new System.Drawing.Point(11, 97); this.radioButton5.Name = "radioButton5"; this.radioButton5.Size = new System.Drawing.Size(59, 16); this.radioButton5.TabIndex = 4; this.radioButton5.TabStop = true; this.radioButton5.Text = "未设置"; this.radioButton5.UseVisualStyleBackColor = true; this.radioButton5.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // radioButton4 // this.radioButton4.AutoSize = true; this.radioButton4.Location = new System.Drawing.Point(163, 62); this.radioButton4.Name = "radioButton4"; this.radioButton4.Size = new System.Drawing.Size(59, 16); this.radioButton4.TabIndex = 3; this.radioButton4.TabStop = true; this.radioButton4.Text = "未设置"; this.radioButton4.UseVisualStyleBackColor = true; this.radioButton4.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // radioButton3 // this.radioButton3.AutoSize = true; this.radioButton3.Location = new System.Drawing.Point(11, 62); this.radioButton3.Name = "radioButton3"; this.radioButton3.Size = new System.Drawing.Size(59, 16); this.radioButton3.TabIndex = 2; this.radioButton3.TabStop = true; this.radioButton3.Text = "未设置"; this.radioButton3.UseVisualStyleBackColor = true; this.radioButton3.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // radioButton2 // this.radioButton2.AutoSize = true; this.radioButton2.Location = new System.Drawing.Point(163, 27); this.radioButton2.Name = "radioButton2"; this.radioButton2.Size = new System.Drawing.Size(59, 16); this.radioButton2.TabIndex = 1; this.radioButton2.TabStop = true; this.radioButton2.Text = "未设置"; this.radioButton2.UseVisualStyleBackColor = true; this.radioButton2.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // radioButton1 // this.radioButton1.AutoSize = true; this.radioButton1.Location = new System.Drawing.Point(11, 27); this.radioButton1.Name = "radioButton1"; this.radioButton1.Size = new System.Drawing.Size(59, 16); this.radioButton1.TabIndex = 0; this.radioButton1.TabStop = true; this.radioButton1.Text = "未设置"; this.radioButton1.UseVisualStyleBackColor = true; this.radioButton1.Click += new System.EventHandler(this.radioButton_SelectedChanged); // // groupBox2 // this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox2.Controls.Add(this.listView1); this.groupBox2.Controls.Add(this.comboBox1); this.groupBox2.Controls.Add(this.label1); this.groupBox2.Location = new System.Drawing.Point(8, 190); this.groupBox2.Name = "groupBox2"; this.groupBox2.Size = new System.Drawing.Size(310, 305); this.groupBox2.TabIndex = 4; this.groupBox2.TabStop = false; this.groupBox2.Text = "数据表"; // // listView1 // this.listView1.FullRowSelect = true; this.listView1.GridLines = true; this.listView1.HideSelection = false; this.listView1.Location = new System.Drawing.Point(6, 56); this.listView1.Name = "listView1"; this.listView1.Size = new System.Drawing.Size(293, 243); this.listView1.TabIndex = 2; this.listView1.UseCompatibleStateImageBehavior = false; // // comboBox1 // this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.FormattingEnabled = true; this.comboBox1.Location = new System.Drawing.Point(45, 30); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(254, 20); this.comboBox1.TabIndex = 1; this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(6, 33); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(41, 12); this.label1.TabIndex = 0; this.label1.Text = "筛选:"; // // groupBox3 // this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox3.Controls.Add(this.button4); this.groupBox3.Controls.Add(this.button3); this.groupBox3.Controls.Add(this.button2); this.groupBox3.Controls.Add(this.button1); this.groupBox3.Controls.Add(this.numericUpDown5); this.groupBox3.Controls.Add(this.label6); this.groupBox3.Controls.Add(this.label5); this.groupBox3.Controls.Add(this.label4); this.groupBox3.Controls.Add(this.label3); this.groupBox3.Controls.Add(this.label2); this.groupBox3.Location = new System.Drawing.Point(8, 501); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(310, 110); this.groupBox3.TabIndex = 5; this.groupBox3.TabStop = false; this.groupBox3.Text = "操作"; // // button4 // this.button4.Location = new System.Drawing.Point(259, 18); this.button4.Name = "button4"; this.button4.Size = new System.Drawing.Size(40, 23); this.button4.TabIndex = 10; this.button4.Text = ">>"; this.button4.UseVisualStyleBackColor = true; this.button4.Click += new System.EventHandler(this.button4_Click); // // button3 // this.button3.Location = new System.Drawing.Point(165, 18); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(38, 23); this.button3.TabIndex = 9; this.button3.Text = "删除"; this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.Delete_Click); // // button2 // this.button2.Location = new System.Drawing.Point(211, 18); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(40, 23); this.button2.TabIndex = 8; this.button2.Text = "清空"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.Clear_Click); // // button1 // this.button1.Location = new System.Drawing.Point(259, 63); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(40, 23); this.button1.TabIndex = 7; this.button1.Text = "输出"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // numericUpDown5 // this.numericUpDown5.Location = new System.Drawing.Point(165, 64); this.numericUpDown5.Maximum = new decimal(new int[] { 10, 0, 0, 0}); this.numericUpDown5.Minimum = new decimal(new int[] { 2, 0, 0, 0}); this.numericUpDown5.Name = "numericUpDown5"; this.numericUpDown5.Size = new System.Drawing.Size(86, 21); this.numericUpDown5.TabIndex = 6; this.numericUpDown5.Value = new decimal(new int[] { 2, 0, 0, 0}); this.numericUpDown5.ValueChanged += new System.EventHandler(this.numericUpDown5_ValueChanged); // // label6 // this.label6.AutoSize = true; this.label6.Location = new System.Drawing.Point(82, 68); this.label6.Name = "label6"; this.label6.Size = new System.Drawing.Size(77, 12); this.label6.TabIndex = 4; this.label6.Text = "小数点位数:"; // // label5 // this.label5.AutoSize = true; this.label5.Location = new System.Drawing.Point(113, 23); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(17, 12); this.label5.TabIndex = 3; this.label5.Text = "度"; // // label4 // this.label4.AutoSize = true; this.label4.Location = new System.Drawing.Point(76, 23); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(41, 12); this.label4.TabIndex = 2; this.label4.Text = "角度:"; // // label3 // this.label3.AutoSize = true; this.label3.Location = new System.Drawing.Point(43, 23); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(17, 12); this.label3.TabIndex = 1; this.label3.Text = "mm"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(6, 23); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(41, 12); this.label2.TabIndex = 0; this.label2.Text = "长度:"; // // groupBox4 // this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox4.Controls.Add(this.listView2); this.groupBox4.Location = new System.Drawing.Point(324, 3); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(83, 608); this.groupBox4.TabIndex = 6; this.groupBox4.TabStop = false; this.groupBox4.Text = "快捷工具"; // // listView2 // this.listView2.FullRowSelect = true; this.listView2.GridLines = true; this.listView2.HideSelection = false; this.listView2.Location = new System.Drawing.Point(6, 20); this.listView2.Name = "listView2"; this.listView2.Size = new System.Drawing.Size(71, 578); this.listView2.TabIndex = 0; this.listView2.UseCompatibleStateImageBehavior = false; // // groupBox5 // this.groupBox5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox5.Controls.Add(this.treeView1); this.groupBox5.Location = new System.Drawing.Point(413, 3); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(220, 608); this.groupBox5.TabIndex = 7; this.groupBox5.TabStop = false; this.groupBox5.Text = "数据属性"; // // treeView1 // this.treeView1.Location = new System.Drawing.Point(6, 20); this.treeView1.Name = "treeView1"; this.treeView1.Size = new System.Drawing.Size(208, 578); this.treeView1.TabIndex = 17; // // groupBox6 // this.groupBox6.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox6.Controls.Add(this.button8); this.groupBox6.Controls.Add(this.button7); this.groupBox6.Controls.Add(this.button6); this.groupBox6.Controls.Add(this.button5); this.groupBox6.Location = new System.Drawing.Point(639, 3); this.groupBox6.Name = "groupBox6"; this.groupBox6.Size = new System.Drawing.Size(107, 301); this.groupBox6.TabIndex = 8; this.groupBox6.TabStop = false; this.groupBox6.Text = "工具"; // // button8 // this.button8.Location = new System.Drawing.Point(16, 219); this.button8.Name = "button8"; this.button8.Size = new System.Drawing.Size(75, 23); this.button8.TabIndex = 3; this.button8.Text = "向下"; this.button8.UseVisualStyleBackColor = true; this.button8.Click += new System.EventHandler(this.button8_Click); // // button7 // this.button7.Location = new System.Drawing.Point(16, 164); this.button7.Name = "button7"; this.button7.Size = new System.Drawing.Size(75, 23); this.button7.TabIndex = 2; this.button7.Text = "向上"; this.button7.UseVisualStyleBackColor = true; this.button7.Click += new System.EventHandler(this.button7_Click); // // button6 // this.button6.Location = new System.Drawing.Point(16, 109); this.button6.Name = "button6"; this.button6.Size = new System.Drawing.Size(75, 23); this.button6.TabIndex = 1; this.button6.Text = ">移除"; this.button6.UseVisualStyleBackColor = true; this.button6.Click += new System.EventHandler(this.button6_Click); // // button5 // this.button5.Location = new System.Drawing.Point(16, 54); this.button5.Name = "button5"; this.button5.Size = new System.Drawing.Size(75, 23); this.button5.TabIndex = 0; this.button5.Text = "<添加"; this.button5.UseVisualStyleBackColor = true; this.button5.Click += new System.EventHandler(this.button5_Click); // // groupBox7 // this.groupBox7.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox7.Controls.Add(this.button12); this.groupBox7.Controls.Add(this.button11); this.groupBox7.Controls.Add(this.button10); this.groupBox7.Controls.Add(this.button9); this.groupBox7.Location = new System.Drawing.Point(639, 310); this.groupBox7.Name = "groupBox7"; this.groupBox7.Size = new System.Drawing.Size(107, 301); this.groupBox7.TabIndex = 9; this.groupBox7.TabStop = false; this.groupBox7.Text = "数据"; // // button12 // this.button12.Location = new System.Drawing.Point(16, 214); this.button12.Name = "button12"; this.button12.Size = new System.Drawing.Size(75, 23); this.button12.TabIndex = 3; this.button12.Text = "向下"; this.button12.UseVisualStyleBackColor = true; this.button12.Click += new System.EventHandler(this.button12_Click); // // button11 // this.button11.Location = new System.Drawing.Point(16, 159); this.button11.Name = "button11"; this.button11.Size = new System.Drawing.Size(75, 23); this.button11.TabIndex = 2; this.button11.Text = "向上"; this.button11.UseVisualStyleBackColor = true; this.button11.Click += new System.EventHandler(this.button11_Click); // // button10 // this.button10.Location = new System.Drawing.Point(16, 104); this.button10.Name = "button10"; this.button10.Size = new System.Drawing.Size(75, 23); this.button10.TabIndex = 1; this.button10.Text = ">移除"; this.button10.UseVisualStyleBackColor = true; this.button10.Click += new System.EventHandler(this.button10_Click); // // button9 // this.button9.Location = new System.Drawing.Point(16, 49); this.button9.Name = "button9"; this.button9.Size = new System.Drawing.Size(75, 23); this.button9.TabIndex = 0; this.button9.Text = "<添加"; this.button9.UseVisualStyleBackColor = true; this.button9.Click += new System.EventHandler(this.button9_Click); // // groupBox8 // this.groupBox8.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.groupBox8.Controls.Add(this.treeView2); this.groupBox8.Location = new System.Drawing.Point(752, 3); this.groupBox8.Name = "groupBox8"; this.groupBox8.Size = new System.Drawing.Size(220, 608); this.groupBox8.TabIndex = 10; this.groupBox8.TabStop = false; this.groupBox8.Text = "元素属性"; // // treeView2 // this.treeView2.Location = new System.Drawing.Point(6, 20); this.treeView2.Name = "treeView2"; this.treeView2.Size = new System.Drawing.Size(208, 578); this.treeView2.TabIndex = 18; // // GeometryMeasureDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.BackColor = System.Drawing.SystemColors.Control; this.ClientSize = new System.Drawing.Size(980, 621); this.Controls.Add(this.groupBox8); this.Controls.Add(this.groupBox7); this.Controls.Add(this.groupBox6); this.Controls.Add(this.groupBox5); this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Name = "GeometryMeasureDialog"; this.Text = "交互测量"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GeometryMeasureDialog_FormClosing); this.Controls.SetChildIndex(this.groupBox1, 0); this.Controls.SetChildIndex(this.groupBox2, 0); this.Controls.SetChildIndex(this.groupBox3, 0); this.Controls.SetChildIndex(this.groupBox4, 0); this.Controls.SetChildIndex(this.groupBox5, 0); this.Controls.SetChildIndex(this.groupBox6, 0); this.Controls.SetChildIndex(this.groupBox7, 0); this.Controls.SetChildIndex(this.groupBox8, 0); this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDown5)).EndInit(); this.groupBox4.ResumeLayout(false); this.groupBox5.ResumeLayout(false); this.groupBox6.ResumeLayout(false); this.groupBox7.ResumeLayout(false); this.groupBox8.ResumeLayout(false); this.ResumeLayout(false); } /// /// 刷新别名 /// public void RefreshAliasName() { this.measureStyleModel = Startup.instance.measureStyleModel; for (int i = 1; i <= 8; i++) { if (i > this.toolNameList.Count) { break; } string toolName = this.toolNameList[i - 1]; string enName = string.Empty; foreach (var item in measureListSetModel.AttributeMapAllDataNodes) { var tool = item.Attribute.Where(m => m.Text.Equals(toolName)).FirstOrDefault(); if (tool == null) { continue; } enName = tool.Name; } if (!string.IsNullOrEmpty(enName)) { string name; getAliasName(out name, enName); this.toolNickNameList[i - 1] = name; #region [文本赋值] switch (i) { case 1: textBox1.Text = name; break; case 2: textBox2.Text = name; break; case 3: textBox3.Text = name; break; case 4: textBox4.Text = name; break; case 5: textBox5.Text = name; break; case 6: textBox6.Text = name; break; case 7: textBox7.Text = name; break; case 8: textBox8.Text = name; break; } #endregion } } RefreshListView(null, null); } /// /// 获取参数保存 /// private void getLastData() { string filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\ParameterSaving\\MeasureListInteractiveDataModel.xml"; if (!File.Exists(filePath)) { measureListInteractiveDataModel = new MeasureListInteractiveDataModel(); } else { measureListInteractiveDataModel = XmlSerializeHelper.DESerializer(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open)); if (measureListInteractiveDataModel != null) { this.numericUpDown5.Value = measureListInteractiveDataModel.num; this.comboBox1.SelectedIndex = measureListInteractiveDataModel.selectIndex; foreach (var item in measureListInteractiveDataModel.FastToolList) { var index = measureListInteractiveDataModel.FastToolList.IndexOf(item) + 1; string name = item.name; if (name.Length >= 5) { name = $"{name.Substring(0, 4)}\r\n{name.Substring(4, name.Length - 4)}"; } switch (index) { case 1: radioButton1.Text = name; textBox1.Text = item.nickName; break; case 2: radioButton2.Text = name; textBox2.Text = item.nickName; break; case 3: radioButton3.Text = name; textBox3.Text = item.nickName; break; case 4: radioButton4.Text = name; textBox4.Text = item.nickName; break; case 5: radioButton5.Text = name; textBox5.Text = item.nickName; break; case 6: radioButton6.Text = name; textBox6.Text = item.nickName; break; case 7: radioButton7.Text = name; textBox7.Text = item.nickName; break; case 8: radioButton8.Text = name; textBox8.Text = item.nickName; break; } toolNameList.Add(item.name); toolNickNameList.Add(item.nickName); ListViewItem lvi = new ListViewItem(); lvi.Text = item.name; this.listView2.Items.Add(lvi); } if (measureListInteractiveDataModel.FastToolList.Count > 0) { radioButton_SelectedChanged(radioButton1, null); } } } } /// /// 数据属性初始化 /// private void allDataTree() { if (measureListSetModel != null && measureListSetModel.AttributeMapAllDataNodes != null) { for (int i = 0; i < measureListSetModel.AttributeMapAllDataNodes.Count; i++) { TreeNode firstNode = new TreeNode(); firstNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Name; for (int j = 0; j < measureListSetModel.AttributeMapAllDataNodes[i].Attribute.Count; j++) { TreeNode scondNode = new TreeNode(); scondNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Text; scondNode.Name = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Name; for (int k = 0; k < measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute.Count; k++) { if (measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute.Count > 0) { TreeNode thirdNode = new TreeNode(); thirdNode.Text = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute[k].Text; thirdNode.Name = measureListSetModel.AttributeMapAllDataNodes[i].Attribute[j].Attribute[k].Name; scondNode.Nodes.Add(thirdNode); } } firstNode.Nodes.Add(scondNode); } this.treeView2.Nodes.Add(firstNode); } } } /// /// 元素属性初始化 /// private void allToolTree() { if (measureListSetModel != null && measureListSetModel.AttributeMapDataNodes != null) { for (int i = 0; i < measureListSetModel.AttributeMapDataNodes.Count; i++) { TreeNode firstNode = new TreeNode(); firstNode.Text = measureListSetModel.AttributeMapDataNodes[i].Name; for (int j = 0; j < measureListSetModel.AttributeMapDataNodes[i].Attribute.Count; j++) { TreeNode scondNode = new TreeNode(); scondNode.Text = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Text; scondNode.Name = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Name; for (int k = 0; k < measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute.Count; k++) { if (measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute.Count > 0) { TreeNode thirdNode = new TreeNode(); thirdNode.Text = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute[k].Text; thirdNode.Name = measureListSetModel.AttributeMapDataNodes[i].Attribute[j].Attribute[k].Name; scondNode.Nodes.Add(thirdNode); } } firstNode.Nodes.Add(scondNode); } this.treeView1.Nodes.Add(firstNode); } } } /// /// 面板伸缩事件 /// /// /// private void button4_Click(object sender, EventArgs e) { if (isEnlarge) { this.Width = this.smallHeight; this.button4.Text = ">>"; } else { this.Width = this.bigHelght; this.button4.Text = "<<"; } this.isEnlarge = !isEnlarge; } #region [数据面板操作] /// /// 数据添加 /// /// /// private void button9_Click(object sender, EventArgs e) { if (this.treeView2.SelectedNode != null && this.treeView2.SelectedNode.Level == 2) { string name = string.Empty; string orName = this.treeView2.SelectedNode.Name; if (this.treeView2.SelectedNode.Parent != null) name = this.treeView2.SelectedNode.Parent.Name; TreeNode treeNode = this.treeView2.SelectedNode; int count = treeView1.Nodes.Count; for (int i = 0; i < count; i++) { foreach (TreeNode node in this.treeView1.Nodes[i].Nodes) { if (node.Name == name) { this.treeView2.SelectedNode.Remove(); node.Nodes.Add(treeNode); } } } MeasureListSetModel.FirstNode.SecondNode.Item hasAttr = null; foreach (var item in measureListSetModel.AttributeMapAllDataNodes) { var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault(); if (tool != null) { hasAttr = tool.Attribute.Where(m => m.Name.Equals(orName)).FirstOrDefault(); if (hasAttr != null) { tool.Attribute.Remove(hasAttr); } } } foreach (var item in measureListSetModel.AttributeMapDataNodes) { var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault(); if (tool != null) { if (hasAttr != null) { tool.Attribute.Add(hasAttr); } } } RefreshListView(null, null); } } /// /// 数据移除 /// /// /// private void button10_Click(object sender, EventArgs e) { if (this.treeView1.SelectedNode != null && this.treeView1.SelectedNode.Level == 2) { string name = string.Empty; string orName = this.treeView1.SelectedNode.Name; if (this.treeView1.SelectedNode.Parent != null) name = this.treeView1.SelectedNode.Parent.Name; TreeNode treeNode = this.treeView1.SelectedNode; int count = treeView2.Nodes.Count; for (int i = 0; i < count; i++) { foreach (TreeNode node in this.treeView2.Nodes[i].Nodes) { if (node.Name == name) { this.treeView1.SelectedNode.Remove(); node.Nodes.Add(treeNode); } } } MeasureListSetModel.FirstNode.SecondNode.Item hasAttr = null; foreach (var item in measureListSetModel.AttributeMapDataNodes) { var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault(); if (tool != null) { hasAttr = tool.Attribute.Where(m => m.Name.Equals(orName)).FirstOrDefault(); if (hasAttr != null) { tool.Attribute.Remove(hasAttr); } } } foreach (var item in measureListSetModel.AttributeMapAllDataNodes) { var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault(); if (tool != null) { if (hasAttr != null) { tool.Attribute.Add(hasAttr); } } } RefreshListView(null, null); } } /// /// 数据向上 /// /// /// private void button11_Click(object sender, EventArgs e) { if (this.treeView1.SelectedNode == null || this.treeView1.SelectedNode.Level != 2) { return; } #region [树状图信息向上] string name = string.Empty; if (this.treeView1.SelectedNode.Parent != null) { name = this.treeView1.SelectedNode.Parent.Name; } TreeNode treeNode = this.treeView1.SelectedNode; int count = treeView1.Nodes.Count; for (int i = 0; i < count; i++) { foreach (TreeNode node in this.treeView1.Nodes[i].Nodes) { if (node.Name != name) { continue; } int index = node.Nodes.IndexOf(treeNode); if (index != 0) { TreeNode lastNode = node.Nodes[index - 1]; node.Nodes.RemoveAt(index); node.Nodes.RemoveAt(index - 1); node.Nodes.Insert(index, lastNode); node.Nodes.Insert(index - 1, treeNode); treeView1.Focus(); treeView1.SelectedNode = treeNode; } } } #endregion #region [表格信息向上] #endregion } /// /// 数据向下 /// /// /// private void button12_Click(object sender, EventArgs e) { if (this.treeView1.SelectedNode == null || this.treeView1.SelectedNode.Level != 2) { return; } #region [树状图信息向下] string name = string.Empty; if (this.treeView1.SelectedNode.Parent != null) { name = this.treeView1.SelectedNode.Parent.Name; } TreeNode treeNode = this.treeView1.SelectedNode; int count = treeView1.Nodes.Count; for (int i = 0; i < count; i++) { foreach (TreeNode node in this.treeView1.Nodes[i].Nodes) { if (node.Name != name) { continue; } int index = node.Nodes.IndexOf(treeNode); if (index != node.Nodes.Count - 1) { TreeNode lastNode = node.Nodes[index + 1]; node.Nodes.RemoveAt(index + 1); node.Nodes.RemoveAt(index); node.Nodes.Insert(index, lastNode); node.Nodes.Insert(index + 1, treeNode); treeView1.Focus(); treeView1.SelectedNode = treeNode; } } } #endregion #region [表格信息向下] #endregion } #endregion #region [工具面板操作] /// /// 工具添加 /// /// /// private void button5_Click(object sender, EventArgs e) { if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1) { return; } if (this.listView2.Items.Count >= 8) { MessageBox.Show("最多只能添加8个快捷工具!"); return; } if (this.toolNameList.Contains(this.treeView2.SelectedNode.Text)) { MessageBox.Show("不可添加重复的快捷工具!"); return; } #region [快捷工具列表中添加] ListViewItem lvi = new ListViewItem(); lvi.Text = this.treeView2.SelectedNode.Text; this.listView2.Items.Add(lvi); #endregion #region [快捷工具中添加] string measureTpye = this.treeView2.SelectedNode.Name; #region [通过类型 获取别名] string name; getAliasName(out name, measureTpye); #endregion this.addToolName(this.listView2.Items.Count, this.treeView2.SelectedNode.Text, name); this.toolNameList.Add(this.treeView2.SelectedNode.Text); this.toolNickNameList.Add(name); if (toolNameList.Count == 1) { radioButton_SelectedChanged(radioButton1, e); } #endregion } /// /// /// private void getAliasName(out string name, string typeName) { switch (typeName) { case "MeasureLine": name = this.measureStyleModel.measureLine.aliasName; break; case "MeasureLength": name = this.measureStyleModel.measureLength.aliasName; break; case "MeasureDistanceLine": name = this.measureStyleModel.measureDistanceLine.aliasName; break; case "MeasureHLine": name = this.measureStyleModel.measureHLine.aliasName; break; case "MeasureVLine": name = this.measureStyleModel.measureVLine.aliasName; break; case "MeasureMulLine": name = this.measureStyleModel.measureMulLine.aliasName; break; case "MeasureMulHVLine": name = this.measureStyleModel.measureMulHVLine.aliasName; break; case "MeasureMulSegment": name = this.measureStyleModel.measureMulSegment.aliasName; break; case "MeasureMulVLine": name = this.measureStyleModel.measureMulVLine.aliasName; break; case "MeasureBrokenLine": name = this.measureStyleModel.measureBrokenLine.aliasName; break; case "MeasureTraceCurve": name = this.measureStyleModel.measureTraceCurve.aliasName; break; case "MeasureCurveLine": name = this.measureStyleModel.measureCurveLine.aliasName; break; case "MeasurePLine": name = this.measureStyleModel.measurePLine.aliasName; break; case "MeasureMulPLine": name = this.measureStyleModel.measureMulPLine.aliasName; break; case "MeasureHMulPLine": name = this.measureStyleModel.measureHMulPLine.aliasName; break; case "MeasureVMulPLine": name = this.measureStyleModel.measureVMulPLine.aliasName; break; case "MeasurePointHLine": name = this.measureStyleModel.measurePointHLine.aliasName; break; case "MeasureParallelLine": name = this.measureStyleModel.measureParallelLine.aliasName; break; case "MeasureMulParallelLine": name = this.measureStyleModel.measureMulParallelLine.aliasName; break; case "MeasureVMulParallelLine": name = this.measureStyleModel.measureVMulParallelLine.aliasName; break; case "MeasureHMulParallelLine": name = this.measureStyleModel.measureHMulParallelLine.aliasName; break; case "MeasureClosedCurve": name = this.measureStyleModel.measureClosedCurve.aliasName; break; case "MeasurePolygon": name = this.measureStyleModel.measurePolygon.aliasName; break; case "MeasureRectangle": name = this.measureStyleModel.measureRectangle.aliasName; break; case "MeasureRandRectangle": name = this.measureStyleModel.measureRandRectangle.aliasName; break; case "MeasureSquare": name = this.measureStyleModel.measureSquare.aliasName; break; case "MeasureRandSquare": name = this.measureStyleModel.measureRandSquare.aliasName; break; case "MeasureTracePolygon": name = this.measureStyleModel.measureTracePolygon.aliasName; break; case "MeasureCircle": name = this.measureStyleModel.measureCircle.aliasName; break; case "MeasureInnerCircle": name = this.measureStyleModel.measureInnerCircle.aliasName; break; case "MeasureOuterCircle": name = this.measureStyleModel.measureOuterCircle.aliasName; break; case "MeasureDiameterCircle": name = this.measureStyleModel.measureDiameterCircle.aliasName; break; case "MeasurePointCenterSize": name = this.measureStyleModel.measurePointCenterSize.aliasName; break; case "MeasureCenterCenterSize": name = this.measureStyleModel.measureCenterCenterSize.aliasName; break; case "MeasurePointArcSize": name = this.measureStyleModel.measurePointArcSize.aliasName; break; case "MeasureTwoLineVLDistance": name = this.measureStyleModel.measureTwoLineVLDistance.aliasName; break; case "MeasurePointEdgeSize": name = this.measureStyleModel.measurePointEdgeSize.aliasName; break; case "MeasureThreePointAngle": name = this.measureStyleModel.measureThreePointAngle.aliasName; break; case "MeasureFourPointAngle": name = this.measureStyleModel.measureFourPointAngle.aliasName; break; case "MeasureThreePointArc": name = this.measureStyleModel.measureThreePointArc.aliasName; break; default: name = string.Empty; break; } } /// /// 工具移除 /// /// /// private void button6_Click(object sender, EventArgs e) { if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected) { int index = this.listView2.FocusedItem.Index; this.removeToolName(index, this.listView2.FocusedItem.Text); this.listView2.Items.RemoveAt(index); } } /// /// 工具向上 /// /// /// private void button7_Click(object sender, EventArgs e) { if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1) { return; } #region [快捷工具列表中向上] if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected) { int index = this.listView2.FocusedItem.Index; if (index != 0) { ListViewItem item = this.listView2.FocusedItem; ListViewItem lastItem = this.listView2.Items[index - 1]; this.listView2.Items.RemoveAt(index); this.listView2.Items.RemoveAt(index - 1); this.listView2.Items.Insert(index - 1, item); this.listView2.Items.Insert(index, lastItem); moveToolName(index, 1); } } #endregion } /// /// 工具向下 /// /// /// private void button8_Click(object sender, EventArgs e) { if (this.treeView2.SelectedNode == null || this.treeView2.SelectedNode.Level != 1) { return; } #region [快捷工具列表中向下] if (this.listView2.FocusedItem != null && this.listView2.FocusedItem.Selected) { int index = this.listView2.FocusedItem.Index; if (index != this.listView2.Items.Count - 1) { ListViewItem item = this.listView2.FocusedItem; ListViewItem lastItem = this.listView2.Items[index + 1]; this.listView2.Items.RemoveAt(index + 1); this.listView2.Items.RemoveAt(index); this.listView2.Items.Insert(index, lastItem); this.listView2.Items.Insert(index + 1, item); moveToolName(index, 2); } } #endregion } /// /// 添加快捷工具面板 /// private void addToolName(int index, string name, string textName = "") { if (name.Length >= 5) { name = $"{name.Substring(0, 4)}\r\n{name.Substring(4, name.Length - 4)}"; } switch (index) { case 1: this.radioButton1.Text = name; if (!string.IsNullOrEmpty(textName)) textBox1.Text = textName; break; case 2: this.radioButton2.Text = name; if (!string.IsNullOrEmpty(textName)) textBox2.Text = textName; break; case 3: this.radioButton3.Text = name; if (!string.IsNullOrEmpty(textName)) textBox3.Text = textName; break; case 4: this.radioButton4.Text = name; if (!string.IsNullOrEmpty(textName)) textBox4.Text = textName; break; case 5: this.radioButton5.Text = name; if (!string.IsNullOrEmpty(textName)) textBox5.Text = textName; break; case 6: this.radioButton6.Text = name; if (!string.IsNullOrEmpty(textName)) textBox6.Text = textName; break; case 7: this.radioButton7.Text = name; if (!string.IsNullOrEmpty(textName)) textBox7.Text = textName; break; case 8: this.radioButton8.Text = name; if (!string.IsNullOrEmpty(textName)) textBox8.Text = textName; break; } } /// /// 移除快捷工具面板 /// private void removeToolName(int index, string name) { this.toolNameList.RemoveAt(index); this.toolNickNameList.RemoveAt(index); this.resetButton(); for (int i = 0; i < toolNameList.Count; i++) { addToolName(i + 1, toolNameList[i], toolNickNameList[i]); } } /// /// 重置状态 /// private void resetButton() { this.radioButton1.Text = "未设置"; this.radioButton2.Text = "未设置"; this.radioButton3.Text = "未设置"; this.radioButton4.Text = "未设置"; this.radioButton5.Text = "未设置"; this.radioButton6.Text = "未设置"; this.radioButton7.Text = "未设置"; this.radioButton8.Text = "未设置"; this.textBox1.Text = ""; this.textBox2.Text = ""; this.textBox3.Text = ""; this.textBox4.Text = ""; this.textBox5.Text = ""; this.textBox6.Text = ""; this.textBox7.Text = ""; this.textBox8.Text = ""; #region [取消选中状态] if (radioButton1.Checked) { radioButton1.Checked = false; } else if (radioButton2.Checked) { radioButton2.Checked = false; } else if (radioButton3.Checked) { radioButton3.Checked = false; } else if (radioButton4.Checked) { radioButton4.Checked = false; } else if (radioButton5.Checked) { radioButton5.Checked = false; } else if (radioButton6.Checked) { radioButton6.Checked = false; } else if (radioButton7.Checked) { radioButton7.Checked = false; } else if (radioButton8.Checked) { radioButton8.Checked = false; } #endregion if (this.appWorkspace.ActiveDocumentWorkspace != null) { this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer; } } /// /// 向上/向下移动快捷工具面板 /// private void moveToolName(int index, int type) { switch (type) { case 1: string toolName = this.toolNameList[index]; string lastToolName = this.toolNameList[index - 1]; string toolNickName = this.toolNickNameList[index]; string lastNickName = this.toolNickNameList[index - 1]; this.toolNameList.RemoveAt(index); this.toolNameList.RemoveAt(index - 1); this.toolNickNameList.RemoveAt(index); this.toolNickNameList.RemoveAt(index - 1); this.toolNameList.Insert(index - 1, toolName); this.toolNameList.Insert(index, lastToolName); this.toolNickNameList.Insert(index - 1, toolNickName); this.toolNickNameList.Insert(index, lastNickName); break; case 2: string toolName1 = this.toolNameList[index]; string lastToolName1 = this.toolNameList[index + 1]; string toolNickName1 = this.toolNickNameList[index]; string lastNickName1 = this.toolNickNameList[index + 1]; this.toolNameList.RemoveAt(index + 1); this.toolNameList.RemoveAt(index); this.toolNickNameList.RemoveAt(index + 1); this.toolNickNameList.RemoveAt(index); this.toolNameList.Insert(index, lastToolName1); this.toolNameList.Insert(index + 1, toolName1); this.toolNickNameList.Insert(index, lastNickName1); this.toolNickNameList.Insert(index + 1, toolNickName1); break; } for (int i = 0; i < toolNameList.Count; i++) { addToolName(i + 1, toolNameList[i], toolNickNameList[i]); } } #endregion /// /// 修改别名 /// /// /// private void textBox1_TextChanged(object sender, EventArgs e) { var textbox = (TextBox)sender; int type = Convert.ToInt32(textbox.Name.Substring(textbox.Name.Length - 1, 1)); if (toolNickNameList.Count > 0 && toolNickNameList.Count >= type) { toolNickNameList[type - 1] = textbox.Text; RefreshListView(null, null); } } /// /// 选择快捷工具 /// /// /// private void radioButton_SelectedChanged(object sender, EventArgs e) { if (this.appWorkspace.ActiveDocumentWorkspace == null) { return; } var radioButto = (RadioButton)sender; if (!radioButto.Checked) { return; } int type = Convert.ToInt32(radioButto.Name.Substring(radioButto.Name.Length - 1, 1)); if (toolNameList.Count < type) { this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = new DrawToolType(); return; } var toolName = toolNameList[type - 1]; //获取工具英文 string enName = string.Empty; foreach (var item in measureListSetModel.AttributeMapAllDataNodes) { var tool = item.Attribute.Where(m => m.Text.Equals(toolName)).FirstOrDefault(); if (tool == null) { continue; } enName = tool.Name; } if (!string.IsNullOrEmpty(enName)) { if (this.appWorkspace.ActiveDocumentWorkspace != null) { this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1; this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = (DrawToolType)Enum.Parse(typeof(DrawToolType), enName); if (this.appWorkspace.Widgets != null && this.appWorkspace.Widgets.GeometryMeasureDialog.Visible) { ContinuousDrawingAction(); } } } } /// /// 连续绘制 /// /// /// private void ContinuousDrawingAction() { if (this.appWorkspace.ActiveDocumentWorkspace != null) { DocumentView.ContinuousDrawing = true; this.appWorkspace.continuousDrawingMeasure = true; for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++) { this.appWorkspace.DocumentWorkspaces[i].ContinuousDrawingMeasure = true; } this.appWorkspace.toolBar.RefreshBtnSelect(DocumentView.ContinuousDrawing, "ContinuousDrawingMeasure"); this.appWorkspace.toolsPanel.RefreshBtnSelect(DocumentView.ContinuousDrawing, "ContinuousDrawingMeasure"); if (!DocumentView.ContinuousDrawing && this.appWorkspace.ActiveDocumentWorkspace.ActiveTool >= DrawToolType.MeasureLine && this.appWorkspace.ActiveDocumentWorkspace.ActiveTool <= DrawToolType.MeasureThreePointArc) { this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1; this.appWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer; } DocumentView.ContinuousDrawing = true; } if (this.appWorkspace.cameraPreviewDialog != null && !this.appWorkspace.cameraPreviewDialog.IsDisposed) { this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure = true; if (this.appWorkspace.ActiveDocumentWorkspace != null) this.appWorkspace.continuousDrawingMeasure = true; for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++) { this.appWorkspace.DocumentWorkspaces[i].ContinuousDrawingMeasure = true; } this.appWorkspace.toolBar.RefreshBtnSelect(this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure"); this.appWorkspace.toolsPanel.RefreshBtnSelect(this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure, "ContinuousDrawingMeasure"); if (!this.appWorkspace.cameraPreviewDialog.documentWorkspace.ContinuousDrawingMeasure) { this.appWorkspace.cameraPreviewDialog.documentWorkspace.ActiveTool = DrawToolType.Pointer; } if (this.appWorkspace.ActiveDocumentWorkspace != null && this.appWorkspace.ActiveDocumentWorkspace.ActiveTool >= DrawToolType.MeasureLine && this.appWorkspace.ActiveDocumentWorkspace.ActiveTool <= DrawToolType.MeasureThreePointArc) { this.appWorkspace.ActiveDocumentWorkspace.ToolNumber = -1; } DocumentView.ContinuousDrawing = true; } } /// /// 删除一条数据 /// /// /// private void Delete_Click(object sender, EventArgs e) { if (this.listView1.FocusedItem != null && this.listView1.FocusedItem.Selected) { var index = this.listView1.FocusedItem.Index; DrawObject drawObject = (DrawObject)this.listView1.Items[index].Tag; _p2Document?.GraphicsList.RemoveObj(drawObject); this.listView1.Items.RemoveAt(index); if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0) { for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++) { for (int i = 0; i < this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Count; i++) { if (!this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i].Equals(drawObject)) { continue; } this.appWorkspace.DocumentWorkspaces[k].GraphicsList.RemoveObj(drawObject); this.appWorkspace.DocumentWorkspaces[k].Refresh(); } } } } } /// /// 清空数据 /// /// /// private void Clear_Click(object sender, EventArgs e) { this.listView1.Items.Clear(); if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0) { for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++) { this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Clear(); this.appWorkspace.DocumentWorkspaces[k].Refresh(); } } _p2Document?.GraphicsList.Clear(); } /// /// 获取别名 /// /// private string getNickName(DrawObject measureDrawObject) { try { var enName = measureDrawObject.drawToolType.ToString(); string name; getAliasName(out name, enName); if (string.IsNullOrEmpty(name)) { foreach (var item in measureListSetModel.AttributeMapAllDataNodes) { var tool = item.Attribute.Where(m => m.Name.Equals(enName)).FirstOrDefault(); if (tool == null) { continue; } if (toolNameList.Contains(tool.Text)) { var index = toolNameList.IndexOf(tool.Text); return string.IsNullOrEmpty(toolNickNameList[index]) ? toolNameList[index] : toolNickNameList[index]; } return tool.Text; } } return name; } catch (Exception) { return "默认"; } } /// /// 获取数据 /// /// /// private void getLstViewItem(DrawObject measureDrawObject, int index) { double length; double area; double angle; string name = getNickName(measureDrawObject) + index; MeasureDrawObject measureData = (MeasureDrawObject)measureDrawObject; Dictionary data = measureData.GetData(); switch (measureDrawObject.drawToolType) { case DrawToolType.MeasureLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureDistanceLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureLength: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureHLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureVLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureMulLine: MeasureMulLine line = (MeasureMulLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= line.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(line.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= line.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureMulHVLine: MeasureMulHVLine measureMulHVLine = (MeasureMulHVLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureMulHVLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureMulHVLine.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureMulHVLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureMulSegment: MeasureMulSegment measureMulSegment = (MeasureMulSegment)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureMulSegment.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureMulSegment.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureMulSegment.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureMulVLine: MeasureMulVLine measureMulVLine = (MeasureMulVLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureMulVLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureMulVLine.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureMulVLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureBrokenLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureTraceCurve: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureCurveLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasurePLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureMulPLine: MeasureMulPLine measureMulPLine = (MeasureMulPLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureMulPLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureMulPLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureHMulPLine: MeasureHMulPLine measureHMulPLine = (MeasureHMulPLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureHMulPLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureHMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureHMulPLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureVMulPLine: MeasureVMulPLine measureVMulPLine = (MeasureVMulPLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureVMulPLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureVMulPLine.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureVMulPLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasurePointHLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureParallelLine: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureMulParallelLine: MeasureMulParallelLine measureVMulPLine1 = (MeasureMulParallelLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureVMulPLine1.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureVMulPLine1.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureVMulPLine1.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureVMulParallelLine: MeasureVMulParallelLine measureVMulParallelLine = (MeasureVMulParallelLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureVMulParallelLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureVMulParallelLine.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureVMulParallelLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureHMulParallelLine: MeasureHMulParallelLine measureHMulParallelLine = (MeasureHMulParallelLine)measureDrawObject; area = 0; angle = 0; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { for (int i = 0; i <= measureHMulParallelLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, Convert.ToDouble(measureHMulParallelLine.lengthParagraphs[i]), area, angle, measureDrawObject); } } else { for (int i = 0; i <= measureHMulParallelLine.lengthParagraphs.Count - 1; i++) { addListViewData(name, 0, area, angle, measureDrawObject); } } break; case DrawToolType.MeasureClosedCurve: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasurePolygon: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureRectangle: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureRandRectangle: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureSquare: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureRandSquare: MeasureDrawObject measureRandSquare = (MeasureDrawObject)measureDrawObject; if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureTracePolygon: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureCircle: if (data.ContainsKey(MeasureAttributes.PhysicalRadius)) { object val; data.TryGetValue(MeasureAttributes.PhysicalRadius, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureInnerCircle: if (data.ContainsKey(MeasureAttributes.PhysicalRadius)) { object val; data.TryGetValue(MeasureAttributes.PhysicalRadius, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureOuterCircle: if (data.ContainsKey(MeasureAttributes.PhysicalRadius)) { object val; data.TryGetValue(MeasureAttributes.PhysicalRadius, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureDiameterCircle: if (data.ContainsKey(MeasureAttributes.PhysicalRadius)) { object val; data.TryGetValue(MeasureAttributes.PhysicalRadius, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasurePointCenterSize: if (data.ContainsKey(MeasureAttributes.PhysicalDistance)) { object val; data.TryGetValue(MeasureAttributes.PhysicalDistance, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureCenterCenterSize: if (data.ContainsKey(MeasureAttributes.PhysicalDistance)) { object val; data.TryGetValue(MeasureAttributes.PhysicalDistance, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasurePointArcSize: if (data.ContainsKey(MeasureAttributes.PhysicalDistance)) { object val; data.TryGetValue(MeasureAttributes.PhysicalDistance, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureTwoLineVLDistance: if (data.ContainsKey(MeasureAttributes.PhysicalLength)) { object val; data.TryGetValue(MeasureAttributes.PhysicalLength, out val); length = Convert.ToDouble(val); } else { length = 0; } area = 0; angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasurePointEdgeSize: if (data.ContainsKey(MeasureAttributes.PhysicalDistance)) { object val; data.TryGetValue(MeasureAttributes.PhysicalDistance, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } angle = 0; addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureThreePointAngle: length = 0; area = 0; if (data.ContainsKey(MeasureAttributes.Angle)) { object val; data.TryGetValue(MeasureAttributes.Angle, out val); angle = Convert.ToDouble(val); } else { angle = 0; } addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureFourPointAngle: length = 0; area = 0; if (data.ContainsKey(MeasureAttributes.Angle)) { object val; data.TryGetValue(MeasureAttributes.Angle, out val); angle = Convert.ToDouble(val); } else { angle = 0; } addListViewData(name, length, area, angle, measureDrawObject, 1); break; case DrawToolType.MeasureThreePointArc: if (data.ContainsKey(MeasureAttributes.PhysicalRadius)) { object val; data.TryGetValue(MeasureAttributes.PhysicalRadius, out val); length = Convert.ToDouble(val); } else { length = 0; } if (data.ContainsKey(MeasureAttributes.PhysicalArea)) { object val; data.TryGetValue(MeasureAttributes.PhysicalArea, out val); area = Convert.ToDouble(val); } else { area = 0; } if (data.ContainsKey(MeasureAttributes.Angle)) { object val; data.TryGetValue(MeasureAttributes.Angle, out val); angle = Convert.ToDouble(val); } else { angle = 0; } addListViewData(name, length, area, angle, measureDrawObject, 1); break; } } /// /// 添加数据 /// /// /// /// /// /// /// private void addListViewData(string name, double length, double area, double angle, DrawObject drawObject, int type = 2) { if (!hasAttributes(drawObject.drawToolType.ToString(), "PhysicalLength") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalRadius") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalDistance") && !hasAttributes(drawObject.drawToolType.ToString(), "PhysicalCircumference")) { length = 0; } if (!hasAttributes(drawObject.drawToolType.ToString(), "PhysicalArea")) { area = 0; } if (!hasAttributes(drawObject.drawToolType.ToString(), "Angle")) { angle = 0; } int round = Convert.ToInt32(this.numericUpDown5.Value); length = Math.Round(length, round); area = Math.Round(area, round); angle = Math.Round(angle, round); ListViewItem lvi = new ListViewItem(); lvi.Text = name; lvi.SubItems.Add(name); lvi.SubItems.Add(length == 0 ? "-" : length.ToString()); lvi.SubItems.Add(angle == 0 ? "-" : angle.ToString()); lvi.SubItems.Add(area == 0 ? "-" : area.ToString()); lvi.Tag = drawObject; if (comboBox1.SelectedIndex == 0 || comboBox1.SelectedIndex == type) { this.listView1.Items.Add(lvi); } if (this.filterDict.ContainsKey(type)) { this.filterDict[type].Add(lvi); } else { this.filterDict.Add(type, new List() { lvi }); } } /// /// 刷新列表数据 /// /// /// public void RefreshListView(object sender, EventArgs e) { this.listView1.Items.Clear(); this.filterDict.Clear(); if (this.appWorkspace.DocumentWorkspaces != null && this.appWorkspace.DocumentWorkspaces.Length > 0) { for (int k = 0; k <= this.appWorkspace.DocumentWorkspaces.Length - 1; k++) { int index = 1; for (int i = this.appWorkspace.DocumentWorkspaces[k].GraphicsList.Count - 1; i >= 0; i--) { if (this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i].objectType == DrawClass.Measure) { var drawTool = (MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[k].GraphicsList[i]; getLstViewItem(drawTool, index); index++; } } } } if (_p2Document != null) { for (int i = 0; i < _p2Document.GraphicsList.Count; i++) { if (_p2Document.GraphicsList[i].objectType == DrawClass.Measure) { var drawTool = (MeasureDrawObject)_p2Document.GraphicsList[i]; getLstViewItem(drawTool, i + 1); } } } } /// /// 小数位数修改 /// /// /// private void numericUpDown5_ValueChanged(object sender, EventArgs e) { if (this.appWorkspace.Widgets != null) this.appWorkspace.Widgets.MeasureListDialog.numericUpDown1.Value = numericUpDown5.Value; RefreshListView(null, null); } /// /// 输出 /// /// /// private void button1_Click(object sender, EventArgs e) { if (this.listView1.Items.Count > 0) { this.InitialDataExcel(); } else MessageBox.Show("暂无数据可导出"); } /// /// 导出Excel /// private void InitialDataExcel() { DataTable dtb = new DataTable(); for (int c = 0; c < 5; c++) { dtb.Columns.Add(c.ToString()); } // 单位 DataRow dataRow = dtb.NewRow(); dataRow[0] = "单位"; dataRow[1] = this.appWorkspace.GetPxPerUnit()[2]; dtb.Rows.Add(dataRow); // 标题 dataRow = dtb.NewRow(); dataRow[0] = "图片名称"; dataRow[1] = "分组"; dataRow[2] = "测量工具名称"; dataRow[3] = "测量属性名称"; dataRow[4] = "值"; dtb.Rows.Add(dataRow); // 所有图片 for (int i = 0; i < this.appWorkspace.DocumentWorkspaces.Length; i++) { // 图片名称 string imgName = this.appWorkspace.DocumentWorkspaces[i].GetFriendlyName(); List measures = new List(); // 所有测量工具 for (int g = this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count - 1; g >= 0; g--) { if (this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].objectType == DrawClass.Measure) { if (comboBox1.SelectedIndex != 0) { //判断是单值还是多值,能否通过 if (!isOddOrven(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g])) { continue; } } measures.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString()); // 测量数据 Dictionary data = ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).GetData(); // 测量工具名称 string drawName = PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString() + ".Text"); List drawingPropertiesList = new List(); var name = this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString(); foreach (var item in measureListSetModel.AttributeMapDataNodes) { var tool = item.Attribute.Where(m => m.Name.Equals(name)).FirstOrDefault(); if (tool != null) { foreach (var str in tool.Attribute) { drawingPropertiesList.Add(str.Name); } } } //((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).drawingProperties.TryGetValue(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType, out drawingPropertiesList); int addCount = 0; foreach (var measure in measures) { if (measure.Equals(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString())) addCount++; } int round = Convert.ToInt32(this.numericUpDown5.Value); // 所有可见的属性 foreach (var item in drawingPropertiesList) { dataRow = dtb.NewRow(); string itemFirst = item.Substring(0, 1); string itemToLower = item.Substring(1, item.Length - 1).ToLower(); string itemAll = itemFirst + itemToLower; // 测量属性名称 string attributeName = PdnResources.GetString("Menu." + itemAll + ".text"); // 属性值 object value; MeasureAttributes type = (MeasureAttributes)System.Enum.Parse(typeof(MeasureAttributes), item); data.TryGetValue(type, out value); dataRow[0] = imgName; dataRow[1] = addCount; dataRow[2] = drawName; dataRow[3] = attributeName; dataRow[4] = Math.Round(Convert.ToDouble(value), round); dtb.Rows.Add(dataRow); } if (((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs != null && ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs.Count > 0) { int length = 0; foreach (var lengthParagraph in ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).lengthParagraphs) { length++; dataRow = dtb.NewRow(); dataRow[0] = imgName; dataRow[1] = addCount; dataRow[2] = drawName; dataRow[3] = "物理长度(段" + length + ")"; dataRow[4] = Math.Round(Convert.ToDouble(lengthParagraph), round); dtb.Rows.Add(dataRow); } } } } } MeasureListSettingDialog measureListSettingDialog = new MeasureListSettingDialog(this, "Template.Manager.item1.MeasureListAll", this.appWorkspace, dtb); if (measureListSettingDialog.hasModule) { measureListSettingDialog.StartPosition = FormStartPosition.CenterScreen; measureListSettingDialog.ShowDialog(); } else { measureListSettingDialog = null; } } /// /// 判断是单值还是多值 /// /// /// private bool isOddOrven(DrawObject drawObject) { int index = this.comboBox1.SelectedIndex; switch (index) { case 1: if (moreTypeList.Contains(drawObject.drawToolType.ToString())) { return false; } break; case 2: if (!moreTypeList.Contains(drawObject.drawToolType.ToString())) { return false; } break; } return true; } /// /// 判断是否含有属性 /// /// private bool hasAttributes(string enMapName, string AttributesName) { foreach (var item in measureListSetModel.AttributeMapDataNodes) { var tool = item.Attribute.Where(m => m.Name.Equals(enMapName)).FirstOrDefault(); if (tool != null) { var hasAttr = tool.Attribute.Where(m => m.Name.Equals(AttributesName)).FirstOrDefault(); if (hasAttr != null) { return true; } } } return false; } /// /// 筛选 /// /// /// private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { this.listView1.Items.Clear(); switch (comboBox1.SelectedIndex) { case 0: foreach (var item in filterDict) { listView1.Items.AddRange(item.Value.ToArray()); } break; case 1: List list; filterDict.TryGetValue(1, out list); if (list != null) { listView1.Items.AddRange(list.ToArray()); } break; case 2: List list2; filterDict.TryGetValue(2, out list2); if (list2 != null) { listView1.Items.AddRange(list2.ToArray()); } break; } } private void saveLastData(object sender, EventArgs e) { #region [树状信息保存] // 数据属性树状图保存 measureListSetModel.AttributeMapDataNodes = new List(); for (int i = 0; i < this.treeView1.Nodes.Count; i++) { MeasureListSetModel.FirstNode firstNode = new MeasureListSetModel.FirstNode(); firstNode.Attribute = new List(); firstNode.Name = this.treeView1.Nodes[i].Text; if (this.treeView1.Nodes[i].Nodes.Count > 0) { for (int j = 0; j < this.treeView1.Nodes[i].Nodes.Count; j++) { MeasureListSetModel.FirstNode.SecondNode second = new MeasureListSetModel.FirstNode.SecondNode(); second.Attribute = new List(); second.Text = this.treeView1.Nodes[i].Nodes[j].Text; second.Name = this.treeView1.Nodes[i].Nodes[j].Name; foreach (TreeNode Node in this.treeView1.Nodes[i].Nodes[j].Nodes) { MeasureListSetModel.FirstNode.SecondNode.Item item = new MeasureListSetModel.FirstNode.SecondNode.Item(); item.Text = Node.Text; item.Name = Node.Name; second.Attribute.Add(item); } firstNode.Attribute.Add(second); } } measureListSetModel.AttributeMapDataNodes.Add(firstNode); } // 数据属性(元素)树状图保存 measureListSetModel.AttributeMapAllDataNodes = new List(); for (int i = 0; i < this.treeView2.Nodes.Count; i++) { MeasureListSetModel.FirstNode firstNode = new MeasureListSetModel.FirstNode(); firstNode.Attribute = new List(); firstNode.Name = this.treeView2.Nodes[i].Text; if (this.treeView2.Nodes[i].Nodes.Count > 0) { for (int j = 0; j < this.treeView2.Nodes[i].Nodes.Count; j++) { MeasureListSetModel.FirstNode.SecondNode second = new MeasureListSetModel.FirstNode.SecondNode(); second.Attribute = new List(); second.Text = this.treeView2.Nodes[i].Nodes[j].Text; second.Name = this.treeView2.Nodes[i].Nodes[j].Name; foreach (TreeNode Node in this.treeView2.Nodes[i].Nodes[j].Nodes) { MeasureListSetModel.FirstNode.SecondNode.Item item = new MeasureListSetModel.FirstNode.SecondNode.Item(); item.Text = Node.Text; item.Name = Node.Name; second.Attribute.Add(item); } firstNode.Attribute.Add(second); } } measureListSetModel.AttributeMapAllDataNodes.Add(firstNode); } string configXml = XmlSerializeHelper.XmlSerialize(measureListSetModel); string filePath = System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListInteractiveModel.xml"; FileOperationHelper.WriteStringToFile(configXml, filePath, FileMode.Create); #endregion #region [保存参数] if (measureListInteractiveDataModel == null) { measureListInteractiveDataModel = new MeasureListInteractiveDataModel(); } measureListInteractiveDataModel.FastToolList = new List(); foreach (var item in toolNameList) { var index = toolNameList.IndexOf(item); string enName = string.Empty; foreach (var item1 in measureListSetModel.AttributeMapAllDataNodes) { var tool = item1.Attribute.Where(m => m.Text.Equals(item)).FirstOrDefault(); if (tool == null) { continue; } enName = tool.Name; } var fastTool = new FastTool(); fastTool.name = item; fastTool.enName = enName; fastTool.nickName = toolNickNameList[index]; measureListInteractiveDataModel.FastToolList.Add(fastTool); } measureListInteractiveDataModel.hasUsed = true; measureListInteractiveDataModel.num = Convert.ToInt32(this.numericUpDown5.Value); measureListInteractiveDataModel.selectIndex = comboBox1.SelectedIndex; filePath = Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\ParameterSaving\\MeasureListInteractiveDataModel.xml"; string porosityInfoXml = XmlSerializeHelper.XmlSerialize(measureListInteractiveDataModel); FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create); #endregion } private void GeometryMeasureDialog_FormClosing(object sender, FormClosingEventArgs e) { this.appWorkspace.toolBar.RefreshBtnSelect(false, "Geometry"); this.appWorkspace.toolsPanel.RefreshBtnSelect(false, "Geometry"); } } }