void GetPublicGroups(string search = null) { isPublicGroupsSelected = true; grupos = CappriolaConnect.GetPublicGroups(search); listViewGroups.ItemsSource = grupos; }
//MÉTODOS DE BUSCA DE GRUPOS void GetMyGroups() { isPublicGroupsSelected = false; grupos = CappriolaConnect.GetMyGroups(); listViewGroups.ItemsSource = grupos; }
public JoinGroup(int id) { InitializeComponent(); grupo = CappriolaConnect.GetGroupDetails(id); BindingContext = grupo; }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); if (done) { return; } var auth = new OAuth2Authenticator( clientId: Settings.FacebookID, // your OAuth2 client id scope: "public_profile+email", // the scopes for the particular API you're accessing, delimited by "+" symbols authorizeUrl: new Uri(Settings.FacebookAuthorizeUrl), redirectUrl: new Uri("http://www.facebook.com/connect/login_success.html")); auth.Completed += async(sender, eventArgs) => { DismissViewController(true, null); //App.HideLoginView(); if (eventArgs.IsAuthenticated) { var accessToken = eventArgs.Account.Properties["access_token"].ToString(); Settings.Facebook_Token = accessToken; var expiresIn = Convert.ToDouble(eventArgs.Account.Properties["expires_in"]); var expiryDate = DateTime.Now + TimeSpan.FromSeconds(expiresIn); var request = new OAuth2Request("GET", new Uri("https://graph.facebook.com/me"), null, eventArgs.Account); var response = await request.GetResponseAsync(); var obj = JObject.Parse(response.GetResponseText()); var id = obj["id"].ToString().Replace("\"", ""); var name = obj["name"].ToString().Replace("\"", ""); if (CappriolaConnect.RetrieveAccessTokenFromFacebookLogin()) { App.HideLoginView(); await App.NavigateToProfile(string.Format("Olá {0}", name)); } else { App.HideLoginView(); } } else { await App.NavigateToProfile("Usuário Cancelou o login"); } }; done = true; PresentViewController(auth.GetUI(), true, null); }
async void InformPayment(object sender, ItemTappedEventArgs e) { User user = (User)e.Item; if (user.paid == 0) { var askPayment = await DisplayAlert("Pagamento", "Confirmar pagamento?", "Sim", "Cancela"); if (askPayment) { HttpStatusCode statusCode = CappriolaConnect.ChanteEventPaymentStatusService(evento.id, user.id); if (statusCode == HttpStatusCode.OK) { await DisplayAlert("Sucesso!", "Pagamento informado com sucesso.", "OK"); GetEventParticipants(evento.id); } else if (statusCode == HttpStatusCode.Forbidden) { await DisplayAlert("Erro!", "Apenas o criador do Grupo pode alterar as informações sobre o pagamento do evento.", "OK"); } else { await DisplayAlert("Erro!", "Não foi possível informar o pagamento. Por favor, tente novamente.", "OK"); } } } else { var askPayment = await DisplayAlert("Este usuário já efetuou o pagamento", "Gostaria de corrigir esta informação e marcar como não pago?", "Sim", "Cancela"); if (askPayment) { HttpStatusCode statusCode = CappriolaConnect.ChanteEventPaymentStatusService(evento.id, user.id); if (statusCode == HttpStatusCode.OK) { await DisplayAlert("Sucesso!", "A informação sobre pagamento do membro do Grupo foi alterada com sucesso.", "OK"); GetEventParticipants(evento.id); } else if (statusCode == HttpStatusCode.Forbidden) { await DisplayAlert("Erro!", "Apenas o criador do Grupo pode alterar as informações sobre o pagamento do evento.", "OK"); } else { await DisplayAlert("Erro!", "Não foi possível alterar a informar sobre pagamento. Por favor, tente novamente.", "OK"); } } } }
protected override void OnAppearing() { base.OnAppearing(); if (Settings.Access_Token != "" && Settings.Access_Token != null) { if (Settings.FacebookID != null && Settings.FacebookID != "") { if (CappriolaConnect.RetrieveAccessTokenFromFacebookLogin()) { GoToApp(); } } } }
async void HandleJoiningGroup(object sender, System.EventArgs e) { HttpStatusCode statusCode = CappriolaConnect.JoinGroupService(grupo.id); if (statusCode == HttpStatusCode.OK) { await DisplayAlert("Sucesso!", "Sua solicitação apra entrar no Grupo foi enviada com sucesso. Aguarde até que o criador do Grupo aprove sua entrada. Após aprovação você poderá fazer Check-In nos Eventos criados.", "OK"); await Navigation.PopAsync(); } else { await DisplayAlert("Oops.", "Algo errado aconteceu. Por favor, tente novamente.", "OK"); } }
public async void CreateGroup(object sender, System.EventArgs e) { HttpStatusCode statusCode = CappriolaConnect.CreateGroupService(groupName.Text); if (statusCode == HttpStatusCode.OK) { await ShowMessage("Grupo criado com sucesso", "Bate Bola", "Ok", async() => { await Navigation.PopAsync(); }); } else { await DisplayAlert("Bate Bola", "Erro ao criar Grupo. Por favor, tente novamente", "OK"); } }
async void CreateEvent(object sender, System.EventArgs e) { string eventDate = event_year.Text + "-" + event_month.Text + "-" + event_day.Text + " " + event_hour.Text + ":" + event_minute.Text + ":00"; HttpStatusCode statusCode = CappriolaConnect.CreateEventService(grupo.id, event_place.Text, eventDate); if (statusCode == HttpStatusCode.OK) { await DisplayAlert("Sucesso!", "Evento criado com sucesso.", "OK"); await Navigation.PopAsync(); } else { await DisplayAlert("Oops!", "Não foi possíve criar seu evento. Por favor, tente novamente.", "OK"); } }
public GroupDetails(Grupo selectedGroup) { InitializeComponent(); is_member = selectedGroup.approved == 0 ? false : true; grupo = CappriolaConnect.GetGroupDetails(selectedGroup.id); if (is_member) { ToolbarItems.Add(new ToolbarItem("Novo Grupo", "icon_users.png", async() => { await Navigation.PushAsync(new MembersList(grupo)); })); } else { newEventButton.IsEnabled = false; } }
async void CheckIn(object sender, System.EventArgs e) { //highlightBar.Margin = new Thickness(10,0,0,0); //SelectButton(sender as Button, myGroupsButton); HttpStatusCode statusCode = CappriolaConnect.EventCheckInService(evento.id); if (statusCode == HttpStatusCode.Conflict) { await DisplayAlert("Não foi possível fazer seu check-in", "Você já está cadastrado neste evento.", "OK"); } else if (statusCode == HttpStatusCode.OK) { await DisplayAlert("Sucesso!", "Você fez check-in no evento com sucesso.", "OK"); GetEventParticipants(evento.id); } else { await DisplayAlert("Oops!", "Não foi possível fazer seu check-in no evento, algo estranho aconteceu. Tenta de novo, vai que dá!", "OK"); } }
void GetEventParticipants(int eventId) { evento = CappriolaConnect.getEventParticipants(eventId); BindingContext = evento; }
void GetAllMyEvents() { List <Events> events = CappriolaConnect.getAllMyEvents(); BindingContext = events; }