private async void refresh()
        {
            if (CrossConnectivity.Current.IsConnected)
            {
                try
                {
                    isrefreshing = true;
                    var      activationService = new Activation();
                    Response response          = await activationService.GetActivations();

                    activations = (JsonConvert.DeserializeObject <List <Models.Activation> >(response.Content)).OrderByDescending(x => x.Id).ToList();
                    Activations.Clear();
                    foreach (var activation in activations)
                    {
                        Activations.Add(activation);
                    }
                    ALabel = $"My Activations ({activations.Count})";
                    OnPropertyChanged(nameof(ALabel));
                    isrefreshing = false;
                }
                catch (Exception e)
                {
                    UserDialogs.Instance.Toast("Could not connect to server", TimeSpan.FromSeconds(2));
                    isrefreshing = false;
                }
            }
            else
            {
                UserDialogs.Instance.Toast("Could not connect to server", TimeSpan.FromSeconds(2));
                isrefreshing = false;
            }
        }
Example #2
0
 public void AddActivation(PracticeActivation activation)
 {
     activation.PracticeId = Id;
     Activations.Add(activation);
 }