private async void Delete(object sender, EventArgs e)
        {
            Button button = (Button)sender;
            int    notification_to_delete = (int)button.CommandParameter;

            HttpResponseMessage response = await NotificationRequest.DeleteNotification(notification_to_delete);

            if (response.IsSuccessStatusCode)
            {
                try
                {
                    OutputNotification obs_to_remove = Notifications.Find(OutputNotification => OutputNotification.Notification.Id == notification_to_delete);
                    Notifications.Remove(obs_to_remove);
                    MyCollectionView.ItemsSource = null;
                    MyCollectionView.ItemsSource = Notifications;
                    await DisplayAlert("Success!", "Notification removed", "OK");
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Error!", "Something went wrong", "OK");
                }
            }
            else
            {
                if (response.StatusCode == System.Net.HttpStatusCode.BadGateway)
                {
                    await DisplayAlert("Attention!!!", "No connection with the server", "OK");
                }
                if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
                {
                    await DisplayAlert("Try Again!", "Invalid request", "OK");
                }
            }
        }
        private async void FillPage()
        {
            List <OutputNotification> output_list = new List <OutputNotification>();
            HttpResponseMessage       response    = await NotificationRequest.GetAllNotifications();

            if (response.IsSuccessStatusCode)
            {
                string response_content = await response.Content.ReadAsStringAsync();

                List <AppUserNotification> notifications_list = JsonConvert.DeserializeObject <List <AppUserNotification> >(response_content);

                foreach (AppUserNotification notification in notifications_list)
                {
                    HttpResponseMessage responseOb = await ObservationRequest.GetObservationById(notification.Observation);

                    if (responseOb.IsSuccessStatusCode)
                    {
                        string response_contentOb = await responseOb.Content.ReadAsStringAsync();

                        RequestObservation observation = JsonConvert.DeserializeObject <RequestObservation>(response_contentOb);

                        if (observation != null)
                        {
                            OutputNotification output_value = new OutputNotification(observation, notification);
                            output_list.Add(output_value);
                        }
                    }
                    else
                    {
                        if (response.StatusCode == System.Net.HttpStatusCode.BadGateway)
                        {
                            await DisplayAlert("Attention!!!", "No connection with the server", "OK");
                        }
                        if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
                        {
                            await DisplayAlert("Try Again!", "Invalid request", "OK");
                        }
                    }
                }

                Notifications = output_list;
                MyCollectionView.ItemsSource = Notifications;
            }
            else
            {
                if (response.StatusCode == System.Net.HttpStatusCode.BadGateway)
                {
                    await DisplayAlert("Attention!!!", "No connection with the server", "OK");
                }
                if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
                {
                    await DisplayAlert("Try Again!", "Invalid request", "OK");
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Detach this player from its in-game instance.
 /// </summary>
 public void detach()
 {
     this.NewOutput = null;
     this.NewErrorOutput = null;
     this.NewSound = null;
 }
Ejemplo n.º 4
0
 /*
  * Passive called by Datamerger or Streamingmanager.
  * Consider the identical output Forma from datamerger, is here an 1 to N broadcast by rasing event.
  * All outputadapter receive same source to out put preparing.
  */
 public void ReadyToOutput(MocapFrame mocapFrame)
 {
     OutputNotification?.Invoke(mocapFrame);
 }