You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
130 lines
5.3 KiB
130 lines
5.3 KiB
using KGIS.Framework.Maps; |
|
using KGIS.Framework.Utils; |
|
using KGIS.Framework.Utils.Helper; |
|
using Kingo.Plugin.DLTB_IDG.Helper; |
|
using Kingo.PluginServiceInterface; |
|
using KUI.Windows; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Windows; |
|
using System.Windows.Controls; |
|
using System.Xml.Linq; |
|
using static Kingo.Plugin.DLTB_IDG.Helper.SXWHHelper; |
|
|
|
namespace Kingo.Plugin.AttributeMaintain.View |
|
{ |
|
/// <summary> |
|
/// 属性维护 的交互逻辑 |
|
/// </summary> |
|
public partial class FrmAttributeMaintain : BaseWindow |
|
{ |
|
List<TestData> list = new List<TestData>(); |
|
public FrmAttributeMaintain() |
|
{ |
|
InitializeComponent(); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "耕地坡度级别赋值(单纯变化增量)", ItemType = "GDPDJB_DLZL" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "椭球面积计算", ItemType = "Area" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "标识码赋值", ItemType = "BSM" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "要素代码赋值", ItemType = "YSDM" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "扣除地类系数", ItemType = "KCXS" }); |
|
list.Add(new TestData() { IsChecked = true, Descriction = "扣除面积计算", ItemType = "KCMJ" }); |
|
//list.Add(new TestData() { IsChecked = false, Descriction = "扣除地类系数维护(耕地未变化数据)", ItemType = "KCXS_GDWBH" }); |
|
//list.Add(new TestData() { IsChecked = false, Descriction = "图斑细化代码(LQGD,MQGD,SHGD,SMGD)", ItemType = "TBXHDM_GD" }); |
|
//陕西项目该项目需注释 |
|
if (MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo ProInfo && (ProInfo.ProjType == EnumProjType.RCBG_BCGD || ProInfo.ProjType == EnumProjType.RCBG_ZJG)) |
|
list.Add(new TestData() { IsChecked = true, Descriction = "项目属性赋值", ItemType = "XMSX" }); |
|
AttributeItemsSourse.ItemsSource = list; |
|
AttributeItemsSourse.MinRowHeight = 30; |
|
} |
|
|
|
private void FrmAttribute_Loaded(object sender, RoutedEventArgs e) |
|
{ |
|
InitGD();//初始化地类系数 |
|
} |
|
|
|
/// <summary> |
|
/// 全选-复选框 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void CheckAll_Checked(object sender, RoutedEventArgs e) |
|
{ |
|
list.ForEach(f => f.IsChecked = (sender as CheckBox).IsChecked == true); |
|
} |
|
|
|
/// <summary> |
|
/// 取消按钮 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void KImgCancel_Click(object sender, RoutedEventArgs e) |
|
{ |
|
this.Close(); |
|
} |
|
|
|
/// <summary> |
|
/// 确定按钮 |
|
/// </summary> |
|
/// <param name="sender"></param> |
|
/// <param name="e"></param> |
|
private void KImgSure_Click(object sender, RoutedEventArgs e) |
|
{ |
|
try |
|
{ |
|
this.ShowLoading("正在进行属性维护...", 0, 0); |
|
SXWHHelper sXWHHelper = new SXWHHelper(GDEntitys, list); |
|
sXWHHelper.Implement(); |
|
this.CloseLoading(); |
|
if (list.FirstOrDefault(x => x.IsChecked == true) != null) |
|
MessageHelper.ShowTips("属性维护成功!"); |
|
else |
|
MessageHelper.ShowError("请选择其中一项进行属性维护!"); |
|
} |
|
catch (Exception ex) |
|
{ |
|
this.CloseLoading(); |
|
LogAPI.Debug("属性维护异常信息:" + ex.Message); |
|
MessageHelper.ShowError("属性维护异常:" + ex.Message); |
|
} |
|
finally |
|
{ |
|
this.CloseLoading(); |
|
} |
|
} |
|
private XDocument xDoc; |
|
private List<GDEntity> GDEntitys; |
|
public void InitGD() |
|
{ |
|
try |
|
{ |
|
GDEntitys = new List<GDEntity>(); |
|
string strPath = SysAppPath.GetBGGDLXConfigPath(); |
|
xDoc = XDocument.Load(strPath); |
|
foreach (XElement xElement in xDoc.Descendants("Item")) |
|
{ |
|
GDEntity model = new GDEntity(); |
|
model.Checked = true; |
|
model.GDLX = xElement.Attributes("GDLX").Single().Value; |
|
model.GDPDJB = xElement.Attributes("GDPDJB").Single().Value; |
|
model.GDPDJBMC = xElement.Attributes("GDPDJBMC").Single().Value; |
|
decimal kcdlxs = 0; |
|
if (decimal.TryParse(xElement.Attributes("KCDLXS").Single().Value, out kcdlxs)) |
|
{ |
|
model.KCDLXS = kcdlxs; |
|
} |
|
else |
|
{ |
|
model.KCDLXS = 0; |
|
} |
|
//model.XMSX = xElement.Attributes("XMSX").Single().Value; |
|
GDEntitys.Add(model); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageHelper.ShowTips("界面初始化失败,可能的原因是:" + ex.Message); |
|
} |
|
} |
|
} |
|
}
|
|
|