public UserControl Initialize(ActionBarView actionBar, string databaseName) { mDatabaseName = databaseName; UserControl ret = new AuftragsverwaltungView(); var orderEdit = new OrderEditControl(); mViewModel = new AuftragsverwaltungViewModel { Employees = new CollectionView(new Repository <Employee>(mDatabaseName).GetAll()), Customers = new CollectionView(new Repository <Customer>(mDatabaseName).GetAll()), Articles = new CollectionView(new Repository <Article>(mDatabaseName).GetAll()) }; mViewModel.EditControl = orderEdit.Initialize(new ActionBarView(), mDatabaseName, mViewModel) as UserControl; actionBar.DataContext = new ActionBarViewModel { Command1Text = "Neuer Auftrag", Command1 = new RelayCommand(AddOrderExecute), Command2Text = "Neue Auftragsposition", Command2 = new RelayCommand(AddPositionExecute), Command3Text = "Änderungen Speichern", Command3 = new RelayCommand(SaveCommandExecute), Command5Text = "Position löschen", Command5 = new RelayCommand(DeletePositionExecute), Command4Text = "Auftrag löschen", Command4 = new RelayCommand(DeleteOrderExecute) }; AktualisiereAnzeige(); ret.DataContext = mViewModel; return(ret); }
public UserControl Initialize(ActionBarView actionBar, string databaseName) { mDatabaseName = databaseName; UserControl ret = new AuftragsverwaltungView(); var orderEdit = new OrderEditControl(); mViewModel = new AuftragsverwaltungViewModel { Employees = new CollectionView(new Repository<Employee>(mDatabaseName).GetAll()), Customers = new CollectionView(new Repository<Customer>(mDatabaseName).GetAll()), Articles = new CollectionView(new Repository<Article>(mDatabaseName).GetAll()) }; mViewModel.EditControl = orderEdit.Initialize(new ActionBarView(), mDatabaseName, mViewModel) as UserControl; actionBar.DataContext = new ActionBarViewModel { Command1Text = "Neuer Auftrag", Command1 = new RelayCommand(AddOrderExecute), Command2Text = "Neue Auftragsposition", Command2 = new RelayCommand(AddPositionExecute), Command3Text = "Änderungen Speichern", Command3 = new RelayCommand(SaveCommandExecute), Command5Text = "Position löschen", Command5 = new RelayCommand(DeletePositionExecute), Command4Text = "Auftrag löschen", Command4 = new RelayCommand(DeleteOrderExecute) }; AktualisiereAnzeige(); ret.DataContext = mViewModel; return ret; }