Hi Brad, so here are some possibilities:
Option 1: Make the table and return the table from the QueuedTask and show it
internal class OpenTableButton : Button
{
protected async override void OnClick()
{
var theMap = MapView.Active.Map;
var table = await QueuedTask.Run(() =>
{
return StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"Path_To_File_GDB.gdb\EarthquakeDamage_Table",
UriKind.Absolute),
theMap);
});
FrameworkApplication.Panes.OpenTablePane(table);
}
}
Option 2: Make the table and show it from the QueuedTask (the syntax to do that is a bit gnarly I must confess)...still...it is here if you need it
internal class OpenTableButton : Button
{
protected async override void OnClick()
{
var theMap = MapView.Active.Map;
await QueuedTask.Run(() =>
{
var table2 = StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"Path_to_File_GDB.gdb\Meteorites_UK_Table",
UriKind.Absolute),
theMap);
FrameworkApplication.Current.Dispatcher.BeginInvoke((Action)(() =>
{
FrameworkApplication.Panes.OpenTablePane(table2);
}));
});
}
}
Option 3: Make the table on the QueuedTask. Return from the QueuedTask. Retrieve the table from the Map (on the UI) and show it. This would be akin to how you would retrieve a table from the TOC that had previously been added.
internal class OpenTableButton : Button
{
protected async override void OnClick()
{
var theMap = MapView.Active.Map;
await QueuedTask.Run(() =>
{
StandaloneTableFactory.Instance.CreateStandaloneTable(
new Uri(@"Path_To_File_GDB.gdb\EarthquakeDamage_Table",
UriKind.Absolute),
theMap);
});
var table3 = theMap.FindStandaloneTables("EarthquakeDamage_Table").First();
FrameworkApplication.Panes.OpenTablePane(table3);
}
}