Example #1
0
        // Description: Callback when sync save part is completed.
        private void syncCallbackSave(string status)
        {
            // Setup
            ISyncService syncservice = new SyncService();
            ExercisesToSync--;

            if (ExercisesToSync == 0)
            {
                // Get exercises synced
                if (User != null)
                {
                    // :Call service
                    syncservice.GetExercisesLight(User, syncCallbackGet);
                }
                else
                {
                    // Can later be changed to data binding
                    MessageBox.Show("Not logged in");
                }
            }
        }
Example #2
0
 private void _ShowSyncedExercise(int ID)
 {
     // Setup
     ISyncService service = new SyncService();
     service.GetFullExercise(_application.User, ID, _FullExerciseRetrieved);
 }
Example #3
0
        /// <summary>
        /// Click event from the global application bar on the Sync button.
        /// </summary>
        /// <param name="sender">Sender Object.</param>
        /// <param name="e">Event Arguments.</param>
        private void SyncAppBarButton_Click(object sender, EventArgs e)
        {
            // Setup
            ISyncService syncservice = new SyncService();

            // Save all new exercises
            if (NewExercisesStack.Count > 0)
            {
                if (User != null)
                {
                    // :Go through each one
                    ExercisesToSync = NewExercisesStack.Count;
                    foreach (var exercise in NewExercisesStack)
                    {
                        syncservice.SaveExercise(User, exercise, syncCallbackSave);
                    }

                    // :Remove entries
                    NewExercisesStack.Clear();
                }
                else
                {
                    // Can later be changed to data binding
                    MessageBox.Show("Not logged in");
                }
            }
            else // Just get
            {
                // Get exercises synced
                if (User != null)
                {
                    // :Call service
                    syncservice.GetExercisesLight(User, syncCallbackGet);
                }
                else
                {
                    // Can later be changed to data binding
                    MessageBox.Show("Not logged in");
                }
            }
        }