// edit the current data source properties void _btnEditSource_Click(object sender, RoutedEventArgs e) { var ds = Model.DataSources.CurrentItem as DataSource; if (ds != null) { var dlg = new ModalDialog("Data Source Settings", new DataSourceEditor(), ds); dlg.ShowDialog(MessageBoxButton.OKCancel); } }
// add a data source to the model void _btnAddSource_Click(object sender, RoutedEventArgs e) { var ds = new DataSource(Model); var dlg = new ModalDialog("Add Data Source", new DataSourceEditor(), ds); dlg.ShowDialog(MessageBoxButton.OKCancel); dlg.Closed += (ss, ee) => { if (!ee.Cancel) { Model.AddDataSource(ds); } }; }
// edit the current table properties void _btnEditTable_Click(object sender, RoutedEventArgs e) { var ds = Model.DataSources.CurrentItem as DataSource; if (ds != null && ds.Tables.CurrentItem != null) { var dlg = new ModalDialog("DataTable Settings", new DataTableEditor(), ds.Tables.CurrentItem); dlg.ShowDialog(MessageBoxButton.OKCancel); } }