Exemplo n.º 1
0
 public void Alert(string title, string message, string okButton)
 {
     Application.SynchronizationContext.Post(ignored =>
     {
         if (CurrentActivity == null)
         {
             return;
         }
         var dialogFragment = new MessageDialogFragment(title, message, okButton);
         CurrentActivity.SupportFragmentManager
         .BeginTransaction()
         .Add(dialogFragment, nameof(MessageDialogFragment))
         .CommitAllowingStateLoss();
     }, null);
 }
Exemplo n.º 2
0
        public IObservable <DialogResult> ShowMessageDialog(string content, string positive = null, string negative = null)
        {
            var currentActivity = BaseActivity.CurrentActivity;

            if (currentActivity == null)
            {
                return(Observable.Empty <DialogResult>());
            }
            MessageDialogFragment mdf = currentActivity.FragmentManager.FindFragmentByTag(MessageDialogFragment.Tag) as MessageDialogFragment;

            if (mdf == null && currentActivity.IsVisible)
            {
                mdf = MessageDialogFragment.NewInstance(content, positive, negative);
                mdf.Show(currentActivity.FragmentManager, MessageDialogFragment.Tag);
                return(mdf.ResultStream);
            }
            return(Observable.Empty <DialogResult>());
        }