Ejemplo n.º 1
0
 public void AddDataSource(DataSource ds)
 {
     if (ds.Model != this)
     {
         throw new Exception("This data source does not belong to this model.");
     }
     _sources.Add(ds);
 }
Ejemplo n.º 2
0
 // 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);
         }
     };
 }
Ejemplo n.º 3
0
 void DataSources_CurrentChanged(object sender, EventArgs e)
 {
     if (_ds != null)
     {
         _ds.Tables.CurrentChanged -= Tables_CurrentChanged;
     }
     _ds = _vm.DataSources.CurrentItem as DataSource;
     if (_ds != null)
     {
         _ds.Tables.CurrentChanged += Tables_CurrentChanged;
     }
     OnCanExecuteChanged();
 }