using ESRI.ArcGIS.Carto;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using Kingo.Plugin.MapView.Views;
using Kingo.PluginServiceInterface;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using UIShell.OSGi;
namespace Kingo.Plugin.SystemSetting.View.ViewSystemSetting
{
///
/// 图层配置页面的交互逻辑
///
public partial class ViewLayerCfgSetting : UserControl
{
public ViewLayerCfgSetting()
{
InitializeComponent();
this.Loaded += InitData;
}
private void InitData(object sender, RoutedEventArgs e)
{
try
{
IDataCatalogService _DataCatalog = BundleRuntime.Instance.GetFirstOrDefaultService();
LayerCfg rootLayer = _DataCatalog.CurrentLayers as LayerCfg;
List AllLayers = rootLayer.GetAllItem().FindAll(a => a.LayerType == EnumLayerType.FeatureLayer);
dgCtrl.ItemsSource = null;
dgCtrl.ItemsSource = AllLayers;
}
catch (Exception ex)
{
LogAPI.Debug("初始化图层配置页面失败:" + ex);
return;
}
}
private void BtnChangeLayerStyle_Click(object sender, RoutedEventArgs e)
{
try
{
FrameworkElement frameEle = e.Source as FrameworkElement;
DevExpress.Xpf.Grid.EditGridCellData gridCellData = frameEle.DataContext as DevExpress.Xpf.Grid.EditGridCellData;
LayerCfg selectCurrentLayer = gridCellData.RowData.Row as LayerCfg;
ILayer layer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName(selectCurrentLayer.LayerName);
UCLayerStyleSet uCLayerStyleSet = new UCLayerStyleSet(layer);
//uCLayerStyleSet.Show();
uCLayerStyleSet.ShowInMainWindow(true);
}
catch (Exception ex)
{
MessageHelper.ShowError("打开图层样式窗体失败:" + ex.Message);
LogAPI.Debug("打开图层样式窗体失败:" + ex);
return;
}
}
}
}