コード例 #1
0
        void syncButton_Click(object sender, EventArgs e)
        {
            if (app.TemporaryDesynchronized.Count > 0)
            {
                TodoistService todoistService = new TodoistService();
                todoistService.SyncAll(
                (data) =>
                {
                    if (app.TemporaryDesynchronized.Count > 0)
                    {
                        //Update all based on temporary
                        //This is needed because the responde doesn't bring the synced item or project.
                        UpdateBasedOnTemporaryDessychronized(data);

                        app.TemporaryDesynchronized.Clear();

                        SyncStatusLabel.Text = String.Format("{0} item(s) to be sync.", app.TemporaryDesynchronized.Count);
                    }

                    app.projects = data.Projects;
                },
                (errorMsg) =>
                {
                    MessageBox.Show(errorMsg, "Metroist", MessageBoxButton.OK);
                },
                () =>
                {
                    ProjectsListBox.ItemsSource = null;
                    ProjectsListBox.ItemsSource = app.projects;
                });
            }
        }