The GetBoundary() method below returns the string path to a feature class.
How is the string path to the feature class used instead of the code on lines 25 and 26?
protected override async void OnClick()
{
string extent = await Extent();
MessageBox.Show(extent);
static async Task<string> Extent()
{
string results = "";
static string GetBoundary()
{
OpenItemDialog item = new OpenItemDialog();
item.Title = "Select the Boundary";
item.MultiSelect = false;
item.ShowDialog();
return item.Items.First().Path;
}
await QueuedTask.Run(() =>
{
// Want to use this path name to create a feature class
string boundary = GetBoundary();
// This is fine... except how are the 2 lines below made to run from an OpenItemDialog
Geodatabase gdb = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri("C:\\Temp\\Learn.gdb")));
using (FeatureClass fc = gdb.OpenDataset<FeatureClass>("CSS_1_BoundaryBuffer"))
{
string xMax = fc.GetExtent().XMax.ToString();
string xMin = fc.GetExtent().XMin.ToString();
string yMax = fc.GetExtent().YMax.ToString();
string yMin = fc.GetExtent().YMin.ToString();
results = $"{xMin} {yMin} {xMax} {yMax}";
}
});
return results;
}
}