Example #1
0
        public override void Cancel(ActionArgs e)
        {
            bool cancel_base = false;
            ActionAccountAskArg arg = e as ActionAccountAskArg;

            if (arg != null) {
                try {
                    var dialog = _waiting.FirstOrDefault(x => x.Value == arg).Key;
                    arg.ParentLayout.Children.Remove(dialog.Dialog);
                    arg.Result = null;
                    if (arg.IsRequire)
                    {
                        cancel_base = true;
                        Deployment.Current.Dispatcher.BeginInvoke(() =>
                        {
                            AccountRequireDialog notify_dialog = new AccountRequireDialog();
                            notify_dialog.OnComplete += notify_dialog_OnComplete;
                            _waiting.Add(notify_dialog, arg);
                            arg.ParentLayout.Children.Add(notify_dialog.Dialog);
                            notify_dialog.show();
                        });
                    }
                } catch (Exception ex) {
                    //throw ex;
                }
            } else {
                Exception ex = new Exception("Action Ask dialog error");
                //throw ex;
            }
            if (!cancel_base)
            {
                base.Cancel(e);
            }
        }
Example #2
0
 void dialog_OnComplete(object sender, AccountAskDialogArgs e)
 {
     AccountAskDialog dialog = sender as AccountAskDialog;
     if (dialog != null) {
         try {
             ActionAccountAskArg arg = _waiting[dialog];
             arg.ParentLayout.Children.Remove(dialog.Dialog);
             arg.Result = e;
             Done(arg);
         } catch (Exception ex) {
             //throw ex;
         }
     } else {
         Exception ex = new Exception("Action Ask dialog error");
         //throw ex;
     }
 }
Example #3
0
 public override void Do(ActionArgs e)
 {
     Begin(e);
     if (precheckToDo(e)) {
         ActionAccountAskArg arg = e as ActionAccountAskArg;
             Deployment.Current.Dispatcher.BeginInvoke(() => {
                 AccountAskDialog dialog = null;
                 if (arg.IsRequire)
                 {
                     dialog = new AccountAskDialog(AccountAskDialogType.TypeOk);
                 }
                 else
                 {
                     dialog = new AccountAskDialog(AppObject.GameInfo.AccountDialogType);
                 }
                 dialog.OnComplete += dialog_OnComplete;
                 arg.ParentLayout.Children.Add(dialog.Dialog);
                 dialog.show();
                 _waiting.Add(dialog, arg);
             });
     } else {
         Cancel(e);
     }
 }