Exemple #1
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
                case Resource.Id.Clear:
                    var progressDialog = ProgressDialog.Show(this,
                                                             Resources.GetString(
                                                                 Resource.String.ClearSessionProgressTitle),
                                                             Resources.GetString(Resource.String.ClearSessionProgressText),
                                                             true);

                    Runner.Instance.ClearSession(() => RunOnUiThread(() =>
                    {
                        _results.Clear();
                        _adapter.NotifyDataSetChanged();
                        progressDialog.Dismiss();
                    }));

                    return true;
                case Resource.Id.Namespaces:
                    StartActivity(typeof(UpdateNamespacesActivity));

                    return true;
                case Resource.Id.Variables:
                    showVariables();

                    return true;
                case Resource.Id.Settings:
                    StartActivity(typeof(SettingsActivity));

                    return true;
                case Resource.Id.About:
                    var packageInfo = PackageManager.GetPackageInfo(PackageName, 0);
                    var aboutContent =
                        new SpannableString(string.Format(Resources.GetString(Resource.String.AboutContent),
                                                          packageInfo.VersionName));

                    Linkify.AddLinks(aboutContent, MatchOptions.All);

                    var dialog =
                        new AlertDialog.Builder(this)
                            .SetTitle(Resource.String.AboutTitle)
                            .SetMessage(aboutContent)
                            .SetPositiveButton(Resource.String.AboutOkButton, delegate { })
                            .Show();

                    ((TextView)dialog.FindViewById(AndroidCore.Resource.Id.Message)).MovementMethod = LinkMovementMethod.Instance;

                    return true;
            }

            return base.OnOptionsItemSelected(item);
        }
        public void ShowAboutInfo(string message)
        {
            var spannable = new SpannableString(message);
            Linkify.AddLinks(spannable, MatchOptions.All);

            var alertBox = new AlertDialog.Builder(this)
                .SetNeutralButton("Ok", (x, y) => { })
                .SetMessage(spannable)
                .SetTitle("About Mono Stock Portfolio")
                .Create();

            alertBox.Show();

            ((TextView)alertBox.FindViewById(Android.Resource.Id.Message)).MovementMethod = LinkMovementMethod.Instance;
        }