using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using KGIS.Framework.AE.ExtensionMethod;
using KGIS.Framework.Maps;
using KGIS.Framework.Platform;
using KGIS.Framework.Views;
using Kingo.Plugin.MapView.Interface;
using System;
using System.Collections.Generic;
using System.Windows.Controls;
namespace Kingo.Plugin.MapView.Views
{
///
/// UserControl1.xaml 的交互逻辑
///
public partial class FrmDataCheck : UserControl, IDockPanel3
{
private IHookHelper m_hookHelper;
IMapService _mapService = null;
IFeatureLayer featureLayer = null;
public FrmDataCheck()
{
InitializeComponent();
this.DockAreas = DockStyle.DockRight | DockStyle.Float;
this.FloatSize = new System.Drawing.Size(400, 500);
this.DefaultArea = DockStyle.Float;
this.DockHeight = 125;
this.ShowCloseButton = true;
this.ShowAutoHideButton = true;
this.IsDockToPanel = true;
this.DockToPanelStyle = DockStyle.DockBottom;
this.Title = "错误信息";
}
#region IDockPanel接口
public Guid ID
{
get;
set;
}
public DockStyle _DockAreas;
public event EventHandler CloseViewHandler;
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 bool IsShowInMap { get; set; }
public bool IsDockToPanel { get; set; }
public DockStyle DockToPanelStyle { get; set; }
public void ShowPanel()
{
Platform.Instance.OpenView(this, false);
if (MapsManager.Instance.MapService != null)
{
MapsManager.Instance.MapService.ProjectClosed += Platform_CloseProjectEvent;
}
}
void Platform_CloseProjectEvent(object sender, object e)
{
MapsManager.Instance.MapService.ProjectClosed -= Platform_CloseProjectEvent;
this.ClosePanel();
}
public void ClosePanel()
{
this.ClosePanel();
}
public void ClosePanelInvoke()
{
CloseViewHandler?.Invoke(this, null);
}
#endregion
public void BindDada(List ListCheckResultModel, IHookHelper hook)
{
m_hookHelper = hook;
_mapService = MapsManager.Instance.MapService;
object pLayer = m_hookHelper.GetCustomProperty();//获取对象的创建者的Application对象
IFeatureLayer pTocFeatureLayer = pLayer as IFeatureLayer;
featureLayer = pTocFeatureLayer;
MyPropertyGrid.ItemsSource = ListCheckResultModel;
}
private void DataGridRow_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
m_hookHelper.FocusMap.ClearSelection();//清除图层上要素选择
try
{
if (_mapService != null)
{
_mapService.SelectFeature(featureLayer.Name, ((sender as DataGridRow).DataContext as CheckResultModel).OBJECTID);
}
}
catch (Exception)
{
return;//点击列表外,查到不到行
}
}
}
}