Example #1
0
 protected override void OnPause()
 {
     base.OnPause();
     Context.DataChanged    -= DataChanged;
     Context.HeadingChanged -= HeadingChanged;
     ElevationProfileProvider.Instance().ElevationProfileChanged -= OnElevationProfileChanged;
 }
Example #2
0
 protected override void OnResume()
 {
     base.OnResume();
     Context.Resume();
     Context.ReloadData();
     ElevationProfileProvider.Instance().CheckAndReloadElevationProfile(this, MaxDistance, Context);
 }
Example #3
0
        protected virtual void OnDisplayTarrainButtonClicked()
        {
            Context.Settings.ShowElevationProfile = !Context.Settings.ShowElevationProfile;
            _compassView.ShowElevationProfile     = Context.Settings.ShowElevationProfile;

            _displayTerrainButton.SetImageResource(_compassView.ShowElevationProfile ? Resource.Drawable.ic_terrain : Resource.Drawable.ic_terrain_off);

            ElevationProfileProvider.Instance().CheckAndReloadElevationProfile(this, MaxDistance, Context);
        }
Example #4
0
        protected override void OnStart()
        {
            base.OnStart();

            Android.Content.Context ctx = this;

            if (_firstStart)
            {
                CheckAndRequestAppReview();

                TutorialDialog.ShowTutorial(this, TutorialPart.MainActivity,
                                            new TutorialPage[]
                {
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_compass_calibration, textResourceId = Resource.String.Tutorial_Main_CompassCalibration
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_heading_correction, textResourceId = Resource.String.Tutorial_Main_HeadingCorrection
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_horizont_correction_simple, textResourceId = Resource.String.Tutorial_Main_HorizontCorrection
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_show_poi_data, textResourceId = Resource.String.Tutorial_Main_ShowPoiData
                    },
                    new TutorialPage()
                    {
                        imageResourceId = Resource.Drawable.tutorial_ar_warning, textResourceId = Resource.String.Tutorial_Main_ARWarning
                    },
                },
                                            () =>
                {
                    _firstStart = false;
                    if (!Context.Database.IsAnyDownloadedPois())
                    {
                        AlertDialog.Builder alert = new AlertDialog.Builder(this).SetCancelable(false);
                        alert.SetPositiveButton(Resources.GetText(Resource.String.Common_Yes), (senderAlert, args) =>
                        {
                            Intent downloadActivityIntent = new Intent(ctx, typeof(DownloadActivity));
                            StartActivity(downloadActivityIntent);
                            //_adapter.NotifyDataSetChanged();
                        });
                        alert.SetNegativeButton(Resources.GetText(Resource.String.Common_No), (senderAlert, args) => { });
                        alert.SetMessage(Resources.GetText(Resource.String.Main_DownloadDataQuestion));
                        var answer = alert.Show();
                    }

                    ElevationProfileProvider.Instance().CheckAndReloadElevationProfile(this, MaxDistance, Context);
                });
            }
        }
        public override void OnDataChanged(object sender, DataChangedEventArgs e)
        {
            try
            {
                base.OnDataChanged(sender, e);

                _compassView.SetPoiViewItemList(e.PoiData ?? new PoiViewItemList());

                //TODO: check is the following call is really needed
                ElevationProfileProvider.Instance().CheckAndReloadElevationProfile(this, MaxDistance, Context);
            }
            catch (Exception)
            {
                //TODO: Possibly log the failure
            }
        }
        private void LoadImageAndProfile()
        {
            LoadImage(_photodata.PhotoFileName);

            try
            {
                if (Context.Settings.ShowElevationProfile)
                {
                    if (_photodata.JsonElevationProfileData != null)
                    {
                        Context.ElevationProfileData = ElevationProfileData.Deserialize(_photodata.JsonElevationProfileData);
                        if (Context.ElevationProfileData != null)
                        {
                            ElevationProfileProvider.Instance().CheckAndReloadElevationProfile(this, MaxDistance, Context);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                PopupHelper.ErrorDialog(this, ex.Message);
            }
        }