Ejemplo n.º 1
0
        private bool GetUserPermissionModal()
        {
            PermissionDialog dialog = new PermissionDialog();

            dialog.ShowDialog();
            if (dialog.DialogResult.HasValue)
            {
                return(dialog.DialogResult.Value);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        private Task <bool> GetUserPermission()
        {
            // Make a TaskCompletionSource so we can return a puppet Task
            TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>();

            // Show the dialog
            PermissionDialog dialog = new PermissionDialog();

            dialog.Show();

            // When the user is finished with the dialog, complete the Task using SetResult
            dialog.Closed += delegate { tcs.SetResult(dialog.PermissionGranted); };

            // Return the puppet Task, which isn't completed yet
            return(tcs.Task);
        }