private async void SwitchButton_OnTapped(object sender, EventArgs e) { try { Xamarin.Forms.Image img = (Xamarin.Forms.Image)sender; Xamarin.Forms.FileImageSource objFileImageSource = (Xamarin.Forms.FileImageSource)img.Source; MovementListTbl obj = (MovementListTbl)objFileImageSource.BindingContext; string strFileName = objFileImageSource.File; if (strFileName == "off_btn.png") { obj.MoveIcon = "on_btn.png"; img.Source = "on_btn.png"; obj.Selected = true; } else { obj.MoveIcon = "off_btn.png"; img.Source = "off_btn.png"; obj.Selected = false; } await App.mvDatabase.SaveItemAsync1(obj); } catch (Exception ex) { StaticMethods.ShowToast(ex.Message); } }
protected override async void OnAppearing() { base.OnAppearing(); try { MovementListTbl tbl = await App.mvDatabase.GetItemAsync(MovementPage.SelectedExerciseid); if (tbl == null) { tbl = new MovementListTbl(); } obj = new MovementListMdl(tbl); ExeTitle.Text = obj.MoveTitle; ExeImage.Source = obj.ImageName; ExeDescription.Text = obj.Description; ExeDuration.Text = obj.Duration; SwitchActive.Source = obj.MoveIcon; if (obj.Selected == true) { ExeActive.Text = "Select"; } else { ExeActive.Text = "Unselect"; } } catch (Exception ex) { StaticMethods.ShowToast(ex.Message); } }
private async void ExerciseTitle_OnTapped(object sender, EventArgs e) { Xamarin.Forms.Label lbl = (Xamarin.Forms.Label)sender; MovementListTbl obj = (MovementListTbl)lbl.BindingContext; SelectedExerciseID = obj.Id; await Navigation.PushPopupAsync(new ExePopupPage()); }
public Task <int> SaveItemAsync1(MovementListTbl item) { if (item.Id != 0) { return(database.UpdateAsync(item)); } else { return(database.InsertAsync(item)); } }
protected override async void OnAppearing() { base.OnAppearing(); try { MovementListTbl tbl = await App.mvDatabase.GetItemAsync(MovementListMdl.currentSelectedExerciseID); if (tbl == null) { tbl = new MovementListTbl(); } obj = new MovementListMdl(tbl); ExeTitle.Text = obj.MoveTitle; ExeImage.Source = obj.ImageName; ExeDescription.Text = obj.Description; ExeDuration.Text = obj.Duration; } catch (Exception ex) { } }
public Task <int> DeleteItemAsync(MovementListTbl item) { return(database.DeleteAsync(item)); }
public Task <int> UpdateIcon(MovementListTbl item) { return(database.UpdateAsync(item)); }