Ejemplo n.º 1
0
 private void InitConfirmDialog()
 {
     confirmDialog = new ThreeOptionsDialog();
     confirmDialog.LeftButton.Visibility = Visibility.Collapsed;
     confirmDialog.MiddleButton.Content  = "Yes";
     confirmDialog.RightButton.Content   = "No";
     confirmDialog.NotAskAgainVisibility = Visibility.Visible;
     confirmDialog.Title = "Delete Tag";
 }
Ejemplo n.º 2
0
        private async Task <bool?> AskForceSyncInOneDirection()
        {
            await CloseSyncStateDialog();

            ThreeOptionsDialog dialog = new ThreeOptionsDialog();

            dialog.Message = "Your current collection has been modified without syncing to the server first." +
                             " As a result, some of your changes will be lost.\n\n"
                             + "Choosing \"Download\" will replace your current collection with the one from the server."
                             + " (A backup will also be created.)\n\n"
                             + "Choosing \"Upload\" will upload your current collection to the server.\n\n"
                             + "(If in doubt, choose \"Download\" as you can restore your data from the backup.)";
            dialog.Title = "Out of Sync";
            dialog.LeftButton.Content   = "Download";
            dialog.MiddleButton.Content = "Upload";
            dialog.RightButton.Content  = "Cancel";
            await dialog.ShowAsync();

            await dialog.WaitForDialogClosed();

            syncStateDialog.Show(MainPage.UserPrefs.IsReadNightMode);
            return(dialog.ThreeStateChoose);
        }
Ejemplo n.º 3
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();
        }