예제 #1
0
        private void ShowDialogWithSuggestionToConfigureApplication()
        {
            CustomAlertDialog dialog = new CustomAlertDialog(this)
                                       .SetPositiveButton(Resource.String.configureActionTitle, StartPreferencesActivity)
                                       .SetMessage(Resource.String.configureApplicationMessage, false)
                                       .SetCancelable(false);

            dialog.Show();

            FeatureDiscoveryState state = _application.Preferences.FeatureDiscoveryState;

            if (!state.HasFlag(FeatureDiscoveryState.ApplicationSettings))
            {
                TapTargetViewListener listener = new TapTargetViewListener();
                listener.Clicked += () => _application.Preferences.SetFeatureDiscoveryState(
                    state | FeatureDiscoveryState.ApplicationSettings
                    );

                Button    positiveButton = dialog.GetButton(DialogButtonType.Positive);
                TapTarget settingsTarget = TapTarget.ForView(
                    positiveButton,
                    Resources.GetString(Resource.String.applicationSettingsFeatureDiscoveryTitle),
                    Resources.GetString(Resource.String.applicationSettingsFeatureDiscoveryMessage)
                    )
                                           .Stylize();

                TapTargetView.ShowFor(dialog, settingsTarget, listener);
            }
        }
예제 #2
0
        private async void CheckForUpdatesAsync()
        {
            if (_application.Preferences.LastSeenVersion == null)
            {
                _application.Preferences.LastSeenVersion = _application.GetVersion();
                return;
            }

            if (IsPermissionDenied(Manifest.Permission.Internet))
            {
                RequestPermissions(InternetPermissionRequestCode, Manifest.Permission.Internet);
                return;
            }

            String version = await ApplicationHelper.GetCurrentVersionAsync();

            if (version == null)
            {
                return;
            }

            String current = _application.GetVersion();

            if (version != current && version != _application.Preferences.LastSeenVersion)
            {
                CustomAlertDialog dialog = new CustomAlertDialog(this)
                                           .SetTitle(Resource.String.updateApplicationTitle)
                                           .SetMessage(Resource.String.applicationUpdateAvailableMessage)
                                           .SetPositiveButton(
                    Resource.String.viewActionText,
                    () =>
                {
                    _application.Preferences.LastSeenVersion = version;
                    String releaseUrl = ApplicationHelper.LatestReleaseUrl;
                    StartActivity(new Intent(Intent.ActionView, Uri.Parse(releaseUrl)));
                }
                    );

                dialog.DismissEvent += (s, e) => _application.Preferences.LastSeenVersion = version;

                RunOnUiThread(dialog.Show);
            }
        }