Exemple #1
0
        /// <summary>
        /// Shows the specified Alert within the applciation.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="body">The body.</param>
        /// <param name="content">The content.</param>
        /// <param name="buttons">The buttons.</param>
        /// <returns></returns>
        public async Task Show(string title, string body, View content, List <AlertButton> buttons)
        {
            var tcs = new TaskCompletionSource <object>();
            var adf = new AlertDialogFragment
            {
                Title   = title,
                Body    = body,
                Content = content,
                Buttons = buttons,
                tsc     = tcs
            };

            var FragmentManager    = ((Activity)Forms.Context).FragmentManager;
            FragmentTransaction ft = FragmentManager.BeginTransaction();

            //Remove fragment else it will crash as it is already added to backstack
            Fragment prev = FragmentManager.FindFragmentByTag("alert");

            if (prev != null)
            {
                ft.Remove(prev);
            }

            ft.AddToBackStack(null);
            adf.Cancelable = false;
            adf.Show(ft, "alert");

            Log.Debug("TSC", tcs.Task.Status.ToString());

            await tcs.Task;
        }
Exemple #2
0
        public async Task Show(string title, string body, View content, List <AlertButton> buttons)
        {
            var tcs = new TaskCompletionSource <object>();

            var adf = new AlertDialogFragment
            {
                Title   = title,
                Body    = body,
                Content = content,
                Buttons = buttons
            };
            var FragmentManager = ((Activity)Forms.Context).FragmentManager;

            FragmentTransaction ft = FragmentManager.BeginTransaction();
            //Remove fragment else it will crash as it is already added to backstack
            Fragment prev = FragmentManager.FindFragmentByTag("alert");

            if (prev != null)
            {
                ft.Remove(prev);
            }

            if (title.Contains("welkom"))
            {
                tcs.SetResult(null);
            }

            ft.AddToBackStack(null);

            adf.Show(ft, "alert");

            await tcs.Task;
        }
Exemple #3
0
        protected void ShowAlertDialogFragment(string aMessage, string aTitle, int aIcon)
        {
            if (SupportFragmentManager.IsDestroyed)
            {
                Log.Error(TAG, "Activity has been already destroyed");
                return;
            }
            AlertDialogFragment frag = AlertDialogFragment.NewInstance(aMessage, aTitle, aIcon);

            SupportFragmentManager.BeginTransaction().Add(frag, NOTIFICATION_FRAGMENT_TAG + frag.GetHashCode()).Commit();
        }
Exemple #4
0
            public static AlertDialogFragment NewInstance(string message)
            {
                var bundle = new Bundle();

                bundle.PutString(KEY_MESSAGE, message);

                var dialog = new AlertDialogFragment();

                dialog.Arguments = bundle;

                return(dialog);
            }
Exemple #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: public static AlertDialogFragment newInstance(@DrawableRes int iconId, CharSequence title, CharSequence message, boolean finishActivity)
            public static AlertDialogFragment newInstance(int iconId, CharSequence title, CharSequence message, bool finishActivity)
            {
                AlertDialogFragment fragment = new AlertDialogFragment();

                Bundle args = new Bundle();

                args.putInt("icon", iconId);
                args.putCharSequence("title", title);
                args.putCharSequence("message", message);
                args.putBoolean("finish_activity", finishActivity);

                fragment.Arguments = args;
                return(fragment);
            }
Exemple #6
0
        private void MainViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine($"MainViewModel_PropertyChanged {e.PropertyName}");

            switch (e.PropertyName)
            {
            case nameof(MainViewModel.CurrentViewModelName):
                var fragment = GetFragmentFromName(MainViewModel.CurrentViewModelName);
                SupportFragmentManager.BeginTransaction().Replace(Resource.Id.frameLayoutContent, fragment).Commit();
                break;

            case nameof(MainViewModel.AlertMessage):
                var dialog = AlertDialogFragment.NewInstance(MainViewModel.AlertMessage);
                dialog.Show(SupportFragmentManager, nameof(AlertDialogFragment));
                break;

            default:
                System.Diagnostics.Debug.WriteLine(" unknown.");
                break;
            }
        }
Exemple #7
0
 public OnClickListenerAnonymousInnerClassHelper(AlertDialogFragment outerInstance)
 {
     this.outerInstance = outerInstance;
 }
Exemple #8
0
            public override void onItemClick <T1>(AdapterView <T1> parent, View view, int position, long id)
            {
                if (position >= outerInstance.SAMPLE_NAMES_LIST.Length)
                {
                    return;
                }

                switch (outerInstance.SAMPLE_NAMES_LIST[position])
                {
                case outerInstance.SAMPLE_SINGLE:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_Single));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_EFFECT:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_Effect));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_HDR:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_HDR));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_LLS:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_LowLight));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_PANORAMA:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_Panorama));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_DOF:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_DOF));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_FILTER:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_Filter));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_CONSTRAINED_HIGHSPEEDVIDEO:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_Constrained_HighSpeedVideo));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_HIGHSPEEDVIDEO:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_HighSpeedVideo));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_IPX:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_Image));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_TORCH:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_Torch));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_ZSL:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_ZSL));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_YUV:
                {
                    Intent intent = new Intent(outerInstance, typeof(Sample_YUV));
                    startActivity(intent);
                    break;
                }

                case outerInstance.SAMPLE_VERSION:
                {
                    try
                    {
                        StringBuilder builder     = new StringBuilder();
                        PackageInfo   packageInfo = PackageManager.getPackageInfo(PackageName, 0);

                        builder.Append(string.Format("Version code: {0:D}\n", packageInfo.versionCode)).Append(string.Format("Version name: {0}\n", packageInfo.versionName));

                        AlertDialogFragment.newInstance(android.R.drawable.ic_dialog_info, "CameraSDK Sample Application Version", builder.ToString(), false).show(FragmentManager, "info_dialog");
                        break;
                    }
                    catch (PackageManager.NameNotFoundException)
                    {
                        // This should not happen.
                    }
                }
                break;
                }
            }
Exemple #9
0
        /// <summary>
        /// Shows alert dialog.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: private void showAlertDialog(final String message, final boolean finishActivity)
        private void showAlertDialog(string message, bool finishActivity)
        {
            AlertDialogFragment.newInstance(android.R.drawable.ic_dialog_alert, "Alert", message, finishActivity).show(FragmentManager, "alert_dialog");
        }