예제 #1
0
파일: App.xaml.cs 프로젝트: Zaixu/Runup
        // 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");
                }
            }
        }
예제 #2
0
 private void _ShowSyncedExercise(int ID)
 {
     // Setup
     ISyncService service = new SyncService();
     service.GetFullExercise(_application.User, ID, _FullExerciseRetrieved);
 }
예제 #3
0
파일: App.xaml.cs 프로젝트: Zaixu/Runup
        /// <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");
                }
            }
        }