1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679 |
- using PaintDotNet.Annotation;
- using PaintDotNet.Annotation.Enum;
- using PaintDotNet.Annotation.Measure;
- using PaintDotNet.Annotation.relationModel;
- using PaintDotNet.Base.SettingModel;
- using PaintDotNet.Base.CommTool;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Data;
- using System.IO;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Windows.Forms;
- using Microsoft.Office.Interop.Excel;
- using Button = System.Windows.Forms.Button;
- using Label = System.Windows.Forms.Label;
- using DataTable = System.Data.DataTable;
- using Metis.Measuring;
- using Metis.ParameterSet;
- namespace PaintDotNet.Measuring
- {
- /// <summary>
- /// 测量列表
- /// </summary>
- internal class MeasureListDialog : FloatingToolForm
- {
- #region 控件
- private TabControl tabControl1;
- private TabPage tabPage1;
- private TabPage tabPage2;
- private Panel panel1;
- private Button button1;
- private Button button2;
- private Button button3;
- private Button button4;
- private Button button5;
- private Button button6;
- private ListView listView1;
- private ListView listView2;
- public NumericUpDown numericUpDown1;
- private Label label2;
- private ComboBox comboBox2;
- private ComboBox comboBox4;
- private ComboBox comboBox3;
- private Panel panel2;
- private ComboBox comboBox5;
- private ToolTip toolTip1;
- #endregion
- /// <summary>
- /// 主控件
- /// </summary>
- private AppWorkspace appWorkspace;
- /// <summary>
- /// 关系数据
- /// </summary>
- private static List<MeasureRelationModel> list;
- private MeasureRelationModel model;
- private Dictionary<Enum, string> valuePairs;
- /// <summary>
- /// 设置画面属性(绘制属性)
- /// </summary>
- public static TreeView drawNodes;
- /// <summary>
- /// 设置画面属性(数据属性)
- /// </summary>
- public static TreeView dataNodes;
- /// <summary>
- /// 设置画面属性(绘制元素属性)
- /// </summary>
- public static TreeView allDrawNodes;
- private Button button7;
- /// <summary>
- /// 设置画面属性(数据元素属性)
- /// </summary>
- public static TreeView allDataNodes;
- private MeasureModel measureModel = new MeasureModel();
- /// <param name="appWorkspace"></param>
- public MeasureListDialog(AppWorkspace appWorkspace)
- {
- if (list == null)
- {
- list = InvariantData.GetMeasureRelations();
- }
- this.appWorkspace = appWorkspace;
- InitializeComponent();
- InitializeLanguageText();
- InitializeButtonBackgroudImage();
- //InitializeUnitComboBox();
- InitializeClassComboBox();
- InitializeItemizedComboBox();
- InitializeItemizedHeader();
- InitializeTotalData();
- GetAttributeFromConfigurationFile();
- this.appWorkspace.ActiveDocumentWorkspaceChanged += new EventHandler(RefreshListView);//切换窗口
- this.appWorkspace.ActiveDocumentWorkspaceChanged += new EventHandler(SetDrawNodes);//切换窗口
- this.toolTip1 = new ToolTip();
- this.toolTip1.SetToolTip(this.button1, PdnResources.GetString("Menu.Setting.Text"));
- this.toolTip1.SetToolTip(this.button2, PdnResources.GetString("Menu.Exporttotemplate.Text"));
- this.toolTip1.SetToolTip(this.button3, PdnResources.GetString("Menu.Statistics.Text"));
- this.toolTip1.SetToolTip(this.button4, PdnResources.GetString("Menu.Edit.Delete.Text"));
- this.toolTip1.SetToolTip(this.button5, PdnResources.GetString("Menu.Empty.text"));
- this.toolTip1.SetToolTip(this.button6, PdnResources.GetString("Menu.Exporttoexcel.Text"));
- this.toolTip1.SetToolTip(this.button7, PdnResources.GetString("Menu.Exportall.text"));
- this.toolTip1.ShowAlways = true;
- getLastData();
- }
- private void InitializeButtonBackgroudImage()
- {
- this.button7.FlatStyle = FlatStyle.Flat;
- this.button7.FlatAppearance.BorderSize = 0;
- this.button7.BackgroundImageLayout = ImageLayout.Center;
- this.button7.BackgroundImage = PdnResources.GetImageResource("Icons.MenuMeasureListALLIcon.png").Reference;
- this.button1.FlatStyle = FlatStyle.Flat;
- this.button1.FlatAppearance.BorderSize = 0;
- this.button1.BackgroundImageLayout = ImageLayout.Center;
- this.button1.BackgroundImage = PdnResources.GetImageResource("Icons.MenuMeasureListSettingIcon.png").Reference;
- this.button2.FlatStyle = FlatStyle.Flat;
- this.button2.FlatAppearance.BorderSize = 0;
- this.button2.BackgroundImageLayout = ImageLayout.Center;
- this.button2.BackgroundImage = PdnResources.GetImageResource("Icons.MenuMeasureListTemplateIcon.png").Reference;
- this.button3.FlatStyle = FlatStyle.Flat;
- this.button3.FlatAppearance.BorderSize = 0;
- this.button3.BackgroundImageLayout = ImageLayout.Center;
- this.button3.BackgroundImage = PdnResources.GetImageResource("Icons.MenuMeasureListStatisticsIcon.png").Reference;
- this.button4.FlatStyle = FlatStyle.Flat;
- this.button4.FlatAppearance.BorderSize = 0;
- this.button4.BackgroundImageLayout = ImageLayout.Center;
- this.button4.BackgroundImage = PdnResources.GetImageResource("Icons.MenuMeasureListChoiseIcon.png").Reference;
- this.button5.FlatStyle = FlatStyle.Flat;
- this.button5.FlatAppearance.BorderSize = 0;
- this.button5.BackgroundImageLayout = ImageLayout.Center;
- this.button5.BackgroundImage = PdnResources.GetImageResource("Icons.MenuMeasureListClearIcon.png").Reference;
- this.button6.FlatStyle = FlatStyle.Flat;
- this.button6.FlatAppearance.BorderSize = 0;
- this.button6.BackgroundImageLayout = ImageLayout.Center;
- this.button6.BackgroundImage = PdnResources.GetImageResource("Icons.MenuMeasureListExportIcon.png").Reference;
- }
- /// <summary>
- /// 刷新列表数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- public void RefreshListView(object sender, EventArgs e)
- {
- this.InitializeItemizedComboBox();
- this.listView1.Items.Clear();
- this.InitializeItemizedHeader();
- this.InitializeItemizedData();
- this.listView2.Clear();
- this.InitializeTotalData();
- this.InitialMasterDataSheetData();
- //if (this.appWorkspace.ActiveDocumentWorkspace != null)
- //{
- //this.appWorkspace.ActiveDocumentWorkspace.UpdateMeasureUnit((MeasurementUnit)(this.comboBox1.SelectedIndex + 1));
- //}
- if (this.appWorkspace.ActiveDocumentWorkspace != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- int count = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
- for (int i = 0; i < count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- DrawObject dd = (DrawObject)this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- if (dd != null)
- {
- if (dd.Selected)
- {
- this.comboBox5.SelectedValue = dd.drawToolType;
- }
- }
- }
- }
- }
- this.listView1.SelectedIndexChanged -= new System.EventHandler(this.ListView1_SelectedIndexChanged);
- if (listView1.Items.Count > 0)
- {
- this.listView1.SelectedItems.Clear();
- for (int k = 0; k < this.listView1.Items.Count; k++)
- {
- DrawObject dd = (DrawObject)this.listView1.Items[k].Tag;
- if (dd != null)
- {
- if (dd.Selected)
- {
- this.listView1.Items[k].Selected = true;
- }
- }
- }
- }
- if (listView2.Items.Count > 1)
- {
- this.listView2.SelectedItems.Clear();
- for (int i = 0; i < this.listView2.Items.Count; i++)
- {
- DrawObject dd = (DrawObject)this.listView2.Items[i].Tag;
- if (dd != null)
- {
- if (dd.Selected)
- {
- this.listView2.Items[i].Selected = true;
- }
- }
- }
- }
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListView1_SelectedIndexChanged);
- }
- /// <summary>
- /// 设置绘制属性
- /// </summary>
- public void SetDrawNodes(object sender, EventArgs e)
- {
- if (drawNodes != null && this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.SetDrawNodes(drawNodes);
- }
- }
- private void SetDrawNodes(TreeView drawTreeView)
- {
- for (int i = 0; i < this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- int count1 = drawTreeView.Nodes.Count;
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).drawingProperties.Clear();
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).pointChangeObject.Clear();
- for (int k = 0; k < count1; k++)
- {
- int count2 = drawTreeView.Nodes[k].Nodes.Count;
- for (int j = 0; j < count2; j++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == (DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name))
- {
- bool drawb = false;
- if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count == 0)
- {
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), new string[] { "nothing" });
- if (this.appWorkspace.ActiveDocumentWorkspace.oldDrawTreeView != null)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count != 0)
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- else
- {
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- }
- else
- {
- int a = 0;
- string[] arr = new string[drawTreeView.Nodes[k].Nodes[j].Nodes.Count];
- foreach (TreeNode node2 in drawTreeView.Nodes[k].Nodes[j].Nodes)
- {
- arr[a] = node2.Name;
- a++;
- }
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).drawingProperties.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), arr);
- if (this.appWorkspace.ActiveDocumentWorkspace.oldDrawTreeView != null)
- {
- if (drawTreeView.Nodes[k].Nodes[j].Nodes.Count != this.appWorkspace.ActiveDocumentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes.Count)
- {
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- else
- {
- foreach (TreeNode oldNode in this.appWorkspace.ActiveDocumentWorkspace.oldDrawTreeView.Nodes[k].Nodes[j].Nodes)
- {
- if (!arr.Contains(oldNode.Name))
- {
- drawb = true;
- }
- }
- if (drawb)
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), drawb);
- }
- }
- else
- {
- ((MeasureDrawObject)(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i])).pointChangeObject.Add((DrawToolType)Enum.Parse(typeof(DrawToolType), drawTreeView.Nodes[k].Nodes[j].Name), true);
- }
- }
- this.Refresh();
- }
- }
- }
- }
- }
- this.appWorkspace.ActiveDocumentWorkspace.oldDrawTreeView = drawTreeView;
- }
- /// <summary>
- /// 从配置文件中读取设置信息
- /// </summary>
- private void GetAttributeFromConfigurationFile()
- {
- MeasureListSetModel measureListSetModel = XmlSerializeHelper.DESerializer<MeasureListSetModel>(FileOperationHelper.ReadStringFromFile(System.Windows.Forms.Application.StartupPath + "\\Config\\" + Startup.instance.SettingPrefix + "\\MeasureListSetModel.xml", FileMode.Open));
- drawNodes = new TreeView();
- dataNodes = new TreeView();
- allDrawNodes = new TreeView();
- allDataNodes = new TreeView();
- if (measureListSetModel != null && measureListSetModel.AttributeMapDrawNodes != null)
- {
- for (int i = 0; i < measureListSetModel.AttributeMapDrawNodes.Count; i++)
- {
- TreeNode firstNode = new TreeNode();
- firstNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Name;
- for (int j = 0; j < measureListSetModel.AttributeMapDrawNodes[i].Attribute.Count; j++)
- {
- TreeNode scondNode = new TreeNode();
- scondNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Text;
- scondNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Name;
- for (int k = 0; k < measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count; k++)
- {
- if (measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute.Count > 0)
- {
- TreeNode thirdNode = new TreeNode();
- thirdNode.Text = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Text;
- thirdNode.Name = measureListSetModel.AttributeMapDrawNodes[i].Attribute[j].Attribute[k].Name;
- scondNode.Nodes.Add(thirdNode);
- }
- }
- firstNode.Nodes.Add(scondNode);
- }
- drawNodes.Nodes.Add(firstNode);
- }
- }
- 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);
- }
- dataNodes.Nodes.Add(firstNode);
- }
- }
- if (measureListSetModel != null && measureListSetModel.AttributeMapAllDrawNodes != null)
- {
- for (int i = 0; i < measureListSetModel.AttributeMapAllDrawNodes.Count; i++)
- {
- TreeNode firstNode = new TreeNode();
- firstNode.Text = measureListSetModel.AttributeMapAllDrawNodes[i].Name;
- for (int j = 0; j < measureListSetModel.AttributeMapAllDrawNodes[i].Attribute.Count; j++)
- {
- TreeNode scondNode = new TreeNode();
- scondNode.Text = measureListSetModel.AttributeMapAllDrawNodes[i].Attribute[j].Text;
- scondNode.Name = measureListSetModel.AttributeMapAllDrawNodes[i].Attribute[j].Name;
- for (int k = 0; k < measureListSetModel.AttributeMapAllDrawNodes[i].Attribute[j].Attribute.Count; k++)
- {
- if (measureListSetModel.AttributeMapAllDrawNodes[i].Attribute[j].Attribute.Count > 0)
- {
- TreeNode thirdNode = new TreeNode();
- thirdNode.Text = measureListSetModel.AttributeMapAllDrawNodes[i].Attribute[j].Attribute[k].Text;
- thirdNode.Name = measureListSetModel.AttributeMapAllDrawNodes[i].Attribute[j].Attribute[k].Name;
- scondNode.Nodes.Add(thirdNode);
- }
- }
- firstNode.Nodes.Add(scondNode);
- }
- allDrawNodes.Nodes.Add(firstNode);
- }
- }
- 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);
- }
- allDataNodes.Nodes.Add(firstNode);
- }
- }
- }
- /// <summary>
- /// 初始化分项数据下拉
- /// </summary>
- private void InitializeItemizedComboBox()
- {
- valuePairs = new Dictionary<Enum, string>();
- if (this.appWorkspace.ActiveDocumentWorkspace != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- int count = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
- for (int i = 0; i < count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- if (!valuePairs.ContainsKey(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType))
- {
- valuePairs.Add(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType,
- PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- }
- }
- }
- if (valuePairs.Count != 0)
- {
- this.comboBox5.DataSource = new BindingSource(valuePairs, null);
- this.comboBox5.DisplayMember = "Value";
- this.comboBox5.ValueMember = "Key";
- }
- }
- else
- {
- this.comboBox5.DataSource = null;
- }
- }
- /// <summary>
- /// 初始化分项数据的头
- /// </summary>
- private void InitializeItemizedHeader()
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- if (this.comboBox5.SelectedIndex >= 0 && !string.IsNullOrEmpty(this.comboBox5.Text))
- {
- if (valuePairs.Count == 0)
- return;
- DrawToolType type = (DrawToolType)valuePairs.ElementAt(this.comboBox5.SelectedIndex).Key;
- //初始化头
- this.listView1.Clear();
- this.listView1.View = View.Details;
- ColumnHeader header0 = new ColumnHeader();
- header0.Text = "";
- header0.Width = 0;
- this.listView1.Columns.Add(header0);
- ColumnHeader header = new ColumnHeader();
- header.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text");
- header.Width = 40;
- this.listView1.Columns.Add(header);
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int i = 0; i < count3; i++)
- {
- int count4 = dataNodes.Nodes[i].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (this.comboBox5.Text == dataNodes.Nodes[i].Nodes[j].Text)
- {
- foreach (TreeNode node2 in dataNodes.Nodes[i].Nodes[j].Nodes)
- {
- ColumnHeader header1 = new ColumnHeader();
- header1.Text = node2.Text;
- header1.Width = 100;
- this.listView1.Columns.Add(header1);
- }
- }
- }
- }
- }
- else
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(type, out arr);
- foreach (int v in arr)
- {
- if (v > 0)
- {
- ColumnHeader header1 = new ColumnHeader();
- object value;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)v, out value);
- header1.Text = value.ToString();
- header1.Width = 100;
- this.listView1.Columns.Add(header1);
- }
- }
- }
- }
- }
- }
- /// <summary>
- /// 初始化分项数据
- /// </summary>
- private void InitializeItemizedData()
- {
- if (this.comboBox5.SelectedIndex >= 0)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- int count = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
- int no = 0;
- for (int i = 0; i < count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == (DrawToolType)valuePairs.ElementAt(this.comboBox5.SelectedIndex).Key)
- {
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i]).GetData();
- no++;
- ListViewItem item = new ListViewItem();
- item.SubItems.Add("" + (no));
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int a = 0; a < count3; a++)
- {
- int count4 = dataNodes.Nodes[a].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (this.comboBox5.Text == dataNodes.Nodes[a].Nodes[j].Text)
- {
- foreach (TreeNode node2 in dataNodes.Nodes[a].Nodes[j].Nodes)
- {
- foreach (var keys in data)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)keys.Key, out v);
- if (v.ToString() == node2.Text)
- {
- item.SubItems.Add(keys.Value.ToString());
- }
- }
- }
- }
- }
- }
- }
- else
- {
- foreach (var keys in data)
- {
- item.SubItems.Add(keys.Value.ToString());
- }
- }
- this.listView1.Items.Add(item);
- this.listView1.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- this.ReSizeListViewColumns();
- }
- }
- }
- }
- private void ReSizeListViewColumns()
- {
- int width = (this.listView1.Columns.Count-2) * 110;
- //使列自使用宽度
- //对于DataGridView的每一个列都调整
- /*for (int i = 0; i < this.listView1.Columns.Count; i++)
- {
- //将每一列都调整为自动适应模式
- this.listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize);
- //记录整个DataGridView的宽度
- width += this.listView1.Columns[i].Width;
- }*/
- //判断调整后的宽度与原来设定的宽度的关系,如果是调整后的宽度大于原来设定的宽度,
- //则将DataGridView的列自动调整模式设置为显示的列即可,
- //如果是小于原来设定的宽度,将模式改为填充。
- if (width > this.listView1.Size.Width)
- {
- for (int i = 2; i < this.listView1.Columns.Count; i++)
- {
- this.listView1.Columns[i].Width = 110;
- }
- }
- else
- {
- for (int i = 2; i < this.listView1.Columns.Count; i++)
- {
- this.listView1.Columns[i].Width = (int)((this.listView1.Size.Width- this.listView1.Columns[1].Width) / (this.listView1.Columns.Count-2));
- }
- }
- }
- /// <summary>
- /// 初始化总数据表
- /// </summary>
- private void InitializeTotalData()
- {
- //初始化头
- this.listView2.View = View.Details;
- ColumnHeader header0 = new ColumnHeader();
- header0.Text = "";
- header0.Width = 0;
- this.listView2.Columns.Add(header0);
- ColumnHeader header = new ColumnHeader();
- header.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.ordernumber.text");
- header.Width = 39;
- this.listView2.Columns.Add(header);
- ColumnHeader header1 = new ColumnHeader();
- header1.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.classification.text");
- header1.Width = 154;
- this.listView2.Columns.Add(header1);
- ColumnHeader header2 = new ColumnHeader();
- header2.Text = PdnResources.GetString("Menu.name.text");
- header2.Width = 154;
- this.listView2.Columns.Add(header2);
- ColumnHeader header3 = new ColumnHeader();
- header3.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.Attributes.text");
- header3.Width = 154;
- this.listView2.Columns.Add(header3);
- ColumnHeader header4 = new ColumnHeader();
- header4.Text = PdnResources.GetString("Menu.unit.text");
- header4.Width = 154;
- this.listView2.Columns.Add(header4);
- ColumnHeader header5 = new ColumnHeader();
- header5.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.value.text");
- header5.Width = 150;
- this.listView2.Columns.Add(header5);
- }
- /// <summary>
- /// 初始化总数据表数据
- /// </summary>
- private void InitialMasterDataSheetData()
- {
- //初始化数据
- if (this.appWorkspace.ActiveDocumentWorkspace != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList != null
- && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- int count = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
- int no = 0;
- for (int i = 0; i < count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i]).GetData();
- object MeasureMethod;
- data.TryGetValue(MeasureAttributes.MeasureMethod, out MeasureMethod);
- if (this.comboBox2.SelectedIndex > 0 && this.comboBox3.SelectedIndex <= 0 && this.comboBox4.SelectedIndex <= 0)
- {
- if (this.comboBox2.Text.Equals(MeasureMethod))
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int a = 0; a < count3; a++)
- {
- if (dataNodes.Nodes[a].Text == MeasureMethod.ToString())
- {
- int count4 = dataNodes.Nodes[a].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (dataNodes.Nodes[a].Nodes[j].Text == PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"))
- {
- foreach (TreeNode node2 in dataNodes.Nodes[a].Nodes[j].Nodes)
- {
- foreach (var keys in models)
- {
- if (keys.Value.ToString() == node2.Text)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- foreach (var keys in models)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- else if (this.comboBox2.SelectedIndex <= 0 && this.comboBox3.SelectedIndex <= 0 && this.comboBox4.SelectedIndex > 0)
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int a = 0; a < count3; a++)
- {
- if (dataNodes.Nodes[a].Text == MeasureMethod.ToString())
- {
- int count4 = dataNodes.Nodes[a].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (dataNodes.Nodes[a].Nodes[j].Text == PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"))
- {
- foreach (TreeNode node2 in dataNodes.Nodes[a].Nodes[j].Nodes)
- {
- foreach (var keys in models)
- {
- if (this.comboBox4.Text.Equals(keys.Value))
- {
- if (keys.Value.ToString() == node2.Text)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- foreach (var keys in models)
- {
- if (this.comboBox4.Text.Equals(keys.Value))
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- else if (this.comboBox2.SelectedIndex > 0 && this.comboBox3.SelectedIndex > 0 && this.comboBox4.SelectedIndex <= 0)
- {
- if (this.comboBox2.Text.Equals(MeasureMethod) && this.comboBox3.Text.Equals(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text")))
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int a = 0; a < count3; a++)
- {
- if (dataNodes.Nodes[a].Text == MeasureMethod.ToString())
- {
- int count4 = dataNodes.Nodes[a].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (dataNodes.Nodes[a].Nodes[j].Text == PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"))
- {
- foreach (TreeNode node2 in dataNodes.Nodes[a].Nodes[j].Nodes)
- {
- foreach (var keys in models)
- {
- if (keys.Value.ToString() == node2.Text)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- foreach (var keys in models)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- else if (this.comboBox2.SelectedIndex > 0 && this.comboBox3.SelectedIndex <= 0 && this.comboBox4.SelectedIndex > 0)
- {
- if (this.comboBox2.Text.Equals(MeasureMethod))
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int a = 0; a < count3; a++)
- {
- if (dataNodes.Nodes[a].Text == MeasureMethod.ToString())
- {
- int count4 = dataNodes.Nodes[a].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (dataNodes.Nodes[a].Nodes[j].Text == PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"))
- {
- foreach (TreeNode node2 in dataNodes.Nodes[a].Nodes[j].Nodes)
- {
- foreach (var keys in models)
- {
- if (this.comboBox4.Text.Equals(keys.Value))
- {
- if (keys.Value.ToString() == node2.Text)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- foreach (var keys in models)
- {
- if (this.comboBox4.Text.Equals(keys.Value))
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- else if (this.comboBox2.SelectedIndex > 0 && this.comboBox3.SelectedIndex > 0 && this.comboBox4.SelectedIndex > 0)
- {
- if (this.comboBox2.Text.Equals(MeasureMethod) && this.comboBox3.Text.Equals(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text")))
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int a = 0; a < count3; a++)
- {
- if (dataNodes.Nodes[a].Text == MeasureMethod.ToString())
- {
- int count4 = dataNodes.Nodes[a].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (dataNodes.Nodes[a].Nodes[j].Text == PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"))
- {
- foreach (TreeNode node2 in dataNodes.Nodes[a].Nodes[j].Nodes)
- {
- foreach (var keys in models)
- {
- if (this.comboBox4.Text.Equals(keys.Value))
- {
- if (keys.Value.ToString() == node2.Text)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- foreach (var keys in models)
- {
- if (this.comboBox4.Text.Equals(keys.Value))
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- else
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- if (dataNodes != null)
- {
- int count3 = dataNodes.Nodes.Count;
- for (int a = 0; a < count3; a++)
- {
- if (dataNodes.Nodes[a].Text == MeasureMethod.ToString())
- {
- int count4 = dataNodes.Nodes[a].Nodes.Count;
- for (int j = 0; j < count4; j++)
- {
- if (dataNodes.Nodes[a].Nodes[j].Text == PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"))
- {
- foreach (TreeNode node2 in dataNodes.Nodes[a].Nodes[j].Nodes)
- {
- foreach (var keys in models)
- {
- if (keys.Value.ToString() == node2.Text)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- }
- }
- }
- else
- {
- foreach (var keys in models)
- {
- no++;
- ListViewItem item1 = new ListViewItem();
- item1.SubItems.Add("" + (no));
- item1.SubItems.Add(MeasureMethod.ToString());
- item1.SubItems.Add(PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType.ToString() + ".Text"));
- item1.SubItems.Add(keys.Value.ToString());
- object unit;
- data.TryGetValue(MeasureAttributes.MeasureUnitCN, out unit);
- item1.SubItems.Add(unit.ToString());
- object values;
- data.TryGetValue(keys.Key, out values);
- item1.SubItems.Add(values.ToString());
- this.listView2.Items.Add(item1);
- this.listView2.Items[no - 1].Tag = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i];
- }
- }
- }
- }
- }
- }
- }
- /// <summary>
- /// 初始化总数据表的三级下拉
- /// </summary>
- private void InitializeClassComboBox()
- {
- this.comboBox2.DataSource = list;
- this.comboBox2.DisplayMember = "name";
- this.comboBox2.ValueMember = "id";
- //初始化第三级菜单
- this.comboBox4.DataSource = new BindingSource(InvariantData.measureAttributes, null);
- this.comboBox4.DisplayMember = "Value";
- this.comboBox4.ValueMember = "Key";
- }
- /// <summary>
- /// 初始数据Excel
- /// </summary>
- private void InitialDataExcel()
- {
- var selectedItems1 = this.listView1.SelectedItems;
- var selectedItems2 = this.listView2.SelectedItems;
- if ((this.listView1.Visible && selectedItems1.Count == 0) || (this.listView2.Visible && selectedItems2.Count == 0))
- {
- int count = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
- System.Data.DataSet ds = new DataSet();
- DataTable MeasureLine = new DataTable();
- MeasureLine.TableName = PdnResources.GetString("Menu.LabelAction.DrawLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureLine.Columns.Add(c.ToString());
- }
- DataTable MeasureLength = new DataTable();
- MeasureLength.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureLength.Columns.Add(c.ToString());
- }
- DataTable MeasureHLine = new DataTable();
- MeasureHLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureHLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureHLine.Columns.Add(c.ToString());
- }
- DataTable MeasureVLine = new DataTable();
- MeasureVLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureVLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureVLine.Columns.Add(c.ToString());
- }
- DataTable MeasureMulLine = new DataTable();
- MeasureMulLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureMulLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureMulLine.Columns.Add(c.ToString());
- }
- DataTable MeasureMulHVLine = new DataTable();
- MeasureMulHVLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureMulHVLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureMulHVLine.Columns.Add(c.ToString());
- }
- DataTable MeasureMulSegment = new DataTable();
- MeasureMulSegment.TableName = PdnResources.GetString("Menu.MeasureAction.MultiPointLineSegment.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureMulSegment.Columns.Add(c.ToString());
- }
- DataTable MeasureMulVLine = new DataTable();
- MeasureMulVLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureMulPLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureMulVLine.Columns.Add(c.ToString());
- }
- DataTable MeasureBrokenLine = new DataTable();
- MeasureBrokenLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureBrokenLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureBrokenLine.Columns.Add(c.ToString());
- }
- DataTable MeasureTraceCurve = new DataTable();
- MeasureTraceCurve.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureTraceCurve.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureTraceCurve.Columns.Add(c.ToString());
- }
- DataTable MeasureCurveLine = new DataTable();
- MeasureCurveLine.TableName = PdnResources.GetString("Menu.LabelAction.DrawCurve.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureCurveLine.Columns.Add(c.ToString());
- }
- DataTable MeasurePLine = new DataTable();
- MeasurePLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasurePLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasurePLine.Columns.Add(c.ToString());
- }
- DataTable MeasureMulPLine = new DataTable();
- MeasureMulPLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureMulPLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureMulPLine.Columns.Add(c.ToString());
- }
- DataTable MeasureHMulPLine = new DataTable();
- MeasureHMulPLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureHMulPLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureHMulPLine.Columns.Add(c.ToString());
- }
- DataTable MeasureVMulPLine = new DataTable();
- MeasureVMulPLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureVMulPLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureVMulPLine.Columns.Add(c.ToString());
- }
- DataTable MeasureParallelLine = new DataTable();
- MeasureParallelLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureParallelLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureParallelLine.Columns.Add(c.ToString());
- }
- DataTable MeasureMulParallelLine = new DataTable();
- MeasureMulParallelLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureMulParallelLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureMulParallelLine.Columns.Add(c.ToString());
- }
- DataTable MeasureVMulParallelLine = new DataTable();
- MeasureVMulParallelLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureVMulParallelLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureVMulParallelLine.Columns.Add(c.ToString());
- }
- DataTable MeasureHMulParallelLine = new DataTable();
- MeasureHMulParallelLine.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureHMulParallelLine.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureHMulParallelLine.Columns.Add(c.ToString());
- }
- DataTable MeasureClosedCurve = new DataTable();
- MeasureClosedCurve.TableName = PdnResources.GetString("Menu.LabelAction.DrawClosedCurve.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureClosedCurve.Columns.Add(c.ToString());
- }
- DataTable MeasurePolygon = new DataTable();
- MeasurePolygon.TableName = PdnResources.GetString("Menu.LabelAction.DrawPolygon.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasurePolygon.Columns.Add(c.ToString());
- }
- DataTable MeasureRectangle = new DataTable();
- MeasureRectangle.TableName = PdnResources.GetString("Menu.LabelAction.DrawRectangle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureRectangle.Columns.Add(c.ToString());
- }
- DataTable MeasureRandRectangle = new DataTable();
- MeasureRandRectangle.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureRandRectangle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureRandRectangle.Columns.Add(c.ToString());
- }
- DataTable MeasureSquare = new DataTable();
- MeasureSquare.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureSquare.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureSquare.Columns.Add(c.ToString());
- }
- DataTable MeasureRandSquare = new DataTable();
- MeasureRandSquare.TableName = PdnResources.GetString("Menu.Anypositivedirection.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureRandSquare.Columns.Add(c.ToString());
- }
- DataTable MeasureTracePolygon = new DataTable();
- MeasureTracePolygon.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureTracePolygon.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureTracePolygon.Columns.Add(c.ToString());
- }
- DataTable MeasureCircle = new DataTable();
- MeasureCircle.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureCircle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureCircle.Columns.Add(c.ToString());
- }
- DataTable MeasureInnerCircle = new DataTable();
- MeasureInnerCircle.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureInnerCircle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureInnerCircle.Columns.Add(c.ToString());
- }
- DataTable MeasureOuterCircle = new DataTable();
- MeasureOuterCircle.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureOuterCircle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureOuterCircle.Columns.Add(c.ToString());
- }
- DataTable MeasureDiameterCircle = new DataTable();
- MeasureDiameterCircle.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureDiameterCircle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureDiameterCircle.Columns.Add(c.ToString());
- }
- DataTable MeasurePointEdgeSize = new DataTable();
- MeasurePointEdgeSize.TableName = PdnResources.GetString("Menu.MeasureAction.MeasurePointEdgeSize.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasurePointEdgeSize.Columns.Add(c.ToString());
- }
- DataTable MeasurePointCenterSize = new DataTable();
- MeasurePointCenterSize.TableName = PdnResources.GetString("Menu.MeasureAction.MeasurePointCenterSize.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasurePointCenterSize.Columns.Add(c.ToString());
- }
- DataTable MeasureThreePointAngle = new DataTable();
- MeasureThreePointAngle.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureThreePointAngle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureThreePointAngle.Columns.Add(c.ToString());
- }
- DataTable MeasureFourPointAngle = new DataTable();
- MeasureFourPointAngle.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureFourPointAngle.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureFourPointAngle.Columns.Add(c.ToString());
- }
- DataTable MeasureThreePointArc = new DataTable();
- MeasureThreePointArc.TableName = PdnResources.GetString("Menu.MeasureAction.MeasureThreePointArc.Text");
- for (int c = 0; c < 18; c++)
- {
- MeasureThreePointArc.Columns.Add(c.ToString());
- }
- for (int i = 0; i < count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure)
- {
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i]).GetData();
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureLine)
- {
- DataRow row = MeasureLine.NewRow();
- int a = 0;
- if (MeasureLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureLine.Rows.Add(row);
- }
- row = MeasureLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureLength)
- {
- DataRow row = MeasureLength.NewRow();
- int a = 0;
- if(MeasureLength.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureLength.Rows.Add(row);
- }
- row = MeasureLength.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureLength.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureHLine)
- {
- DataRow row = MeasureHLine.NewRow();
- int a = 0;
- if(MeasureHLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureHLine.Rows.Add(row);
- }
- row = MeasureHLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureHLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureVLine)
- {
- DataRow row = MeasureVLine.NewRow();
- int a = 0;
- if(MeasureVLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureVLine.Rows.Add(row);
- }
- row = MeasureVLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureVLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureMulLine)
- {
- DataRow row = MeasureMulLine.NewRow();
- int a = 0;
- if(MeasureMulLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulLine.Rows.Add(row);
- }
- row = MeasureMulLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureMulHVLine)
- {
- DataRow row = MeasureMulHVLine.NewRow();
- int a = 0;
- if(MeasureMulHVLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulHVLine.Rows.Add(row);
- }
- row = MeasureMulHVLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulHVLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureMulSegment)
- {
- DataRow row = MeasureMulSegment.NewRow();
- int a = 0;
- if(MeasureMulSegment.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulSegment.Rows.Add(row);
- }
- row = MeasureMulSegment.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulSegment.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureMulVLine)
- {
- DataRow row = MeasureMulVLine.NewRow();
- int a = 0;
- if (MeasureMulVLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulVLine.Rows.Add(row);
- }
- row = MeasureMulVLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulVLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureBrokenLine)
- {
- DataRow row = MeasureBrokenLine.NewRow();
- int a = 0;
- if(MeasureBrokenLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureBrokenLine.Rows.Add(row);
- }
- row = MeasureBrokenLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureBrokenLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureTraceCurve)
- {
- DataRow row = MeasureTraceCurve.NewRow();
- int a = 0;
- if(MeasureTraceCurve.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureTraceCurve.Rows.Add(row);
- }
- row = MeasureTraceCurve.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureTraceCurve.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureCurveLine)
- {
- DataRow row = MeasureCurveLine.NewRow();
- int a = 0;
- if(MeasureCurveLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureCurveLine.Rows.Add(row);
- }
- row = MeasureCurveLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureCurveLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasurePLine)
- {
- DataRow row = MeasurePLine.NewRow();
- int a = 0;
- if(MeasurePLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePLine.Rows.Add(row);
- }
- row = MeasurePLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureMulPLine)
- {
- DataRow row = MeasureMulPLine.NewRow();
- int a = 0;
- if(MeasureMulPLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulPLine.Rows.Add(row);
- }
- row = MeasureMulPLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulPLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureHMulPLine)
- {
- DataRow row = MeasureHMulPLine.NewRow();
- int a = 0;
- if(MeasureHMulPLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureHMulPLine.Rows.Add(row);
- }
- row = MeasureHMulPLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureHMulPLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureVMulPLine)
- {
- DataRow row = MeasureVMulPLine.NewRow();
- int a = 0;
- if(MeasureVMulPLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureVMulPLine.Rows.Add(row);
- }
- row = MeasureVMulPLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureVMulPLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureParallelLine)
- {
- DataRow row = MeasureParallelLine.NewRow();
- int a = 0;
- if (MeasureParallelLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureParallelLine.Rows.Add(row);
- }
- row = MeasureParallelLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureParallelLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureMulParallelLine)
- {
- DataRow row = MeasureMulParallelLine.NewRow();
- int a = 0;
- if(MeasureMulParallelLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulParallelLine.Rows.Add(row);
- }
- row = MeasureMulParallelLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureMulParallelLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureVMulParallelLine)
- {
- DataRow row = MeasureVMulParallelLine.NewRow();
- int a = 0;
- if(MeasureVMulParallelLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureVMulParallelLine.Rows.Add(row);
- }
- row = MeasureVMulParallelLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureVMulParallelLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureHMulParallelLine)
- {
- DataRow row = MeasureHMulParallelLine.NewRow();
- int a = 0;
- if(MeasureHMulParallelLine.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureHMulParallelLine.Rows.Add(row);
- }
- row = MeasureHMulParallelLine.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureHMulParallelLine.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureClosedCurve)
- {
- DataRow row = MeasureClosedCurve.NewRow();
- int a = 0;
- if(MeasureClosedCurve.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureClosedCurve.Rows.Add(row);
- }
- row = MeasureClosedCurve.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureClosedCurve.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasurePolygon)
- {
- DataRow row = MeasurePolygon.NewRow();
- int a = 0;
- if(MeasurePolygon.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePolygon.Rows.Add(row);
- }
- row = MeasurePolygon.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePolygon.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureRectangle)
- {
- DataRow row = MeasureRectangle.NewRow();
- int a = 0;
- if (MeasureRectangle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureRectangle.Rows.Add(row);
- }
- row = MeasureRectangle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureRectangle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureRandRectangle)
- {
- DataRow row = MeasureRandRectangle.NewRow();
- int a = 0;
- if(MeasureRandRectangle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureRandRectangle.Rows.Add(row);
- }
- row = MeasureRandRectangle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureRandRectangle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureSquare)
- {
- DataRow row = MeasureSquare.NewRow();
- int a = 0;
- if(MeasureSquare.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureSquare.Rows.Add(row);
- }
- row = MeasureSquare.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureSquare.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureRandSquare)
- {
- DataRow row = MeasureRandSquare.NewRow();
- int a = 0;
- if(MeasureRandSquare.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureRandSquare.Rows.Add(row);
- }
- row = MeasureRandSquare.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureRandSquare.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureTracePolygon)
- {
- DataRow row = MeasureTracePolygon.NewRow();
- int a = 0;
- if(MeasureTracePolygon.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureTracePolygon.Rows.Add(row);
- }
- row = MeasureTracePolygon.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureTracePolygon.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureCircle)
- {
- DataRow row = MeasureCircle.NewRow();
- int a = 0;
- if (MeasureCircle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureCircle.Rows.Add(row);
- }
- row = MeasureCircle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureCircle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureInnerCircle)
- {
- DataRow row = MeasureInnerCircle.NewRow();
- int a = 0;
- if(MeasureInnerCircle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureInnerCircle.Rows.Add(row);
- }
- row = MeasureInnerCircle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureInnerCircle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureOuterCircle)
- {
- DataRow row = MeasureOuterCircle.NewRow();
- int a = 0;
- if(MeasureOuterCircle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureOuterCircle.Rows.Add(row);
- }
- row = MeasureOuterCircle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureOuterCircle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureDiameterCircle)
- {
- DataRow row = MeasureDiameterCircle.NewRow();
- int a = 0;
- if(MeasureDiameterCircle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureDiameterCircle.Rows.Add(row);
- }
- row = MeasureDiameterCircle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureDiameterCircle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasurePointEdgeSize)
- {
- DataRow row = MeasurePointEdgeSize.NewRow();
- int a = 0;
- if(MeasurePointEdgeSize.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePointEdgeSize.Rows.Add(row);
- }
- row = MeasurePointEdgeSize.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePointEdgeSize.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasurePointCenterSize)
- {
- DataRow row = MeasurePointCenterSize.NewRow();
- int a = 0;
- if(MeasurePointCenterSize.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePointCenterSize.Rows.Add(row);
- }
- row = MeasurePointCenterSize.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasurePointCenterSize.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureThreePointAngle)
- {
- DataRow row = MeasureThreePointAngle.NewRow();
- int a = 0;
- if(MeasureThreePointAngle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureThreePointAngle.Rows.Add(row);
- }
- row = MeasureThreePointAngle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureThreePointAngle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureFourPointAngle)
- {
- DataRow row = MeasureFourPointAngle.NewRow();
- int a = 0;
- if(MeasureFourPointAngle.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureFourPointAngle.Rows.Add(row);
- }
- row = MeasureFourPointAngle.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureFourPointAngle.Rows.Add(row);
- }
- else if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.MeasureThreePointArc)
- {
- DataRow row = MeasureThreePointArc.NewRow();
- int a = 0;
- if(MeasureThreePointArc.Rows.Count == 0)
- {
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureThreePointArc.Rows.Add(row);
- }
- row = MeasureThreePointArc.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- MeasureThreePointArc.Rows.Add(row);
- }
- }
- }
- if (MeasureLine.Rows.Count > 0) ds.Tables.Add(MeasureLine);
- if (MeasureLength.Rows.Count > 0) ds.Tables.Add(MeasureLength);
- if (MeasureHLine.Rows.Count > 0) ds.Tables.Add(MeasureHLine);
- if (MeasureVLine.Rows.Count > 0) ds.Tables.Add(MeasureVLine);
- if (MeasureMulLine.Rows.Count > 0) ds.Tables.Add(MeasureMulLine);
- if (MeasureMulHVLine.Rows.Count > 0) ds.Tables.Add(MeasureMulHVLine);
- if (MeasureMulSegment.Rows.Count > 0) ds.Tables.Add(MeasureMulSegment);
- if (MeasureMulVLine.Rows.Count > 0) ds.Tables.Add(MeasureMulVLine);
- if (MeasureBrokenLine.Rows.Count > 0) ds.Tables.Add(MeasureBrokenLine);
- if (MeasureTraceCurve.Rows.Count > 0) ds.Tables.Add(MeasureTraceCurve);
- if (MeasureCurveLine.Rows.Count > 0) ds.Tables.Add(MeasureCurveLine);
- if (MeasurePLine.Rows.Count > 0) ds.Tables.Add(MeasurePLine);
- if (MeasureMulPLine.Rows.Count > 0) ds.Tables.Add(MeasureMulPLine);
- if (MeasureHMulPLine.Rows.Count > 0) ds.Tables.Add(MeasureHMulPLine);
- if (MeasureVMulPLine.Rows.Count > 0) ds.Tables.Add(MeasureVMulPLine);
- if (MeasureParallelLine.Rows.Count > 0) ds.Tables.Add(MeasureParallelLine);
- if (MeasureMulParallelLine.Rows.Count > 0) ds.Tables.Add(MeasureMulParallelLine);
- if (MeasureVMulParallelLine.Rows.Count > 0) ds.Tables.Add(MeasureVMulParallelLine);
- if (MeasureHMulParallelLine.Rows.Count > 0) ds.Tables.Add(MeasureHMulParallelLine);
- if (MeasureClosedCurve.Rows.Count > 0) ds.Tables.Add(MeasureClosedCurve);
- if (MeasurePolygon.Rows.Count > 0) ds.Tables.Add(MeasurePolygon);
- if (MeasureRectangle.Rows.Count > 0) ds.Tables.Add(MeasureRectangle);
- if (MeasureRandRectangle.Rows.Count > 0) ds.Tables.Add(MeasureRandRectangle);
- if (MeasureSquare.Rows.Count > 0) ds.Tables.Add(MeasureSquare);
- if (MeasureRandSquare.Rows.Count > 0) ds.Tables.Add(MeasureRandSquare);
- if (MeasureTracePolygon.Rows.Count > 0) ds.Tables.Add(MeasureTracePolygon);
- if (MeasureCircle.Rows.Count > 0) ds.Tables.Add(MeasureCircle);
- if (MeasureInnerCircle.Rows.Count > 0) ds.Tables.Add(MeasureInnerCircle);
- if (MeasureOuterCircle.Rows.Count > 0) ds.Tables.Add(MeasureOuterCircle);
- if (MeasureDiameterCircle.Rows.Count > 0) ds.Tables.Add(MeasureDiameterCircle);
- if (MeasurePointEdgeSize.Rows.Count > 0) ds.Tables.Add(MeasurePointEdgeSize);
- if (MeasurePointCenterSize.Rows.Count > 0) ds.Tables.Add(MeasurePointCenterSize);
- if (MeasureThreePointAngle.Rows.Count > 0) ds.Tables.Add(MeasureThreePointAngle);
- if (MeasureFourPointAngle.Rows.Count > 0) ds.Tables.Add(MeasureFourPointAngle);
- if (MeasureThreePointArc.Rows.Count > 0) ds.Tables.Add(MeasureThreePointArc);
- DataToExcle(ds);
- }
- else
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- //exe.CreatePrompt = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.Measurementdatasheet.Text");
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- {
- return;
- }
- DataTable dtb = new DataTable();
- for (int i = 0; i < 18; i++)
- {
- dtb.Columns.Add(i.ToString());
- }
- if (selectedItems1.Count > 0 && this.listView1.Visible)
- {
- for (int j = 0; j < selectedItems1.Count; j++)
- {
- int count = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
- for (int i = 0; i < count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i] == selectedItems1[j].Tag)
- {
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i]).GetData();
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- DataRow row = dtb.NewRow();
- int a = 0;
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- dtb.Rows.Add(row);
- row = dtb.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- dtb.Rows.Add(row);
- row = dtb.NewRow();
- dtb.Rows.Add(row);
- }
- }
- }
- }
- else if (selectedItems2.Count > 0 && this.listView2.Visible)
- {
- ArrayList arrayList = new ArrayList();
- object tag = string.Empty;
- for (int j = 0; j < selectedItems2.Count; j++)
- {
- if (tag != selectedItems2[j].Tag)
- {
- arrayList.Add(selectedItems2[j].Tag);
- }
- tag = selectedItems2[j].Tag;
- }
- foreach (var tags in arrayList)
- {
- int count = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
- for (int i = 0; i < count; i++)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Measure && this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i] == tags)
- {
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i]).GetData();
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType, out arr);
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- if (arr != null)
- {
- foreach (int t in arr)
- {
- if (t != 0)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((MeasureAttributes)t, v);
- }
- }
- }
- DataRow row = dtb.NewRow();
- int a = 0;
- foreach (var item in models)
- {
- row[a.ToString()] = item.Value;
- a++;
- }
- dtb.Rows.Add(row);
- row = dtb.NewRow();
- a = 0;
- foreach (var item in data)
- {
- object cnvalue;
- InvariantData.measureAttributes.TryGetValue(item.Key, out cnvalue);
- row[a.ToString()] = item.Value;
- a++;
- }
- dtb.Rows.Add(row);
- row = dtb.NewRow();
- dtb.Rows.Add(row);
- }
- }
- }
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, false, false, true);
- }
- }
- /// <summary>
- /// 测量统计数据Excel
- /// </summary>
- private void StatisticalDataExcel()
- {
- SaveFileDialog exe = new SaveFileDialog();
- exe.Filter = "Execl files (*.xlsx)|*.xlsx";
- exe.FilterIndex = 0;
- exe.RestoreDirectory = true;
- exe.Title = "Export Excel File";
- exe.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
- exe.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.Statisticaldattable.Text");
- DialogResult dr = exe.ShowDialog();
- if (dr != DialogResult.OK)
- {
- return;
- }
- DataTable dtb = new DataTable();
- for (int c = 0; c < this.listView1.Columns.Count; c++)
- {
- if (c == 1)
- dtb.Columns.Add(PdnResources.GetString("Menu.compute.text"));
- if (c > 1)
- dtb.Columns.Add(listView1.Columns[c].Text);
- }
- ArrayList arrayList1 = new ArrayList();
- ArrayList arrayList2 = new ArrayList();
- ArrayList arrayList3 = new ArrayList();
- ArrayList arrayList4 = new ArrayList();
- ArrayList arrayList5 = new ArrayList();
- Regex r1 = new Regex(@"^[0-9]+$");
- Regex r = new Regex(@"^([0-9]{1,}[.][0-9]*)$");
- for (int j = 2; j < this.listView1.Columns.Count; j++)
- {
- string maxValue = "0";
- string minValue = "0";
- string sumValue = "0";
- string averageValue = "0";
- for (int i = 0; i < this.listView1.Items.Count; i++)
- {
- if (j > 1)
- {
- if ((r.Match(this.listView1.Items[i].SubItems[j].Text).Success
- || r1.Match(this.listView1.Items[i].SubItems[j].Text).Success) && i != 0)
- {
- // 最大值
- if (Convert.ToDouble(this.listView1.Items[i].SubItems[j].Text) > Convert.ToDouble(maxValue))
- maxValue = this.listView1.Items[i].SubItems[j].Text;
- // 最小值
- if (Convert.ToDouble(this.listView1.Items[i].SubItems[j].Text) < Convert.ToDouble(minValue))
- minValue = this.listView1.Items[i].SubItems[j].Text;
- // 和
- sumValue = Math.Round((Convert.ToDouble(sumValue) + Convert.ToDouble(this.listView1.Items[i].SubItems[j].Text)), (int)this.numericUpDown1.Value).ToString();
- // 平均值
- averageValue = Math.Round((Convert.ToDouble(sumValue) / this.listView1.Items.Count), (int)this.numericUpDown1.Value).ToString();
- }
- else
- {
- maxValue = this.listView1.Items[i].SubItems[j].Text;
- minValue = this.listView1.Items[i].SubItems[j].Text;
- sumValue = this.listView1.Items[i].SubItems[j].Text;
- averageValue = this.listView1.Items[i].SubItems[j].Text;
- }
- }
- }
- arrayList1.Add(maxValue);
- arrayList2.Add(minValue);
- arrayList3.Add(averageValue);
- arrayList4.Add(sumValue);
- arrayList5.Add(this.listView1.Items.Count);
- }
- for (int i = 0; i < 5; i++)
- {
- DataRow dataRow = dtb.NewRow();
- string rowHeader = string.Empty;
- ArrayList arrayList = new ArrayList();
- if (i == 0)
- {
- rowHeader = PdnResources.GetString("Menu.Image.Max.Text");
- arrayList = arrayList1;
- }
- else if (i == 1)
- {
- rowHeader = PdnResources.GetString("Menu.Image.Min.Text");
- arrayList = arrayList2;
- }
- else if (i == 2)
- {
- rowHeader = PdnResources.GetString("Menu.averagevalue.text");
- arrayList = arrayList3;
- }
- else if (i == 3)
- {
- rowHeader = PdnResources.GetString("Menu.and.Text");
- arrayList = arrayList4;
- }
- else
- {
- rowHeader = PdnResources.GetString("Menu.count.Text");
- arrayList = arrayList5;
- }
- for (int c = 0; c < this.listView1.Columns.Count; c++)
- {
- if (c == 1)
- dataRow[PdnResources.GetString("Menu.count.Text")] = rowHeader;
- if (c > 1)
- {
- dataRow[listView1.Columns[c].Text] = arrayList[c - 2];
- }
- }
- dtb.Rows.Add(dataRow);
- }
- List<DataTable> list = new List<DataTable>();
- list.Add(dtb);
- this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName, false, false, true);
- }
- /// <summary>
- /// 模板数据Excel
- /// </summary>
- private void TemplateDataExcel()
- {
- DataTable dtb = new DataTable();
- if (this.listView1.Visible)
- {
- for (int c = 1; c < this.listView1.Columns.Count; c++)
- {
- dtb.Columns.Add(listView1.Columns[c].Text);
- }
- for (int i = 0; i < this.listView1.Items.Count; i++)
- {
- DataRow dataRow = dtb.NewRow();
- if(i == 0)
- {
- for (int j = 1; j < this.listView1.Columns.Count; j++)
- {
- dataRow[this.listView1.Columns[j].Text] = this.listView1.Columns[j].Text;
- }
- dtb.Rows.Add(dataRow);
- dataRow = dtb.NewRow();
- }
- for (int j = 1; j < this.listView1.Columns.Count; j++)
- {
- if (this.listView1.Items.Count > i && this.listView1.Items[i].SubItems.Count > j)
- dataRow[this.listView1.Columns[j].Text] = this.listView1.Items[i].SubItems[j].Text;//#20103
- else
- dataRow[this.listView1.Columns[j].Text] = "";
- }
- dtb.Rows.Add(dataRow);
- }
- }
- else
- {
- for (int c = 1; c < this.listView2.Columns.Count; c++)
- {
- dtb.Columns.Add(listView2.Columns[c].Text);
- }
- for (int i = 0; i < this.listView2.Items.Count; i++)
- {
- DataRow dataRow = dtb.NewRow();
- if (i == 0)
- {
- for (int j = 1; j < this.listView2.Columns.Count; j++)
- {
- dataRow[this.listView2.Columns[j].Text] = this.listView2.Columns[j].Text;
- }
- dtb.Rows.Add(dataRow);
- dataRow = dtb.NewRow();
- }
- for (int j = 1; j < this.listView2.Columns.Count; j++)
- {
- if (this.listView2.Items.Count > i && this.listView2.Items[i].SubItems.Count > j)
- dataRow[this.listView2.Columns[j].Text] = this.listView2.Items[i].SubItems[j].Text;
- else
- dataRow[this.listView2.Columns[j].Text] = "";
- }
- dtb.Rows.Add(dataRow);
- }
- }
- datatable = dtb;
- //List<DataTable> list = new List<DataTable>();
- //list.Add(dtb);
- //this.appWorkspace.ExportDataToExcelWithProgress(list, exe.FileName);
- }
- private DataTable datatable;
- private void InitializeLanguageText()
- {
- this.tabPage1.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.Itemizeddatasheet.text");
- this.tabPage2.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.Generaldatasheet.text");
- this.comboBox4.Text = PdnResources.GetString("Menu.Pleaseselect.Text");
- this.comboBox3.Text = PdnResources.GetString("Menu.Pleaseselect.Text");
- this.comboBox2.Text = PdnResources.GetString("Menu.Pleaseselect.Text");
- this.label2.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.Decimalpoint.text") + ":";
- this.Text = PdnResources.GetString("Menu.Imagement.Measurementlist.Listofmeasuringelements.text");
- }
- private void InitializeComponent()
- {
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.listView1 = new System.Windows.Forms.ListView();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.listView2 = new System.Windows.Forms.ListView();
- this.panel1 = new System.Windows.Forms.Panel();
- this.comboBox4 = new System.Windows.Forms.ComboBox();
- this.comboBox3 = new System.Windows.Forms.ComboBox();
- this.comboBox2 = new System.Windows.Forms.ComboBox();
- this.panel2 = new System.Windows.Forms.Panel();
- this.comboBox5 = new System.Windows.Forms.ComboBox();
- this.button1 = new System.Windows.Forms.Button();
- this.button2 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.button4 = new System.Windows.Forms.Button();
- this.button5 = new System.Windows.Forms.Button();
- this.button6 = new System.Windows.Forms.Button();
- this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
- this.label2 = new System.Windows.Forms.Label();
- this.button7 = new System.Windows.Forms.Button();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.tabPage2.SuspendLayout();
- this.panel1.SuspendLayout();
- this.panel2.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
- this.SuspendLayout();
- //
- // tabControl1
- //
- this.tabControl1.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.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Controls.Add(this.tabPage2);
- this.tabControl1.Location = new System.Drawing.Point(12, 12);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(898, 369);
- this.tabControl1.TabIndex = 0;
- this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
- //
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.listView1);
- this.tabPage1.Location = new System.Drawing.Point(4, 22);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage1.Size = new System.Drawing.Size(890, 343);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.UseVisualStyleBackColor = true;
- //
- // 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.FullRowSelect = true;
- this.listView1.GridLines = true;
- this.listView1.HideSelection = false;
- this.listView1.Location = new System.Drawing.Point(6, 6);
- this.listView1.Margin = new System.Windows.Forms.Padding(0);
- this.listView1.Name = "listView1";
- this.listView1.Size = new System.Drawing.Size(877, 330);
- this.listView1.TabIndex = 0;
- this.listView1.UseCompatibleStateImageBehavior = false;
- this.listView1.SelectedIndexChanged += new System.EventHandler(this.ListView1_SelectedIndexChanged);
- //
- // tabPage2
- //
- this.tabPage2.Controls.Add(this.listView2);
- this.tabPage2.Location = new System.Drawing.Point(4, 22);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
- this.tabPage2.Size = new System.Drawing.Size(890, 343);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.UseVisualStyleBackColor = true;
- //
- // listView2
- //
- this.listView2.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.listView2.FullRowSelect = true;
- this.listView2.GridLines = true;
- this.listView2.HideSelection = false;
- this.listView2.Location = new System.Drawing.Point(6, 6);
- this.listView2.Margin = new System.Windows.Forms.Padding(0);
- this.listView2.Name = "listView2";
- this.listView2.Size = new System.Drawing.Size(805, 330);
- this.listView2.TabIndex = 0;
- this.listView2.UseCompatibleStateImageBehavior = false;
- this.listView2.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.listView2_ItemSelectionChanged);
- //
- // panel1
- //
- this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.panel1.Controls.Add(this.comboBox4);
- this.panel1.Controls.Add(this.comboBox3);
- this.panel1.Controls.Add(this.comboBox2);
- this.panel1.Location = new System.Drawing.Point(12, 388);
- this.panel1.Name = "panel1";
- this.panel1.Size = new System.Drawing.Size(618, 45);
- this.panel1.TabIndex = 1;
- //
- // comboBox4
- //
- this.comboBox4.FormattingEnabled = true;
- this.comboBox4.Location = new System.Drawing.Point(382, 11);
- this.comboBox4.Name = "comboBox4";
- this.comboBox4.Size = new System.Drawing.Size(230, 20);
- this.comboBox4.TabIndex = 2;
- this.comboBox4.SelectedIndexChanged += new System.EventHandler(this.comboBox4_SelectedIndexChanged);
- //
- // comboBox3
- //
- this.comboBox3.FormattingEnabled = true;
- this.comboBox3.Location = new System.Drawing.Point(196, 11);
- this.comboBox3.Name = "comboBox3";
- this.comboBox3.Size = new System.Drawing.Size(180, 20);
- this.comboBox3.TabIndex = 1;
- this.comboBox3.SelectedIndexChanged += new System.EventHandler(this.comboBox3_SelectedIndexChanged);
- //
- // comboBox2
- //
- this.comboBox2.FormattingEnabled = true;
- this.comboBox2.Location = new System.Drawing.Point(10, 11);
- this.comboBox2.Name = "comboBox2";
- this.comboBox2.Size = new System.Drawing.Size(180, 20);
- this.comboBox2.TabIndex = 0;
- this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
- //
- // panel2
- //
- this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.panel2.Controls.Add(this.comboBox5);
- this.panel2.Location = new System.Drawing.Point(12, 388);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(618, 45);
- this.panel2.TabIndex = 3;
- //
- // comboBox5
- //
- this.comboBox5.FormattingEnabled = true;
- this.comboBox5.Location = new System.Drawing.Point(10, 11);
- this.comboBox5.Name = "comboBox5";
- this.comboBox5.Size = new System.Drawing.Size(180, 20);
- this.comboBox5.TabIndex = 0;
- this.comboBox5.SelectedIndexChanged += new System.EventHandler(this.comboBox5_SelectedIndexChanged);
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.Cursor = System.Windows.Forms.Cursors.Hand;
- this.button1.Location = new System.Drawing.Point(686, 5);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(29, 23);
- this.button1.TabIndex = 2;
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // button2
- //
- this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button2.Cursor = System.Windows.Forms.Cursors.Hand;
- this.button2.Location = new System.Drawing.Point(721, 5);
- this.button2.Name = "button2";
- this.button2.Size = new System.Drawing.Size(33, 23);
- this.button2.TabIndex = 3;
- this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button3
- //
- this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button3.Cursor = System.Windows.Forms.Cursors.Hand;
- this.button3.Location = new System.Drawing.Point(760, 5);
- this.button3.Name = "button3";
- this.button3.Size = new System.Drawing.Size(33, 23);
- this.button3.TabIndex = 4;
- this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // button4
- //
- this.button4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button4.Cursor = System.Windows.Forms.Cursors.Hand;
- this.button4.Location = new System.Drawing.Point(799, 5);
- this.button4.Name = "button4";
- this.button4.Size = new System.Drawing.Size(33, 23);
- this.button4.TabIndex = 5;
- this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.button4_Click);
- //
- // button5
- //
- this.button5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button5.Cursor = System.Windows.Forms.Cursors.Hand;
- this.button5.Location = new System.Drawing.Point(838, 5);
- this.button5.Name = "button5";
- this.button5.Size = new System.Drawing.Size(33, 23);
- this.button5.TabIndex = 6;
- this.button5.UseVisualStyleBackColor = true;
- this.button5.Click += new System.EventHandler(this.button5_Click);
- //
- // button6
- //
- this.button6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button6.Cursor = System.Windows.Forms.Cursors.Hand;
- this.button6.Location = new System.Drawing.Point(877, 5);
- this.button6.Name = "button6";
- this.button6.Size = new System.Drawing.Size(33, 23);
- this.button6.TabIndex = 7;
- this.button6.UseVisualStyleBackColor = true;
- this.button6.Click += new System.EventHandler(this.button6_Click);
- //
- // numericUpDown1
- //
- this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.numericUpDown1.Location = new System.Drawing.Point(831, 399);
- this.numericUpDown1.Maximum = new decimal(new int[] {
- 10,
- 0,
- 0,
- 0});
- this.numericUpDown1.Minimum = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown1.Name = "numericUpDown1";
- this.numericUpDown1.Size = new System.Drawing.Size(75, 21);
- this.numericUpDown1.TabIndex = 11;
- this.numericUpDown1.Value = new decimal(new int[] {
- 2,
- 0,
- 0,
- 0});
- this.numericUpDown1.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);
- //
- // label2
- //
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.label2.AutoSize = true;
- this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label2.Location = new System.Drawing.Point(771, 403);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(53, 12);
- this.label2.TabIndex = 10;
- this.label2.Text = "小数点:";
- //
- // button7
- //
- this.button7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.button7.Cursor = System.Windows.Forms.Cursors.Hand;
- this.button7.Location = new System.Drawing.Point(651, 5);
- this.button7.Name = "button7";
- this.button7.Size = new System.Drawing.Size(29, 23);
- this.button7.TabIndex = 12;
- this.button7.UseVisualStyleBackColor = true;
- this.button7.Click += new System.EventHandler(this.button7_Click);
- //
- // MeasureListDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
- this.BackColor = System.Drawing.SystemColors.Control;
- this.ClientSize = new System.Drawing.Size(922, 442);
- this.Controls.Add(this.button7);
- this.Controls.Add(this.panel2);
- this.Controls.Add(this.numericUpDown1);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.button6);
- this.Controls.Add(this.button5);
- this.Controls.Add(this.button4);
- this.Controls.Add(this.button3);
- this.Controls.Add(this.button2);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.panel1);
- this.Controls.Add(this.tabControl1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Sizable;
- this.Name = "MeasureListDialog";
- this.Text = "测量元素列表";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MeasureListDialog_FormClosing);
- this.Load += new System.EventHandler(this.MeasureListDialog_Load);
- this.Controls.SetChildIndex(this.tabControl1, 0);
- this.Controls.SetChildIndex(this.panel1, 0);
- this.Controls.SetChildIndex(this.button1, 0);
- this.Controls.SetChildIndex(this.button2, 0);
- this.Controls.SetChildIndex(this.button3, 0);
- this.Controls.SetChildIndex(this.button4, 0);
- this.Controls.SetChildIndex(this.button5, 0);
- this.Controls.SetChildIndex(this.button6, 0);
- this.Controls.SetChildIndex(this.label2, 0);
- this.Controls.SetChildIndex(this.numericUpDown1, 0);
- this.Controls.SetChildIndex(this.panel2, 0);
- this.Controls.SetChildIndex(this.button7, 0);
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.tabPage2.ResumeLayout(false);
- this.panel1.ResumeLayout(false);
- this.panel2.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- /// <summary>
- /// 总数据表,一级下拉改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.comboBox2.SelectedIndex == 0)
- {
- if (this.comboBox3.Items.Count > 0)
- {
- this.comboBox3.DataSource = null;
- this.comboBox3.Text = PdnResources.GetString("Menu.Pleaseselect.Text");
- this.comboBox3.Items.Clear();
- }
- }
- else
- {
- model = list.Find(a => a.id == this.comboBox2.SelectedIndex);
- this.comboBox3.DataSource = model.childLabel;
- this.comboBox3.DisplayMember = "name";
- this.comboBox3.ValueMember = "drawToolType";
- }
- this.listView2.Items.Clear();
- this.InitialMasterDataSheetData();
- }
- /// <summary>
- /// 总数据表,二级下拉改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.comboBox3.SelectedIndex <= 0)
- {
- this.comboBox4.DataSource = new BindingSource(InvariantData.measureAttributes, null);
- this.comboBox4.DisplayMember = "Value";
- this.comboBox4.ValueMember = "Key";
- }
- else
- {
- int[] arr;
- InvariantData.measureRelationAttributes.TryGetValue(model.childLabel[this.comboBox3.SelectedIndex].drawToolType, out arr);
- if (arr != null)
- {
- Dictionary<Enum, Object> models = new Dictionary<Enum, object>();
- foreach (int t in arr)
- {
- object v;
- InvariantData.measureAttributes.TryGetValue((MeasureAttributes)t, out v);
- models.Add((DrawToolType)t, v);
- }
- //Dictionary<Enum, Object> models = (Dictionary<Enum, Object>)InvariantData.measureAttributes.Keys.(a=> arr.Contains((int)((DrawToolType)a)));
- this.comboBox4.DataSource = new BindingSource(models, null);
- this.comboBox4.DisplayMember = "Value";
- this.comboBox4.ValueMember = "Key";
- }
- else
- {
- this.comboBox4.DataSource = new BindingSource(InvariantData.measureAttributes, null);
- this.comboBox4.DisplayMember = "Value";
- this.comboBox4.ValueMember = "Key";
- }
- }
- this.listView2.Items.Clear();
- this.InitialMasterDataSheetData();
- }
- /// <summary>
- /// 总数据表,三级下拉改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox4_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.listView2.Items.Clear();
- this.InitialMasterDataSheetData();
- }
- private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.tabControl1.SelectedIndex == 0)
- {
- this.panel1.Visible = false;
- this.panel2.Visible = true;
- }
- else if (this.tabControl1.SelectedIndex == 1)
- {
- this.panel1.Visible = true;
- this.panel2.Visible = false;
- }
- }
- /// <summary>
- /// listView1 ItemSelectionChanged事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.listView1.SelectedItems.Count > 0)
- {
- var senderGrid = (ListView)sender;
- var selectedItems = senderGrid.SelectedItems;
- if (selectedItems.Count > 0)
- {
- DrawObject dObject;
- this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.UnselectAll();
- for (int i = 0; i < selectedItems.Count; i++)
- {
- dObject = (DrawObject)senderGrid.SelectedItems[i].Tag;
- dObject.Selected = true;
- }
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- this.listView1.EndUpdate();
- }
- }
- /// <summary>
- /// listView2 ItemSelectionChanged事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void listView2_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
- {
- if (this.listView2.SelectedItems.Count > 0)
- {
- var senderGrid = (ListView)sender;
- var selectedItems = senderGrid.SelectedItems;
- if (selectedItems.Count > 0)
- {
- DrawObject dObject;
- this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.UnselectAll();
- for (int i = 0; i < selectedItems.Count; i++)
- {
- dObject = (DrawObject)senderGrid.SelectedItems[i].Tag;
- dObject.Selected = true;
- }
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- this.listView2.EndUpdate();
- }
- }
- /// <summary>
- /// 分项数据表 测量方式下拉改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void comboBox5_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.listView1.Clear();
- this.InitializeItemizedHeader();
- this.InitializeItemizedData();
- }
- /// <summary>
- /// 单位下拉改变事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- //private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- //{
- // if (this.comboBox1.SelectedIndex > -1 && this.appWorkspace.ActiveDocumentWorkspace != null)
- // {
- // this.appWorkspace.ActiveDocumentWorkspace.UpdateMeasureUnit((MeasurementUnit)(this.comboBox1.SelectedIndex + 1));// + 1
- // this.listView1.Items.Clear();
- // this.InitializeItemizedData();
- // this.listView2.Items.Clear();
- // this.InitialMasterDataSheetData();
- // }
- //}
- /// <summary>
- /// 小数点位数更改事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void numericUpDown1_ValueChanged(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(numericUpDown1.Value.ToString()))
- {
- this.UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
- if (this.appWorkspace.Widgets != null)
- this.appWorkspace.Widgets.GeometryMeasureDialog.numericUpDown5.Value = numericUpDown1.Value;
- //this.appWorkspace.ActiveDocumentWorkspace.UpdateMeasureDecimalPlaces((int)numericUpDown1.Value);
- this.listView1.Items.Clear();
- this.InitializeItemizedData();
- this.listView2.Items.Clear();
- this.InitialMasterDataSheetData();
- }
- }
- /// <summary>
- /// 更新小数位数
- /// </summary>
- /// <param name="decimalPlaces"></param>
- public void UpdateMeasureDecimalPlaces(int praDecimalPlaces)
- {
- MeasureDrawObject.decimalPlaces = praDecimalPlaces;
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- for (int i = 0; i < this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count; i++)
- {
- if (!"Measure".Equals(this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType.ToString()))
- continue;
- ((MeasureDrawObject)this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i]).mouseUpAttribute = true;
- }
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- }
- /// <summary>
- /// 设置按钮按下
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- using (MeasureListSetDialog dialog = new MeasureListSetDialog(this.appWorkspace, drawNodes, dataNodes, allDrawNodes, allDataNodes))
- {
- dialog.StartPosition = FormStartPosition.CenterParent;
- dialog.ShowDialog();
- }
- }
- /// <summary>
- /// 导出到模板
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button2_Click(object sender, EventArgs e)
- {
- //if(this.listView2.Items.Count > 0)
- this.TemplateDataExcel();
- //else
- // MessageBox.Show(PdnResources.GetString("Menu.Thereisnomeasurementdata.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- MeasureListSettingDialog measureListSettingDialog = new MeasureListSettingDialog(this, "Template.Manager.item1.MeasureList", this.appWorkspace, datatable);
- if (measureListSettingDialog.hasModule)
- {
- measureListSettingDialog.StartPosition = FormStartPosition.CenterScreen;
- measureListSettingDialog.ShowDialog();
- }
- else
- {
- measureListSettingDialog = null;
- }
- }
- /// <summary>
- /// 数据统计导出到Excel
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button3_Click(object sender, EventArgs e)
- {
- if (this.listView1.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Thereisnomeasurementdata.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- return;
- }
- if (!this.listView1.Visible)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Thetotaldatatableisnotstatistical.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- return;
- }
- MeasureListStatisticalDataDialog measureListStatisticalDataDialog = new MeasureListStatisticalDataDialog(this.appWorkspace, this.listView1, this.comboBox5.SelectedIndex);
- measureListStatisticalDataDialog.StartPosition = FormStartPosition.CenterParent;
- measureListStatisticalDataDialog.ShowDialog();
- //if (this.listView1.Items.Count > 0)
- //{
- // if(this.listView1.Visible)
- // this.StatisticalDataExcel();
- // else
- // MessageBox.Show(PdnResources.GetString("Menu.Thetotaldatatableisnotstatistical.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- //}
- //else
- // MessageBox.Show(PdnResources.GetString("Menu.Thereisnomeasurementdata.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- //if (this.listView1.Items.Count > 0)
- //{
- // if(this.listView1.Visible)
- // this.StatisticalDataExcel();
- // else
- // MessageBox.Show(PdnResources.GetString("Menu.Thetotaldatatableisnotstatistical.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- //}
- //else
- // MessageBox.Show(PdnResources.GetString("Menu.Thereisnomeasurementdata.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- }
- /// <summary>
- /// 选择清除按钮按下事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button4_Click(object sender, EventArgs e)
- {
- if(this.listView2.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Thereisnomeasurementdata.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- }
- else
- {
- var selectedItems1 = this.listView1.SelectedItems;
- var selectedItems2 = this.listView2.SelectedItems;
- if (selectedItems1.Count == 0 && selectedItems2.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Pleaseselectthedatatobedeleted.text")+"!", PdnResources.GetString("Menu.hint.text"));
- }
- else
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Aresuredeletemeasurementdata.Text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- // 分项数据表
- if (selectedItems1.Count > 0 && this.listView1.Visible)
- {
- int index1 = this.listView1.SelectedIndices[0];
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- for (int i = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count - 1; i >= 0; i--)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i] == this.listView1.Items[index1].Tag)
- {
- this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.RemoveAt(i);
- break;
- }
- }
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- this.InitializeItemizedComboBox();
- this.InitializeItemizedHeader();
- this.listView1.Items.Clear();
- this.InitializeItemizedData();
- this.listView2.Items.Clear();
- this.InitialMasterDataSheetData();
- }
- else
- {
- this.listView2.Clear();
- this.listView1.Clear();
- this.comboBox5.DataSource = null;
- }
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- }
- // 总数据表
- if (selectedItems2.Count > 0 && this.listView2.Visible)
- {
- int index2 = this.listView2.SelectedIndices[0];
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- for (int i = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count - 1; i >= 0; i--)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i] == this.listView2.Items[index2].Tag)
- {
- this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.RemoveAt(i);
- break;
- }
- }
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- this.InitializeItemizedComboBox();
- this.InitializeItemizedHeader();
- this.listView1.Items.Clear();
- this.InitializeItemizedData();
- this.listView2.Items.Clear();
- this.InitialMasterDataSheetData();
- }
- else
- {
- this.listView2.Clear();
- this.listView1.Clear();
- this.comboBox5.DataSource = null;
- }
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- }
- }
- }
- }
- }
- /// <summary>
- /// /// 清除按钮按下事件
- /// /// </summary>
- /// /// <param name="sender"></param>
- /// /// <param name="e"></param>
- private void button5_Click(object sender, EventArgs e)
- {
- if (this.listView2.Items.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Thereisnomeasurementdata.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- }
- else
- {
- DialogResult dr = MessageBox.Show(PdnResources.GetString("Menu.Aresuredeletemeasurementdata.Text")+"?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- // 分项数据表
- if (this.listView1.Visible)
- {
- if (this.comboBox5.SelectedIndex >= 0)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- for (int i = this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count - 1; i >= 0; i--)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == (DrawToolType)this.comboBox5.SelectedValue)
- {
- this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.RemoveAt(i);
- }
- }
- if (this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Count > 0)
- {
- this.InitializeItemizedComboBox();
- this.InitializeItemizedHeader();
- this.InitializeItemizedData();
- this.listView2.Items.Clear();
- this.InitialMasterDataSheetData();
- }
- else
- {
- this.listView2.Clear();
- this.listView1.Clear();
- this.comboBox5.DataSource = null;
- }
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- }
- }
- }
- // 总数据表
- if (this.listView2.Visible)
- {
- if (this.appWorkspace.ActiveDocumentWorkspace != null)
- {
- this.appWorkspace.ActiveDocumentWorkspace.GraphicsList.Clear();
- this.appWorkspace.ActiveDocumentWorkspace.Refresh();
- this.listView2.Items.Clear();
- this.listView1.Clear();
- this.comboBox5.DataSource = null;
- this.comboBox2.SelectedIndex = 0;
- }
- }
- }
- }
- }
- /// <summary>
- /// 导出数据到Excel按钮按下
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button6_Click(object sender, EventArgs e)
- {
- if(this.listView2.Items.Count > 0)
- this.InitialDataExcel();
- else
- MessageBox.Show(PdnResources.GetString("Menu.Thereisnomeasurementdata.Text")+"!", PdnResources.GetString("Menu.hint.text"));
- }
- /// <summary>
- /// 导出多 Sheet 报表
- /// </summary>
- /// <param name="ds">要导出的数据</param>
- public void DataToExcle(System.Data.DataSet ds)
- {
- try
- {
- if (ds.Tables == null || ds.Tables.Count == 0)
- {
- MessageBox.Show(PdnResources.GetString("Menu.Nonedata.Text")+"!");
- return;
- }
- SaveFileDialog saveFileDialog = new SaveFileDialog();
- saveFileDialog.DefaultExt = "xlsx";
- saveFileDialog.Title = PdnResources.GetString("Menu.ExportdatatoEXECLtable.Text");
- saveFileDialog.FileName = DateTime.Now.ToString("yyyyMMddhhmmss") + PdnResources.GetString("Menu.Measurementdatasheet.Text");
- saveFileDialog.Filter = "microsoft office execl files (*.xlsx)|*.xlsx";
- saveFileDialog.RestoreDirectory = true;
- if (saveFileDialog.ShowDialog() == DialogResult.OK)
- {
- System.Reflection.Missing miss = System.Reflection.Missing.Value;
- Microsoft.Office.Interop.Excel.Application xlapp = new Microsoft.Office.Interop.Excel.Application();
- Workbooks workbooks = xlapp.Workbooks;
- Workbook workbook = workbooks.Add(true);
- if (ds.Tables.Count > 1)
- {
- workbook.Sheets.Add(miss, workbook.Sheets[1], ds.Tables.Count - 1, miss);
- }
- for (int d = 0; d < ds.Tables.Count; d++)
- {
- Worksheet ws = workbook.Worksheets[d + 1] as Worksheet;
- ws.Name = ds.Tables[d].TableName;
- int totalCellsCount = ds.Tables[d].Columns.Count;
- Range range = ws.Range[ws.Cells[1, 1], ws.Cells[1, ds.Tables[d].Columns.Count]];
- //生成列
- for (int i = 0; i < ds.Tables[d].Columns.Count; i++)
- {
- range.EntireColumn.AutoFit();
- range.EntireRow.AutoFit();
- }
- //插入数据
- for (int r = 0; r < ds.Tables[d].Rows.Count; r++)
- {
- for (int i = 0; i < ds.Tables[d].Columns.Count; i++)
- {
- ws.Cells[r + 1, i + 1] = "'" + ds.Tables[d].Rows[r][i].ToString();
- }
- }
- System.Runtime.InteropServices.Marshal.ReleaseComObject(range);
- range = null;
- System.Runtime.InteropServices.Marshal.ReleaseComObject(ws);
- ws = null;
- }
- ((Worksheet)workbook.Sheets[1]).Select(true);//选中第一个worksheet
- workbook.SaveAs(saveFileDialog.FileName, miss, miss, miss, miss, miss, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, miss, miss, miss);
- System.Runtime.InteropServices.Marshal.ReleaseComObject(workbook);
- workbook = null;
- xlapp.Quit();
- System.Runtime.InteropServices.Marshal.ReleaseComObject(xlapp);
- xlapp = null;
- GC.Collect();
- GC.WaitForPendingFinalizers();
- }
- }
- catch (Exception e)
- {
- throw e;
- }
- }
- private void MeasureListDialog_Load(object sender, EventArgs e)
- {
- if (this.appWorkspace != null)
- {
- this.appWorkspace.RefreshListView();
- }
- }
- private void MeasureListDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- appWorkspace.Widgets.MeasureListDialog.Visible = false;
- this.appWorkspace.toolBar.RefreshBtnSelect(false, "MeasureList");
- this.appWorkspace.toolsPanel.RefreshBtnSelect(false, "MeasureList");
- saveLastData();
- }
- /// <summary>
- /// 总数据导出
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button7_Click(object sender, EventArgs e)
- {
- 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<string> measures = new List<string>();
- // 所有测量工具
- for (int g = this.appWorkspace.DocumentWorkspaces[i].GraphicsList.Count - 1; g >= 0; g--)
- {
- if (this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].objectType == DrawClass.Measure)
- {
- measures.Add(this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString());
- // 测量数据
- Dictionary<System.Enum, object> data = ((MeasureDrawObject)this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g]).GetData();
- // 测量工具名称
- string drawName = PdnResources.GetString("Menu.MeasureAction." + this.appWorkspace.DocumentWorkspaces[i].GraphicsList[g].drawToolType.ToString() + ".Text");
- string[] drawingPropertiesList;
- ((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++;
- }
- // 所有可见的属性
- 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] = value;
- 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] = lengthParagraph;
- 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;
- }
- }
- /// <summary>
- /// 获取上次操作参数
- /// </summary>
- private void getLastData()
- {
- string filePath = System.Windows.Forms.Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterMeasureModel.xml";
- if (!System.IO.File.Exists(filePath))
- {
- measureModel = new MeasureModel();
- measureModel.MeasureListModels = new MeasureModel.MeasureListModel();
- measureModel.MeasureListModels.hasUsed = false;
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<MeasureModel>(measureModel);
- Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath + "\\Config\\Default\\ParameterSaving\\");
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.CreateNew);
- }
- else
- {
- measureModel = XmlSerializeHelper.DESerializer<MeasureModel>(FileOperationHelper.ReadStringFromFile(filePath, FileMode.Open));
- if (measureModel.MeasureListModels == null)
- {
- measureModel.MeasureListModels = new MeasureModel.MeasureListModel();
- }
- if (measureModel.MeasureListModels.hasUsed)
- {
- numericUpDown1.Value = measureModel.MeasureListModels.parameter1;
- }
- }
- }
- /// <summary>
- /// 保存上次操作参数
- /// </summary>
- private void saveLastData()
- {
- if (measureModel.MeasureListModels == null)
- {
- measureModel.MeasureListModels = new MeasureModel.MeasureListModel();
- }
- measureModel.MeasureListModels.hasUsed = true;
- measureModel.MeasureListModels.parameter1 = Convert.ToInt32(numericUpDown1.Value);
- string filePath = System.Windows.Forms.Application.StartupPath + "\\Config\\Default\\ParameterSaving\\ParameterMeasureModel.xml";
- string porosityInfoXml = XmlSerializeHelper.XmlSerialize<MeasureModel>(measureModel);
- FileOperationHelper.WriteStringToFile(porosityInfoXml, filePath, FileMode.Create);
- }
- }
- }
|