private bool CanCartridgeRun(WF.Player.Core.Cartridge cart)
        {
            bool canCartridgeRun = true;

            // Checks if a good location is available.
            double?locationAccuracy = null;

            if (Model.Core.DeviceLocation != null)
            {
                locationAccuracy = Model.Core.DeviceLocation.HorizontalAccuracy;
            }
            if (Model.Core.DeviceLocationStatus != System.Device.Location.GeoPositionStatus.Ready || locationAccuracy == null)
            {
                // No location is available.
                canCartridgeRun = System.Windows.MessageBox.Show(
                    String.Format("This device's location could not be found because location services are not ready. This may lead the game {0} to not behave correctly. Check the device status page from the main menu.\n\nTap on OK to run the game anyway, or on Cancel to return to the main menu.", cart.Name),
                    "Location services are not ready",
                    MessageBoxButton.OKCancel
                    ) == System.Windows.MessageBoxResult.OK;
            }
            else if (locationAccuracy > PlayerViewModel.MaxGoodLocationAccuracy)
            {
                // No good accuracy.
                canCartridgeRun = System.Windows.MessageBox.Show(
                    String.Format("This device's location accuracy is poor right now ({1:0}m). This may lead the game {0} to not behave correctly. Check the device status page from the main menu.\n\nTap on OK to run the game anyway, or on Cancel to return to the main menu.", cart.Name, locationAccuracy),
                    "Poor location accuracy",
                    MessageBoxButton.OKCancel
                    ) == System.Windows.MessageBoxResult.OK;
            }

            return(canCartridgeRun);
        }
Пример #2
0
        /// <summary>
        /// Adds an extra data to BugSense describing a cartridge.
        /// </summary>
        /// <param name="cart"></param>
        public static void AddBugSenseCrashExtraData(WF.Player.Core.Cartridge cart)
        {
            var extraDataList = BugSenseHandler.Instance.CrashExtraData;

            string guid = cart.Guid;

            if (guid != null)
            {
                extraDataList.Add(new BugSense.Core.Model.CrashExtraData("cartGuid", guid));
            }

            string name = cart.Name;

            if (name != null)
            {
                extraDataList.Add(new BugSense.Core.Model.CrashExtraData("cartName", name.Trim()));
            }

            string engineGameState = "<unknown>";

            Models.WherigoModel model = App.Current.Model;
            if (model != null)
            {
                Models.WFCoreAdapter core = model.Core;
                if (core != null)
                {
                    engineGameState = core.GameState.ToString();
                }
            }
            extraDataList.Add(new BugSense.Core.Model.CrashExtraData("engineGameState", engineGameState));
        }