async void OnGoalsTapped (object sender, EventArgs e) { View tap = sender as View; if (tap != null && tap.ClassId != null) { List<ActionMedia> media = new List<ActionMedia>(); ActionTitle eventTitle = new ActionTitle (); ActionDetail eventDetail = new ActionDetail (); eventDetail = goalsMasterList.action_details.FirstOrDefault (itm => itm.goalaction_id == tap.ClassId); eventTitle = goalsMasterList.action_title.FirstOrDefault ( itm => itm.goalaction_id == tap.ClassId ); media = goalsMasterList.action_media.FindAll (itm => itm.goalaction_id == tap.ClassId).ToList(); // title = emotionList.eve if (media != null) { IProgressBar progess = DependencyService.Get< IProgressBar>(); progess.ShowProgressbar( "Loading details..." ); DetailsPageModel model = new DetailsPageModel() { eventMediaArray = null, actionMediaArray = media, pageTitleVal = goalsMasterList.goal_title, titleVal = eventTitle.action_title, description = eventDetail.action_details, Media = goalsMediaPath, NoMedia = goalsNoMediaPath, gemId = eventDetail.goalaction_id, gemType = GemType.Action, fromGEMSPage = true }; //await Navigation.PushAsync (new GemsDetailsPage(null, media, goalsMasterList.goal_title, eventTitle.action_title, eventDetail.action_details, goalsMediaPath, goalsNoMediaPath, eventDetail.goalaction_id, GemType.Action)); await Navigation.PushAsync(new GemsDetailsPage(model)); progess.HideProgressbar(); eventDetail = null; eventTitle = null; media = null; } } else { await DisplayAlert( Constants.ALERT_TITLE, "Not a valid Action", Constants.ALERT_OK ); } }
public GemsGoalsObject GetCompletedGoalsObject() { try { GemsGoalsObject masterObject = new GemsGoalsObject(); List<CompletedActionTitle> listCompletedActionTitle = new List<CompletedActionTitle>(); List<CompletedGoalsDetailsDB> listCompletedDetailsDB = new List<CompletedGoalsDetailsDB>(); listCompletedActionTitle = (from t in Connection.Table<CompletedActionTitle>() select t).ToList(); listCompletedDetailsDB = (from t in Connection.Table<CompletedGoalsDetailsDB>() select t).ToList(); masterObject.resultarray = new List<GemsGoalsDetails>(); foreach (var item in listCompletedDetailsDB) { GemsGoalsDetails resultArray = new GemsGoalsDetails(); resultArray.action_title = new List<ActionTitle>(); resultArray.user_id = item.user_id; resultArray.goal_id = item.goal_id; resultArray.goal_title = item.goal_title; resultArray.goal_details = item.goal_details; resultArray.goal_media = item.goal_media; masterObject.code = item.code; masterObject.mediapath = item.mediapath; masterObject.mediathumbpath = item.mediathumbpath; masterObject.noimageurl = item.noimageurl; // Title foreach (var titeObject in listCompletedActionTitle) { ActionTitle title = new ActionTitle() { action_title = titeObject.action_title, goal_id = titeObject.goal_id, goalaction_id = titeObject.goalaction_id }; if (titeObject.goal_id == item.goal_id) resultArray.action_title.Add(title); } masterObject.resultarray.Add(resultArray); } masterObject.code = (listCompletedDetailsDB != null && listCompletedDetailsDB.Count > 0) ? listCompletedDetailsDB[0].code : ""; masterObject.noimageurl = (listCompletedDetailsDB != null && listCompletedDetailsDB.Count > 0) ? listCompletedDetailsDB[0].noimageurl : ""; masterObject.mediapath = (listCompletedDetailsDB != null && listCompletedDetailsDB.Count > 0) ? listCompletedDetailsDB[0].mediapath : ""; masterObject.mediathumbpath = (listCompletedDetailsDB != null && listCompletedDetailsDB.Count > 0) ? listCompletedDetailsDB[0].mediathumbpath : ""; return masterObject; } catch (Exception) { return null; } }