using ESRI.ArcGIS.Controls; using KGIS.Framework.Maps; using KGIS.Framework.Platform; using KGIS.Framework.Utils; using KGIS.Framework.Utils.ExtensionMethod; using KGIS.Framework.Utils.Helper; using KGIS.Framework.Views; using Kingo.PluginServiceInterface; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Xml.Linq; using UIShell.OSGi; namespace Kingo.Plugin.General.View { /// /// UCDTBAllInfo.xaml 的交互逻辑 /// public partial class UCDTBAllInfo : UserControl, IDockPanel3, INotifyPropertyChanged { /// /// 上一条数据 /// public Action PreData; /// /// 下一条数据 /// public Action NextData;//bool 代表预处理模式下是否是保存按钮触发的下一条 /// /// 返外业 /// public Action FWYAction; List attributeViewIsShows; string TypeSystem = string.Empty; public UCDTBAllInfo(string SystemType) { InitializeComponent(); this.Title = "单图斑信息"; this.DockWidth = 500; this.DefaultArea = DockStyle.DockRight; this.DockAreas = DockStyle.DockRight; this.ShowCloseButton = true; this.ShowAutoHideButton = true; this.IsShowInMap = true; this.IsDockToPanel = true; TypeSystem = SystemType; if (TypeSystem == SystemTypeEnum.YCLJK.ToTrim()) { DTBInfo.Visibility = Visibility.Collapsed; //tabGJFKYJ.Visibility = Visibility.Collapsed; //调整顺序 var tabItem = tabControl.Items[2]; tabControl.Items.RemoveAt(2); tabControl.Items.Insert(0, tabItem); ((TabItem)tabItem).IsSelected = true; btnOk.Visibility = Visibility.Visible; } else if (TypeSystem == SystemTypeEnum.DTBJK.ToTrim()) { btnFWY.Visibility = Visibility.Visible; //陕西保存 //btnOk.Visibility = Visibility.Visible; } else if (TypeSystem == SystemTypeEnum.WYZS.ToTrim()) { btnOk.Visibility = Visibility.Visible; btnFWY.Visibility = Visibility.Visible; } this.Loaded += (s, e) => { GetViewIsShow(); InitDTBInfoView(); }; } private void GetViewIsShow() { attributeViewIsShows = new List(); try { string attributeViewIsShowFilePath = System.IO.Path.Combine(SysAppPath.GetConfigPath(), "AttributeShowConfigs.xml"); XDocument pXDoc = XDocument.Load(attributeViewIsShowFilePath); var sdm = KGIS.Framework.Utils.SysConfigsOprator.GetAppsetingValueByKey("ArearName"); IEnumerable elements = pXDoc.Element("Attributes").Elements().Where(x => x.Attribute("Name").Value.ToTrim().Contains(sdm)); var elements1 = elements.FirstOrDefault().Elements(); foreach (XElement item in elements1) { PluginServiceInterface.Model.Attribute attributeViewIsShow = new PluginServiceInterface.Model.Attribute(); attributeViewIsShow.Name = item.Attribute("Name").Value; attributeViewIsShow.ViewName = item.Attribute("ViewName").Value; attributeViewIsShow.Type = item.Attribute("Type") == null ? "" : item.Attribute("Type").Value; attributeViewIsShow.IsShow = bool.Parse(item.Attribute("IsShow").Value); attributeViewIsShows.Add(attributeViewIsShow); } } catch (Exception ex) { LogAPI.Debug("GetViewIsShow异常:" + ex.Message); LogAPI.Debug("GetViewIsShow异常:" + ex.StackTrace); } } public bool IsDockToPanel { get; set; } public DockStyle DockToPanelStyle { get; set; } public bool IsShowInMap { get; set; } public Guid ID { get; set; } public DockStyle DockAreas { get; set; } public System.Drawing.Size FloatSize { get; set; } public int DockWidth { get; set; } public int DockHeight { get; set; } public DockStyle DefaultArea { get; set; } public bool ShowCloseButton { get; set; } public bool ShowAutoHideButton { get; set; } public string Title { get; set; } public event EventHandler CloseViewHandler; public event PropertyChangedEventHandler PropertyChanged; private IEngineEditor EngineEditorBG { get; set; } private ControlsEditingSaveCommandClass ControlsEditingSave { get; set; } private List _Elements = null; private IElementInfo _NYYSInfo = null; public IElementInfo _FeatureInfo = null; public IElementInfo _NYYPInfo = null; private IElementInfo _WYImgInfo = null; private IElementInfo _SLNYYSResult = null; private IElementInfo _SHInfo = null; private IElementInfo _WYCTInfo = null; private IElementInfo _GJFKInfo = null; private IElementInfo _WYSPInfo = null; private IElementInfo _WYFJInfo = null; private IElementInfo _HCFKYJInfo = null; /// /// 省级审核意见 /// private IElementInfo _SJSHYJ = null; /// /// 省级审核意见信息 /// private IElementInfo _SJSHYJXX = null; private object ArraysInfo { get; set; } public void InitDTBInfoView() { try { if (_Elements == null) { _Elements = BundleRuntime.Instance.GetService(); } if (_Elements == null) return; if (attributeViewIsShows == null) return; #region 单图斑外业照片 if (attributeViewIsShows.Find(a => a.Name == "单图斑外业照片" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "单图斑外业照片" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_WYImgInfo == null) { _WYImgInfo = _Elements.FirstOrDefault(f => f.Title == "单图斑外业照片"); } if (_WYImgInfo != null && (_WYImgInfo as UserControl).Parent != null) { ((_WYImgInfo as UserControl).Parent as Grid).Children.Clear(); } if (_WYImgInfo != null) { WYImgInfo.Children.Add(_WYImgInfo as UIElement); _WYImgInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-单图斑外业照片组件-失败!"); } else { tabControl1.Items.Remove(tabTBInfo1); } #endregion #region 外业举证信息 注:陕西矢量外业信息展示 if (attributeViewIsShows.Find(a => a.Name == "外业举证信息" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "外业举证信息" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_SLNYYSResult == null) { _SLNYYSResult = _Elements.FirstOrDefault(f => f.Title == "外业举证信息"); } if (_SLNYYSResult != null && (_SLNYYSResult as UserControl).Parent != null) { ((_SLNYYSResult as UserControl).Parent as Grid).Children.Clear(); } if (_SLNYYSResult != null) { SLNYYSResult.Children.Add(_SLNYYSResult as UIElement); _SLNYYSResult.BindData(ArraysInfo); } else LogAPI.Debug("加载-外业举证信息组件-失败!"); } else { gridYCLXX.Children.Remove(SLNYYSResult); } #endregion #region 审核信息 if (attributeViewIsShows.Find(a => a.Name == "审核结果" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "审核结果" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_SHInfo == null) { _SHInfo = _Elements.FirstOrDefault(f => f.Title == "审核结果"); } if (_SHInfo != null && (_SHInfo as UserControl).Parent != null) { ((_SHInfo as UserControl).Parent as Grid).Children.Clear(); } if (_SHInfo != null) { SHInfo.Children.Add(_SHInfo as UIElement); if (ArraysInfo != null) _SHInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-审核结果组件-失败!"); } else { tabControl.Items.Remove(tabSHInfo); } #endregion #region 图斑基本信息 if (attributeViewIsShows.Find(a => a.Name == "图斑基本信息" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "图斑基本信息" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_NYYPInfo == null) { _NYYPInfo = _Elements.FirstOrDefault(f => f.Title == "图斑基本信息"); } if ((_NYYPInfo as UserControl).Parent != null) { ((_NYYPInfo as UserControl).Parent as Grid).Children.Clear(); } if (_NYYPInfo != null) { WYRWTBInfo.Children.Add(_NYYPInfo as UIElement); _NYYPInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-图斑基本信息组件-失败!"); } else { gridYCLXX.Children.Remove(WYRWTBInfo); } #endregion #region 内业预处理结果 if (attributeViewIsShows.Find(a => a.Name == "内业预处理结果" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "内业预处理结果" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_NYYSInfo == null) { _NYYSInfo = _Elements.FirstOrDefault(f => f.Title == "内业预处理结果"); } if ((_NYYSInfo as UserControl).Parent != null) { ((_NYYSInfo as UserControl).Parent as Grid).Children.Clear(); } if (_NYYSInfo != null) { NYYSInfo.Children.Add(_NYYSInfo as UIElement); if (ArraysInfo != null) _NYYSInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-内业预处理结果-失败!"); } else { gridYCLXX.Children.Remove(NYYSInfo); } #endregion #region 外业草图_单图斑 if (attributeViewIsShows.Find(a => a.Name == "外业草图_单图斑" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "外业草图_单图斑" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_WYCTInfo == null) { _WYCTInfo = _Elements.FirstOrDefault(f => f.Title == "外业草图_单图斑"); } if ((_WYCTInfo as UserControl).Parent != null) { ((_WYCTInfo as UserControl).Parent as Grid).Children.Clear(); } if (_WYCTInfo != null) { WYZDCT.Children.Add(_WYCTInfo as UIElement); _WYCTInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-外业草图组件-失败!"); } #endregion #region 外业草图 if (attributeViewIsShows.Find(a => a.Name == "外业草图" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "外业草图" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_WYCTInfo == null) { _WYCTInfo = _Elements.FirstOrDefault(f => f.Title == "外业草图"); } if ((_WYCTInfo as UserControl).Parent != null) { ((_WYCTInfo as UserControl).Parent as Grid).Children.Clear(); } if (_WYCTInfo != null) { WYZDCT.Children.Add(_WYCTInfo as UIElement); if (ArraysInfo != null) _WYCTInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-外业草图组件-失败!"); } #endregion #region 要素属性 if (TypeSystem != SystemTypeEnum.YCLJK.ToTrim()) { if (attributeViewIsShows.Find(a => a.Name == "要素属性" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "要素属性" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_FeatureInfo == null) { _FeatureInfo = _Elements.FirstOrDefault(f => f.Title == "要素属性"); } if (_FeatureInfo != null && (_FeatureInfo as UserControl).Parent != null) { ((_FeatureInfo as UserControl).Parent as Grid).Children.Clear(); } if (_FeatureInfo != null) { DTBInfo.Children.Add(_FeatureInfo as UIElement); _FeatureInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-要素属性组件-失败!"); } else { gridTBInfo.Children.Remove(DTBInfo); } } #endregion #region 外业视频 if (attributeViewIsShows.Find(a => a.Name == "外业视频" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "外业视频" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_WYSPInfo == null) { _WYSPInfo = _Elements.FirstOrDefault(f => f.Title == "外业视频"); } if (_WYSPInfo != null && (_WYSPInfo as UserControl).Parent != null) { ((_WYSPInfo as UserControl).Parent as Grid).Children.Clear(); } if (_WYSPInfo != null) { WYSPInfo.Children.Add(_WYSPInfo as UIElement); _WYSPInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-单图斑外业视频组件-失败!"); } else { tabControl1.Items.Remove(tabTBInfo2); } #endregion #region 外业附件 if (attributeViewIsShows.Find(a => a.Name == "外业附件" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "外业附件" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_WYFJInfo == null) { _WYFJInfo = _Elements.FirstOrDefault(f => f.Title == "外业附件"); } if (_WYFJInfo != null && (_WYFJInfo as UserControl).Parent != null) { ((_WYFJInfo as UserControl).Parent as Grid).Children.Clear(); } if (_WYFJInfo != null) { WYFJInfo.Children.Add(_WYFJInfo as UIElement); _WYFJInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-单图斑外业附件组件-失败!"); } else { tabControl1.Items.Remove(tabTBInfo3); } #endregion #region 省级审核意见 if (attributeViewIsShows.Find(a => a.Name == "省级反馈意见" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "省级反馈意见" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_SJSHYJ == null) { _SJSHYJ = _Elements.FirstOrDefault(f => f.Title == "省级反馈意见"); } if (_SJSHYJ != null && (_SJSHYJ as UserControl).Parent != null) { ((_SJSHYJ as UserControl).Parent as Grid).Children.Clear(); } if (_SJSHYJ != null) { SJFKYJ.Children.Add(_SJSHYJ as UIElement); if (ArraysInfo != null) _SJSHYJ.BindData(ArraysInfo); } else LogAPI.Debug("加载-省级反馈意见组件-失败!"); } else { tabControl.Items.Remove(tabSJFKYJ); } #endregion #region 省级反馈意见信息 if (attributeViewIsShows.Find(a => a.Name == "省级审核意见信息" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "省级审核意见信息" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_SJSHYJXX == null) { _SJSHYJXX = _Elements.FirstOrDefault(f => f.Title == "省级审核意见信息"); } if ((_SJSHYJXX as UserControl).Parent != null) { ((_SJSHYJXX as UserControl).Parent as Grid).Children.Clear(); } if (_SJSHYJXX != null) { SJSHYJXX.Children.Add(_SJSHYJXX as UIElement); _SJSHYJXX.BindData(ArraysInfo); } else { LogAPI.Debug("加载-省级审核意见信息组件-失败!"); } } else { tabControl.Items.Remove(tabUCSJSHYJXX); } #endregion #region 国家反馈意见 if (attributeViewIsShows.Find(a => a.Name == "国家反馈意见" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "国家反馈意见" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_GJFKInfo == null) { _GJFKInfo = _Elements.FirstOrDefault(f => f.Title == "国家反馈意见"); } if ((_GJFKInfo as UserControl).Parent != null) { ((_GJFKInfo as UserControl).Parent as Grid).Children.Clear(); } if (_GJFKInfo != null) { GJFKYJ.Children.Add(_GJFKInfo as UIElement); if (ArraysInfo != null) _GJFKInfo.BindData(ArraysInfo); } else { LogAPI.Debug("加载-国家反馈意见组件-失败!"); } } else { tabControl.Items.Remove(tabGJFKYJ); } #endregion #region 核查反馈意见 if (attributeViewIsShows.Find(a => a.Name == "核查反馈意见" && a.Type.Contains(TypeSystem)) != null && attributeViewIsShows.Find(a => a.Name == "核查反馈意见" && a.Type.Contains(TypeSystem)).IsShow == true) { if (_HCFKYJInfo == null) { _HCFKYJInfo = _Elements.FirstOrDefault(f => f.Title == "核查反馈意见"); } if (_HCFKYJInfo != null && (_HCFKYJInfo as UserControl).Parent != null) { ((_HCFKYJInfo as UserControl).Parent as Grid).Children.Clear(); } if (_HCFKYJInfo != null) { HCFKYJ.Children.Add(_HCFKYJInfo as UIElement); _HCFKYJInfo.BindData(ArraysInfo); } else LogAPI.Debug("加载-单图斑核查反馈意见组件-失败!"); } else { tabControl1.Items.Remove(tabTBInfo1); } #endregion } catch (Exception ex) { LogAPI.Debug("初始化图斑详情页面失败!"); LogAPI.Debug(ex); } } public void BindDataInfo(object arrays) { try { NYYSInfo nYYSInfo = arrays as NYYSInfo; if (nYYSInfo == null) return; ArraysInfo = arrays; InitDTBInfoView(); if (nYYSInfo.BingDataType == PluginServiceInterface.Enums.DTBDataTypeEnum.DTBSL) { btnFWY.Visibility = Visibility.Collapsed; } } catch (Exception ex) { LogAPI.Debug("单图斑页面绑定失败:" + ex.Message); } } public void ClosePanel() { Platform.Instance.CloseView(this); } public void ClosePanelInvoke() { CloseViewHandler?.Invoke(this, null); } public void ShowPanel() { Platform.Instance.OpenView(this, false); } /// /// 上一条 /// /// /// private void BtnPre_Click(object sender, RoutedEventArgs e) { if ((TypeSystem == SystemTypeEnum.RCBGJK.ToTrim() || TypeSystem == SystemTypeEnum.DTBJK.ToTrim() || TypeSystem == SystemTypeEnum.WYZS.ToTrim()) && ArraysInfo != null) { BtnOk_Click(sender, e); if (IsContinue) PreData(); } else if (TypeSystem == SystemTypeEnum.YCLJK.ToTrim())//预处理上一条不保存 无需判定保存返回值 PreData(); } bool IsContinue = true; /// /// 保存 /// /// /// private void BtnOk_Click(object sender, RoutedEventArgs e) { try { if (TypeSystem == SystemTypeEnum.WYZS.ToTrim()) { if (_SHInfo != null) _SHInfo.SaveEdit(); return; } if (EngineEditorBG == null) EngineEditorBG = new EngineEditorClass(); if (ControlsEditingSave == null && EngineEditorBG != null && EngineEditorBG.EditState == esriEngineEditState.esriEngineStateEditing) { ControlsEditingSave = new ControlsEditingSaveCommandClass(); ControlsEditingSave.OnCreate(MapsManager.Instance.MapService.getAxMapControl().Object); } else if (ControlsEditingSave != null && EngineEditorBG != null && EngineEditorBG.EditState == esriEngineEditState.esriEngineStateEditing) { ControlsEditingSave.OnClick(); } IsContinue = true; if (TypeSystem == SystemTypeEnum.YCLJK.ToTrim()) { SaveData(); NextData(true); } } catch (Exception ex) { MessageHelper.ShowTips(ex.Message); IsContinue = false; } } public void SaveData() { //各个页面保存 try { if (_NYYPInfo != null) _NYYPInfo.SaveEdit(); if (_NYYSInfo != null) _NYYSInfo.SaveEdit(); if (_WYCTInfo != null) _WYCTInfo.SaveEdit(); if (_WYImgInfo != null) _WYImgInfo.SaveEdit(); if (_FeatureInfo != null) _FeatureInfo.SaveEdit(); //if (_SHInfo != null) // _SHInfo.SaveEdit(); } catch (Exception ex) { MessageHelper.ShowTips("保存异常:" + ex.Message); LogAPI.Debug("SaveData异常:" + ex.Message); LogAPI.Debug("SaveData异常:" + ex.StackTrace); } } /// /// 下一条 /// /// /// private void BtnNext_Click(object sender, RoutedEventArgs e) { if ((TypeSystem == SystemTypeEnum.RCBGJK.ToTrim() || TypeSystem == SystemTypeEnum.DTBJK.ToTrim() || TypeSystem == SystemTypeEnum.WYZS.ToTrim()) && ArraysInfo != null) { BtnOk_Click(sender, e); if (IsContinue) NextData(false); } else if (TypeSystem == SystemTypeEnum.YCLJK.ToTrim())//预处理下一条不保存 无需判定保存返回值 { NextData(false); } } /// /// 返外业 /// /// /// private void BtnFWY_Click(object sender, RoutedEventArgs e) { if (this.FWYAction != null && ArraysInfo != null) { FWYAction(); } } } }