public ClientInfoPageViewModel(INavigation navigation, int clientId) { this.navigation = navigation; PictureListConverted = new ObservableCollection <ImageSource>(); database = DependencyService.Get <IDatabaseConnection>(). DbConnection(); Client = database.Table <ClientName>().FirstOrDefault(client => client.Id == clientId); CreateDatabase(); ClientPics = database.Table <ClientPictures>().FirstOrDefault(client => client.Id == clientId); ShowCommand = new Command(ShowClient); HideCommand = new Command(HideClient); SaveCommand = new Command(OnSave); PicCommand = new Command(AddPicture); TakePicCommand = new Command(TakePicture); RemovePicCommand = new Command <ImageSource>(RemovePicture); ViewPicCommand = new Command <ImageSource>(ViewPicture); GetClientStatusList(); //IMG = GetImage(clientPics.Pictures); }
public void RemovePicture(ImageSource pic) { int removeInt = PictureListConverted.IndexOf(pic); database.Delete(PictureList[removeInt]); database.Update(PictureList[removeInt]); ClientPictures picRemoved = PictureList[removeInt]; PictureList.RemoveAt(removeInt); PictureListConverted.Remove(pic); RefreshList(); }
public async void TakePicture() { clientPics = new ClientPictures { ClientId = Client.Id, Pictures = await TakePic() }; if (clientPics.Pictures != null) { PictureList.Add(clientPics); database.Insert(clientPics); IMG = GetImage(clientPics.Pictures); } database.Update(ClientPics); ConverterAsync(); }