Exemple #1
0
        async Task ExecuteRefreshingCommand(bool pullFromCloud = false)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var service = new ZumoService();

                if (pullFromCloud)
                {
                    IsRefreshing = true;
                    await service.SyncOfflineCache();

                    IsRefreshing = false;
                }

                var results = await service.GetAllToDoItems();

                Items.Clear();
                foreach (var item in results)
                {
                    Items.Add(item);
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Exemple #2
0
        protected override void OnStart()
        {
            if (!AppCenter.Configured)
            {
                Push.PushNotificationReceived += async(sender, e) =>
                {
                    var zumoService = new ZumoService();
                    await zumoService.SyncOfflineCache();

                    // Add the notification message and title to the message
                    //var summary = $"Push notification received:" +
                    //                    $"\n\tNotification title: {e.Title}" +
                    //                    $"\n\tMessage: {e.Message}";

                    //// If there is custom data associated with the notification,
                    //// print the entries
                    //if (e.CustomData != null)
                    //{
                    //    summary += "\n\tCustom data:\n";
                    //    foreach (var key in e.CustomData.Keys)
                    //    {
                    //        summary += $"\t\t{key} : {e.CustomData[key]}\n";

                    //        Analytics.TrackEvent("Push", new Dictionary<string, string> { { "push-key", $"{key}" } });
                    //    }
                    //}

                    //// Send the notification summary to debug output
                    //System.Diagnostics.Debug.WriteLine(summary);
                };
            }


            AppCenter.Start("ios=dcfb280a-b080-474b-8c3b-38baa5739d0f;"
                            + "android=0418d688-810c-47f6-b532-7dbab8cdab5c",
                            typeof(Analytics),
                            typeof(Crashes),
                            typeof(Push));

            Push.SetEnabledAsync(true);

            OnResume();
        }