public async void setView(int i) { profiles = new ListsAndButtons(App.userProfile.Friends, null, false, false); groups = new ListsAndButtons(null, App.userProfile.Groups, false, false); //organizations = new ListsAndButtons(null, null, App.userProfile.Organizations, false, false); List<string> fbf = await DependencyService.Get<SocialController>().getFacebookFriends(); List<Profile> fbp = new List<Profile>(); foreach (string s in fbf) { fbp.Add(new Profile() { ProfileId = s }); } facebookFriends = new ListsAndButtons(fbp, null, false, false); cv = new CarouselList( new List<VisualElement>() { profiles, groups, facebookFriends }, new List<string>() { "Profiles", "Groups", "Facebook" }, CarouselList.ViewType.Create ); carouselView.Content = cv; cv.setCarousel(i); }
private async Task getGroupClicked(ListsAndButtons lab, Event eve) { eve.GroupOwner = await lab.createList(null, App.userProfile.GroupsOwned, null, null, false, false, true); EventArgs e = new EventArgs(); testEvent(null, e); }
/* public async Task scrollTo(VisualElement a) { await Task.Delay(40); var y = a.Y; var parent = a.ParentView; while (parent != null) { y += parent.Y; parent = parent.ParentView; } if (App.coreView.scrollViews[App.coreView.scrollViews.Count - 1] != null) { App.coreView.scrollViews[App.coreView.scrollViews.Count - 1].ScrollToAsync(0, (y - 120), true); } //s.ScrollToAsync(s.X, (y - 100), true); } */ public async Task<bool> SenderOfEvent(StackLayout SelectEventSenderLayout, Event eve) { bool continueCreating = true; if (App.userProfile.GroupsOwned != null && App.userProfile.GroupsOwned.Count > 0) { TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>(); SelectEventSenderLayout.Children.Clear(); SelectEventSenderLayout.IsVisible = true; SelectEventSenderLayout.Children.Add(new Label() { Text = "Who is the owner of this event?", FontSize = 16, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.CenterAndExpand, }); Grid uGrid = new Grid() { HeightRequest = 120, WidthRequest = 120, Padding = new Thickness(0,0,0,10) }; uGrid.Children.Add(new ProfileDesignView(App.userProfile,120,false, GenericDesignView.Design.OnlyImage),0,0); Button youBtn = new Button() { HeightRequest = 150, WidthRequest = 150, }; uGrid.Children.Add(youBtn, 0, 0); SelectEventSenderLayout.Children.Add(uGrid); youBtn.Clicked += async (sender, e) => { bool success = await App.coreView.displayConfirmMessage("Continue ?", "You have selected yourself to be the owner of this event. Continue creating the event ?", "Confirm", "Cancel"); if(success)tcs.TrySetResult(true); }; StackLayout labLayout = new StackLayout(); ListsAndButtons lab = new ListsAndButtons(); labLayout.Children.Add(lab); SelectEventSenderLayout.Children.Add(labLayout); Button cancleBtn = new Button() { Text = "Cancel", HeightRequest = 30, WidthRequest = 100, FontSize = 14, TextColor = Color.White, BorderRadius = 10, BackgroundColor = App.HowlOutRed, VerticalOptions = LayoutOptions.EndAndExpand }; SelectEventSenderLayout.Children.Add(cancleBtn); getGroupClicked(lab, eve); cancleBtn.Clicked += (sender, e) => { continueCreating = false; tcs.TrySetResult(true); }; testEvent += async (sender, e) => { bool success = await App.coreView.displayConfirmMessage("Continue ?", "Continue creating the event with the selected group as owner ?", "Confirm", "Cancel"); if (success) tcs.TrySetResult(true); else { labLayout.Children.Clear(); labLayout.Children.Add(lab = new ListsAndButtons()); getGroupClicked(lab, eve); } }; await tcs.Task; lab = null; SelectEventSenderLayout.IsVisible = false; } return continueCreating; }