/// <summary>
        /// a non-localized string appropriate for logging corresponding to one of the NETWORK_* constants.
        /// </summary>
        /// <param name="networkError">
        /// The network Error.
        /// </param>
        /// <returns>
        /// The get log message for network error.
        /// </returns>
        public string GetLogMessageForNetworkError(NetworkDisabledState networkError)
        {
            switch (networkError)
            {
            case NetworkDisabledState.RecommendedUnusableDueToSize:
                return("download size exceeds recommended limit for mobile network");

            case NetworkDisabledState.UnusableDueToSize:
                return("download size exceeds limit for mobile network");

            case NetworkDisabledState.NoConnection:
                return("no network connection available");

            case NetworkDisabledState.CannotUseRoaming:
                return("download cannot use the current network connection because it is roaming");

            case NetworkDisabledState.TypeDisallowedByRequestor:
                return("download was requested to not use the current network type");

            default:
                return("unknown error with network connectivity");
            }
        }
Example #2
0
        /// <summary>
        /// Check if current connectivity is valid for this request.
        /// </summary>
        private void CheckConnectivity()
        {
            NetworkDisabledState availabilityState = this.downloaderService.GetNetworkAvailabilityState();

            switch (availabilityState)
            {
            case NetworkDisabledState.Ok:
                return;

            case NetworkDisabledState.NoConnection:
                throw new StopRequestException(ExpansionDownloadStatus.WaitingForNetwork, "waiting for network to return");

            case NetworkDisabledState.TypeDisallowedByRequestor:
                throw new StopRequestException(
                          ExpansionDownloadStatus.QueuedForWifiOrCellularPermission,
                          "waiting for wifi or for download over cellular to be authorized");

            case NetworkDisabledState.CannotUseRoaming:
                throw new StopRequestException(ExpansionDownloadStatus.WaitingForNetwork, "roaming is not allowed");

            case NetworkDisabledState.UnusableDueToSize:
                throw new StopRequestException(ExpansionDownloadStatus.QueuedForWifi, "waiting for wifi");
            }
        }
        /// <summary>
        /// a non-localized string appropriate for logging corresponding to one of the NETWORK_* constants.
        /// </summary>
        /// <param name="networkError">
        /// The network Error.
        /// </param>
        /// <returns>
        /// The get log message for network error.
        /// </returns>
        public string GetLogMessageForNetworkError(NetworkDisabledState networkError)
        {
            switch (networkError)
            {
                case NetworkDisabledState.RecommendedUnusableDueToSize:
                    return "download size exceeds recommended limit for mobile network";

                case NetworkDisabledState.UnusableDueToSize:
                    return "download size exceeds limit for mobile network";

                case NetworkDisabledState.NoConnection:
                    return "no network connection available";

                case NetworkDisabledState.CannotUseRoaming:
                    return "download cannot use the current network connection because it is roaming";

                case NetworkDisabledState.TypeDisallowedByRequestor:
                    return "download was requested to not use the current network type";

                default:
                    return "unknown error with network connectivity";
            }
        }