예제 #1
0
        private async Task DownloadFullDatabase(FullSyncer fullSyncclient)
        {
            SetSyncLabel("Downloading full database...");
            syncStateDialog.Show();
            await fullSyncclient.Download();

            await ReOpenAndNavigateToDeckSelectPage();
        }
예제 #2
0
        private async Task ConfirmAndStartFullSync()
        {
            var fullSyncclient = new FullSyncer(mainPage.Collection, hostKey);

            fullSyncclient.OnHttpProgressEvent += OnServerHttpProgressEvent;
            ThreeOptionsDialog dialog = new ThreeOptionsDialog();

            dialog.Title   = "Full Sync Direction";
            dialog.Message = "Your collection has been modified in a way that a full sync is required.\n"
                             + "\"Download\" will download the collection from the sever and replace your current one. Unsynced changes will be lost.\n"
                             + "\"Upload\" will upload your current collection to the server. Unsynced changes on OTHER devices will be lost.";
            dialog.LeftButton.Content   = "Download";
            dialog.MiddleButton.Content = "Upload";
            await dialog.ShowAsync();

            await dialog.WaitForDialogClosed();

            if (dialog.IsLeftButtonClick())
            {
                await MainPage.BackupDatabase();
                await DownloadFullDatabase(fullSyncclient);
            }
            else if (dialog.IsMiddleButtonClick())
            {
                var isContinue = await UIHelper.AskUserConfirmation("UPLOAD your collection to the server?");

                if (isContinue)
                {
                    await UploadFullDatabase(fullSyncclient);
                }
            }

            SetSyncLabel("Finished.");
            await Task.Delay(250);

            await WaitForCloseSyncStateDialog();
        }
예제 #3
0
 private async Task UploadFullDatabase(FullSyncer fullSyncclient)
 {
     SetSyncLabel("Uploading full database...");
     syncStateDialog.Show();
     await fullSyncclient.Upload();
 }