コード例 #1
0
            public void SyncBudgets(Action<Exception> callback)
            {
                try
                {
                    BudgetList.Clear();

                    App.Instance.ServiceData.LoadCachedBudgets((cachedBudgets, error) =>
                        {
                            var budgetList = cachedBudgets.Where(x => x.ModifiedDate > App.Instance.LastSyncDate).ToObservableCollection();

                            var client = new MainClient();

                            client.SyncBudgetsAsync(budgetList);

                            client.SyncBudgetsCompleted += async (sender, e) =>
                            {
                                if (e.Error == null)
                                    await SetupBudgetList(e.Result, true);

                                callback(e.Error);
                            };
                        });
                }
                catch (Exception ex)
                {
                    callback(ex);
                }
            }