public ObjectsOnPhotoViewModel(PhotoRepository photoRepository, IMessenger messenger) { InputPosX = "Souradnice X"; InputPosY = "Souradnice Y"; thingRepository = new ThingRepository(); personRepository = new PersonRepository(); UpdateAllObjects(); this.photoRepository = photoRepository; this.messenger = messenger; DeletePersonOnPhotoCommand = new RelayCommand(DeletePersonOnPhoto); PersonSelectionChanged = new RelayCommand(selectPerson); DeleteThingOnPhotoCommand = new RelayCommand(DeleteThingOnPhoto); ThingSelectionChanged = new RelayCommand(selectThing); AddNewObject = new AddNewObjectOnPhotoCommand(this, photoRepository, Detail, messenger); this.messenger.Register <SelectedMessage>(SelectedPhoto); this.messenger.Register <NewMessage>(NewPhotoMessageReceived); this.messenger.Register <UpdateDetailListsMessage>(UpdateLists); this.messenger.Register <ThingsOrPeronsUpdatedMessage>(ListsUpdated); }
public ThingsListViewModel(ThingRepository thingRepository, IMessenger messenger) { Name = "Zadaj nazov"; this.thingRepository = thingRepository; this.messenger = messenger; SelectThingsCommand = new RelayCommand(SelectThingsInList); AddThingsCommand = new RelayCommand(AddThingsInList); DeleteThingsCommand = new RelayCommand(DeleteThingsInList); this.messenger.Register <DeleteThingsInListMessage>(Reload); this.messenger.Register <SelectedThingsMessage>(SelectedThings); }
private async void PerformDatabaseOperations() { DatabaseContext databaseContext = new DatabaseContext(); IPersonRepository personRepository = new PersonRepository(databaseContext); IThingRepository thingRepository = new ThingRepository(databaseContext); personRepository.Add(new Person()); thingRepository.Add(new Thing()); personRepository.Save(); List<Person> persons = await personRepository.GetAllASync().Result.ToListAsync(); Console.WriteLine(persons.Count); personRepository.MyNewFunction(6); await personRepository.SaveASync(); List<Person> allASync = await personRepository.GetAllASync().Result.ToListAsync(); thingRepository.Dispose(); personRepository.Dispose(); }
private async void PerformDatabaseOperations() { DatabaseContext databaseContext = new DatabaseContext(); IPersonRepository personRepository = new PersonRepository(databaseContext); IThingRepository thingRepository = new ThingRepository(databaseContext); personRepository.Add(new Person()); thingRepository.Add(new Thing()); personRepository.Save(); IQueryable <Person> persons = await personRepository.GetAllASync(); Console.WriteLine(persons.Count); personRepository.MyNewFunction(6); await personRepository.SaveASync(); IQueryable <Person> allASync = await personRepository.GetAllASync(); thingRepository.Dispose(); personRepository.Dispose(); }