public void InitData(string SvgDataUid) { LayerFile temp = new LayerFile(); temp.SvgDataUid = SvgDataUid; IList layerList = Services.BaseService.GetList("SelectLayerFileBySvgDataUid", temp); //DataTable dt = Itop.Common.DataConverter.ToDataTable(layerList, typeof(LayerFile)); //ln.Properties.DataSource = dt; //ln.Properties.DisplayMember = "LayerFileName"; checkedListBox1.Items.Clear(); checkedListBox1.BeginUpdate(); foreach (LayerFile lay in layerList) { checkedListBox1.Items.Add(lay); } checkedListBox1.DisplayMember = "LayerFileName"; checkedListBox1.EndUpdate(); }
private void layerExport() { if (tlVectorControl1.SVGDocument.CurrentLayer != null) { Layer layer = tlVectorControl1.SVGDocument.CurrentLayer; XmlNode node = tlVectorControl1.SVGDocument.SelectSingleNode("//*[@layer='" + layer.ID + "']"); if (node == null) { MessageBox.Show("图层为空图层,不能进行导出操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } LayerFile temp = new LayerFile(); temp.SvgDataUid = tlVectorControl1.SVGDocument.SvgdataUid; IList lList = Services.BaseService.GetList("SelectLayerFileBySvgDataUid", temp); foreach (LayerFile lay in lList) { if (lay.LayerFileName == layer.Label) { MessageBox.Show("文档中已经存在同名图层,请修改图层名称后导出。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } string strsvgData = tlVectorControl1.SVGDocument.SelectNodesToString("svg/*[@layer='" + layer.ID + "']|svg/defs"); LayerFile layerFile = new LayerFile(); layerFile.SUID = Guid.NewGuid().ToString(); layerFile.LayerID = layer.ID; layerFile.LayerFileName = layer.Label; layerFile.SvgDataUid = SVGUID; layerFile.LayerOuterXml = strsvgData; Services.BaseService.Create<LayerFile>(layerFile); MessageBox.Show("图层已成功导出", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //frmlar.DeleteLayer(layer); //frmlar.InitData(); } }