Example #1
0
 private void SetSubProgressCb(IAsyncResult progressResult)
 {
     if (progressResult.IsDone)
     {
         return;
     }
     progressResult.Callbackable().OnCallback(f => RaiseOnProgressCallback(0));
 }
Example #2
0
        public static CoroutineAwaiter <TResult> GetAwaiter <TResult>(this IAsyncResult <TResult> asyncResult)
        {
            CoroutineAwaiter <TResult> awaiter = new CoroutineAwaiter <TResult>();

            asyncResult.Callbackable().OnCallback(ar =>
            {
                awaiter.SetResult(ar.Result, ar.Exception);
            });
            return(awaiter);
        }
        public DialogServiceExampleViewModel(IDialogService dialogService)
        {
            this.dialogService = dialogService;

            this.openAlertDialog = new SimpleCommand(() =>
            {
                this.openAlertDialog.Enabled = false;
                IAsyncResult <int> result    = this.dialogService.ShowDialog("Dialog Service Example", "This is a dialog test.", "Yes", "No", null, true);
                result.Callbackable().OnCallback(r =>
                {
                    if (r.Result == AlertDialog.BUTTON_POSITIVE)
                    {
                        Debug.LogFormat("Click: Yes");
                    }
                    else if (r.Result == AlertDialog.BUTTON_NEGATIVE)
                    {
                        Debug.LogFormat("Click: No");
                    }
                    this.openAlertDialog.Enabled = true;
                });
            });

            this.openAlertDialog2 = new SimpleCommand(() =>
            {
                this.openAlertDialog2.Enabled = false;

                AlertDialogViewModel viewModel = new AlertDialogViewModel();
                viewModel.Title             = "Dialog Service Example";
                viewModel.Message           = "This is a dialog test.";
                viewModel.ConfirmButtonText = "OK";

                IAsyncResult <AlertDialogViewModel> result = this.dialogService.ShowDialog("UI/AlertDialog", viewModel);
                result.Callbackable().OnCallback(r =>
                {
                    AlertDialogViewModel vm = r.Result;
                    if (vm.Result == AlertDialog.BUTTON_POSITIVE)
                    {
                        Debug.LogFormat("Click: OK");
                    }
                    this.openAlertDialog2.Enabled = true;
                });
            });
        }