Example #1
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            // Hide PokeMenu panel just in case
            HidePokeMenuStoryboard.Begin();
            // See if we need to update the map
            if ((e.Parameter != null) && (e.NavigationMode != NavigationMode.Back))
            {
                GameMapNavigationModes mode =
                    ((JObject)JsonConvert.DeserializeObject((string)e.Parameter)).Last
                    .ToObject <GameMapNavigationModes>();
                if ((mode == GameMapNavigationModes.AppStart) || (mode == GameMapNavigationModes.SettingsUpdate))
                {
                    SetupMap();
                }
            }
            // Set first position if we shomehow missed it
            UpdateMap();
            await GameMapControl.TryRotateToAsync(SettingsService.Instance.MapHeading);

            await GameMapControl.TryTiltToAsync(SettingsService.Instance.MapPitch);

            SubscribeToCaptureEvents();
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
        }
Example #2
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            try
            {
                base.OnNavigatedTo(e);
                // Hide panels just in case
                HidePokeMenuStoryboard.Begin();
                CoverGrid.Opacity = 0;

                // See if we need to update the map
                if ((e.Parameter != null) && (e.NavigationMode != NavigationMode.Back))
                {
                    GameMapNavigationModes mode =
                        ((JObject)JsonConvert.DeserializeObject((string)e.Parameter)).Last
                        .ToObject <GameMapNavigationModes>();
                    if ((mode == GameMapNavigationModes.AppStart) || (mode == GameMapNavigationModes.SettingsUpdate))
                    {
                        SetupMap();
                    }
                }
                // Set first position if we shomehow missed it
                await UpdateMap();

                //Changed order of calls, this allow to have events registration before trying to move map
                //appears that for some reason TryRotate and/or TryTilt fails sometimes!
                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
                SubscribeToCaptureEvents();

                AudioUtils.SoundEnded += AudioUtils_SoundEnded;
            }
            catch (Exception ex)
            {
                //because we are in "async void" unhandled exception might not be raised
                await ExceptionHandler.HandleException(ex);
            }
            try
            {
                await GameMapControl.TryRotateToAsync(SettingsService.Instance.MapHeading);

                await GameMapControl.TryTiltToAsync(SettingsService.Instance.MapPitch);
            }
            catch
            {
                //we don't care :)
            }
        }