Exemplo n.º 1
0
        private void ShowChangelog()
        {
            try
            {
                // Get current version code first
                PackageInfo pInfo = PackageManager.GetPackageInfo(PackageName, 0);
                int         currentVersionCode = pInfo.VersionCode;

                Console.WriteLine("VERSION: " + currentVersionCode);

                // Get current preferences
                ISharedPreferences mVersionCodePrefs = Application.Context.GetSharedPreferences("AppVersion_Preferences", FileCreationMode.Private);
                int savedVersion = mVersionCodePrefs.GetInt("appVersionPREF", 0);

                // Show dialog if version is old
                if ((savedVersion < currentVersionCode) || (overrideShowChangelog))
                {
                    // Pull up dialog
                    var transaction     = SupportFragmentManager.BeginTransaction();
                    var changelogDialog = new ChangelogDialog();
                    changelogDialog.Show(transaction, "changelog_dialog");
                }

                // Update version code and preferences
                mVersionCodePrefs.Edit().PutInt("appVersionPREF", currentVersionCode).Apply();
            }
            catch
            {
                // If something is wrong, dialog won't show up
            }
        }
Exemplo n.º 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // In order to return the view for this Fragment
            thisView = inflater.Inflate(Resource.Layout.about_fragment, container, false);

            ApplyStyle();


            // Open email app if link clicked
            _about_textContact2.Click += delegate
            {
                try
                {
                    var email = new Intent(Intent.ActionSend);
                    email.PutExtra(Intent.ExtraEmail, new string[] { "*****@*****.**" });
                    email.SetType("message/rfc822");
                    StartActivity(email);
                }
                catch { }
            };

            // Open browser app if link clicked
            _about_textContribute2.Click += delegate
            {
                try
                {
                    var uri    = Android.Net.Uri.Parse("http://www.cavokator.com");
                    var intent = new Intent(Intent.ActionView, uri);
                    StartActivity(intent);
                }
                catch { }
            };

            // Show changelog dialog if clicked
            _about_textChangelog2.Click += delegate
            {
                // If there is a changelog prepared
                if (ActivityWxMain.versionWithChangelog)
                {
                    // Pull up dialog
                    var transaction     = FragmentManager.BeginTransaction();
                    var changelogDialog = new ChangelogDialog();
                    changelogDialog.Show(transaction, "changelog_dialog");
                }
                // Else, show error
                else
                {
                    Toast.MakeText(Activity, Resource.String.about_noChangelog, ToastLength.Short).Show();
                }
            };


            return(thisView);
        }