public override async Task PreviewAsync(CremaDataSet dataSet) { var preview = await TableDescriptorUtility.GetDataAsync(authentication, this.descriptor, null); foreach (TableTreeViewItemViewModel item in this.Items) { if (item.IsChecked == true) { continue; } var table = preview.Tables[item.TableName]; preview.Tables.Remove(table); } foreach (var item in preview.Tables.Where(i => i.Parent == null)) { item.CopyTo(dataSet); } }
private async void Initialize() { try { this.BeginProgress(Resources.Message_LoadingData); var dataSet = await TableDescriptorUtility.GetDataAsync(this.authentication, this.descriptor, null); foreach (var item in this.Tables) { item.Source = dataSet.Tables[item.Name]; } } catch (Exception e) { await AppMessageBox.ShowErrorAsync(e); this.EndProgress(); this.DetachEvent(); this.Tables.Clear(); await this.TryCloseAsync(); return; } //if (this.selectedItem == null this.selectedTableName != null) // this.SelectedItem = this.tableItems.Where(item => item.DisplayName == this.selectedTableName).First(); //else // this.SelectedItem = this.tableItems.First(); //this.selectedTableName = null; this.EndProgress(); this.NotifyOfPropertyChange(nameof(this.Tables)); this.NotifyOfPropertyChange(nameof(this.SelectedTable)); this.NotifyOfPropertyChange(nameof(this.IsProgressing)); }