예제 #1
0
        protected virtual IDisposable ShowDialog <TFragment, TConfig>(FragmentActivity activity, TConfig config) where TFragment : AbstractDialogFragment <TConfig> where TConfig : class, new()
        {
            var frag = (TFragment)Activator.CreateInstance(typeof(TFragment));

            frag.Config = config;
            activity.RunOnUiThread(() => frag.Show(activity.FragmentManager, FragmentTag));

            return(new DisposableAction(() =>
                                        activity.RunOnUiThread(frag.Dismiss)
                                        ));
        }
예제 #2
0
        public static void ProgressDialogDismiss(this FragmentActivity fragmentActivity, Android.App.ProgressDialog dialog)
        {
            Log.Debug(TAG, nameof(ProgressDialogDismiss));

            fragmentActivity.RunOnUiThread(() =>
            {
                Log.Debug(TAG, "[3] Closing dialog.");
                if (dialog != null)
                {
                    if (dialog.IsShowing)
                    {
                        Log.Debug(TAG, string.Format($"--{nameof(ProgressDialogDismiss)}: dialog - IsShowing"));
                        dialog.Dismiss();
                    }
                    else
                    {
                        Log.Debug(TAG, string.Format($"--{nameof(ProgressDialogDismiss)}: dialog - NOT IsShowing"));
                    }
                }
                else
                {
                    Log.Debug(TAG, string.Format($"--{nameof(ProgressDialogDismiss)}: dialog is NULL"));
                }
                Log.Debug(TAG, "[4] Dialog closed.");
            });
        }
예제 #3
0
 public void pushInfo(FragmentActivity context, string c0, string c1 = "", string c2 = "", string c3 = "")
 {
     context.RunOnUiThread(() =>
     {
         for (int i = numLines - 1; i > 0; i--)
         {
             for (int j = 0; j < 4; j++)
             {
                 infoArray[i, j].Text = infoArray[i - 1, j].Text;
             }
         }
         infoArray[0, 0].Text = c0;
         infoArray[0, 1].Text = c1;
         infoArray[0, 2].Text = c2;
         infoArray[0, 3].Text = c3;
     });
 }
예제 #4
0
        public void FetchLocations(String queryString)
        {
            // Cancel pending searches
            CtsCancel();

            // Get locations
            if (!String.IsNullOrWhiteSpace(queryString))
            {
                Task.Run(async() =>
                {
                    var ctsToken = cts.Token;

                    if (ctsToken.IsCancellationRequested)
                    {
                        return;
                    }

                    var results = await wm.GetLocations(queryString);

                    if (ctsToken.IsCancellationRequested)
                    {
                        return;
                    }

                    mActivity?.RunOnUiThread(() => mAdapter.SetLocations(results.ToList()));
                });
            }
            else if (String.IsNullOrWhiteSpace(queryString))
            {
                // Cancel pending searches
                CtsCancel();
                // Hide flyout if query is empty or null
                mAdapter.Dataset.Clear();
                mAdapter.NotifyDataSetChanged();
            }
        }
예제 #5
0
 public void Post(Action action)
 {
     activity.RunOnUiThread(action);
 }