using System;
using System.Collections.Generic;
using System.Linq;
//using System.Windows;
//using System.Windows.Forms;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ArcGIS.Desktop.Core.Geoprocessing;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs;
using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Framework.Threading.Tasks;
namespace ProAppModule1
{
internal class Button1 : ArcGIS.Desktop.Framework.Contracts.Button
{
string output = "gisoracle";
protected override void OnClick()
{
FeatureLayer layer = MapView.Active.Map.Layers[0] as FeatureLayer;
string path = Project.Current.DefaultGeodatabasePath+"/";
Select(layer, path + output);
}
public bool Select(FeatureLayer layer, string output)
{
try
{
var result = QueuedTask.Run(() =>
{
var args = Geoprocessing.MakeValueArray(layer, output);
return Geoprocessing.ExecuteToolAsync("analysis.Select", args);
});
return true;
}
catch (Exception ex)
{
MessageBox.Show("错误:" + ex.Message.ToString());
return false;
}
}
}
}