public TableViewerPanel()
        {
            InitializeComponent();

            //  We have declared the view model instance declaratively in the xaml.
            //  Get the reference to it here, so we can use it in the button click event.
            TableViewerPanelViewModel _tableviewerpanelViewModel = (TableViewerPanelViewModel)base.DataContext;
        }
 public async Task RefreshSchemasCb()
 {
     await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
     {
         bool dpexists = FrameworkApplication.DockPaneManager.IsDockPaneCreated("QProSapAddIn_TableViewerPanel");
         if (dpexists)
         {
             TableViewerPanelViewModel vm = FrameworkApplication.DockPaneManager.Find("QProSapAddIn_TableViewerPanel") as TableViewerPanelViewModel;
             Task r = vm.RefreshSchemasCallback();
         }
     });
 }
 public async Task ExecuteSqlCb()
 {
     try {
         await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
         {
             bool dpexists = FrameworkApplication.DockPaneManager.IsDockPaneCreated("QProSapAddIn_TableViewerPanel");
             if (dpexists)
             {
                 var cpd = new CancelableProgressorSource();
                 TableViewerPanelViewModel vm = FrameworkApplication.DockPaneManager.Find("QProSapAddIn_TableViewerPanel") as TableViewerPanelViewModel;
                 Task r = vm.ExecuteSqlCallback(cpd);
             }
         });
     }
     catch (Exception ex)
     { MessageBox.Show("Error  :  " + ex.Message.ToString() + " "); }
 }
        public async Task AddToTOCCb()
        {
            try {
                await QueuedTask.Run(() =>
                {
                    bool dpexists = FrameworkApplication.DockPaneManager.IsDockPaneCreated("QProSapAddIn_TableViewerPanel");
                    if (dpexists)
                    {
                        TableViewerPanelViewModel vm = FrameworkApplication.DockPaneManager.Find("QProSapAddIn_TableViewerPanel") as TableViewerPanelViewModel;

                        //var pd = new ProgressDialog("Adding data to map.", "Canceled", false);
                        //pd.Show();
                        var cpd = new CancelableProgressorSource();
                        Task r  = vm.AddToTOCCallback(cpd);
                    }
                });
            }
            catch (Exception ex)
            { MessageBox.Show("Error  :  " + ex.Message.ToString() + " "); }
        }