public static bool IsWaitingForCellApproval(this DownloaderClientState newState) { bool showCellMessage = false; switch (newState) { case DownloaderClientState.PausedNeedCellularPermission: case DownloaderClientState.PausedWifiDisabledNeedCellularPermission: showCellMessage = true; break; } return(showCellMessage); }
public static bool IsIndeterminate(this DownloaderClientState newState) { bool indeterminate = false; switch (newState) { case DownloaderClientState.Idle: case DownloaderClientState.Connecting: case DownloaderClientState.FetchingUrl: indeterminate = true; break; } return(indeterminate); }
public static bool IsPaused(this DownloaderClientState newState) { bool paused = true; switch (newState) { case DownloaderClientState.Idle: case DownloaderClientState.Connecting: case DownloaderClientState.FetchingUrl: case DownloaderClientState.Downloading: paused = false; break; } return(paused); }
public static bool CanShowProgress(this DownloaderClientState newState) { bool showDashboard = true; switch (newState) { case DownloaderClientState.Failed: case DownloaderClientState.FailedCanceled: case DownloaderClientState.FailedFetchingUrl: case DownloaderClientState.FailedUnlicensed: case DownloaderClientState.PausedNeedCellularPermission: case DownloaderClientState.PausedWifiDisabledNeedCellularPermission: showDashboard = false; break; } return(showDashboard); }
public void OnDownloadStateChanged(DownloaderClientState downloaderClientState) { //("MainActivity.OnDownloadStateChanged downloaderClientState:" + downloaderClientState.ToString()); switch (downloaderClientState) { case DownloaderClientState.PausedWifiDisabledNeedCellularPermission: case DownloaderClientState.PausedNeedCellularPermission: this._expansionDownloaderService.SetDownloadFlags(DownloaderServiceFlags.DownloadOverCellular); this._expansionDownloaderService.RequestContinueDownload(); break; case DownloaderClientState.Completed: if (this._expansionDownloaderService != null) { this._expansionDownloaderService.Dispose(); this._expansionDownloaderService = null; } this.OnExpansionDowloaded(); break; } }
public void OnDownloadStateChanged(DownloaderClientState newState) { if (downloaderState != newState) { downloaderState = newState; statusTextView.Text = Helpers.GetDownloaderStringFromState(this, newState); } if (newState != DownloaderClientState.Completed) { dashboardView.Visibility = newState.CanShowProgress() ? ViewStates.Visible : ViewStates.Gone; useCellDataView.Visibility = newState.IsWaitingForCellApproval() ? ViewStates.Visible : ViewStates.Gone; progressBar.Indeterminate = newState.IsIndeterminate(); UpdatePauseButton(newState.IsPaused()); } else { statusTextView.Text = "Download Complete!"; dashboardView.Visibility = ViewStates.Gone; useCellDataView.Visibility = ViewStates.Gone; } }
/// <summary> /// The download state should trigger changes in the UI. /// It may be useful to show the state as being indeterminate at times. /// </summary> /// <param name="newState"> /// The new state. /// </param> public void OnDownloadStateChanged(DownloaderClientState newState) { #if DEBUG Android.Util.Log.Debug(Tag, "Download state: " + newState); #endif if (_downloaderState != newState) { _downloaderState = newState; _statusTextView.Text = Helpers.GetDownloaderStringFromState(this, newState); } bool showDashboard = true; bool showCellMessage = false; bool paused = false; bool indeterminate = true; switch (newState) { case DownloaderClientState.Idle: case DownloaderClientState.Connecting: case DownloaderClientState.FetchingUrl: break; case DownloaderClientState.Downloading: indeterminate = false; break; case DownloaderClientState.Failed: case DownloaderClientState.FailedCanceled: case DownloaderClientState.FailedFetchingUrl: case DownloaderClientState.FailedUnlicensed: paused = true; showDashboard = false; indeterminate = false; break; case DownloaderClientState.PausedNeedCellularPermission: case DownloaderClientState.PausedWifiDisabledNeedCellularPermission: showDashboard = false; paused = true; indeterminate = false; showCellMessage = true; break; case DownloaderClientState.PausedByRequest: paused = true; indeterminate = false; break; case DownloaderClientState.PausedRoaming: case DownloaderClientState.PausedSdCardUnavailable: paused = true; indeterminate = false; break; default: paused = true; break; } if (newState != DownloaderClientState.Completed) { _dashboardView.Visibility = showDashboard ? ViewStates.Visible : ViewStates.Gone; _useCellDataView.Visibility = showCellMessage ? ViewStates.Visible : ViewStates.Gone; _progressBar.Indeterminate = indeterminate; UpdatePauseButton(paused); } else { ValidateExpansionFiles(); } }
public static string GetDownloaderStringFromState(Context context, DownloaderClientState state) { return(context.GetString(GetDownloaderStringResourceIdFromState(state))); }
public static int GetDownloaderStringFromState(DownloaderClientState state) { return(GetDownloaderStringResourceIdFromState(state)); }
/// <summary> /// The download state should trigger changes in the UI. /// It may be useful to show the state as being indeterminate at times. /// </summary> /// <param name="newState"> /// The new state. /// </param> public async void OnDownloadStateChanged(DownloaderClientState newState) { if (this.downloaderClientState != newState) { this.downloaderClientState = newState; this.statusTextView.Text = this.GetString(Helpers.GetDownloaderStringResourceIdFromState(newState)); } bool showDashboard = true; bool showCellMessage = false; bool paused = false; bool indeterminate = true; switch (newState) { case DownloaderClientState.Idle: case DownloaderClientState.Connecting: case DownloaderClientState.FetchingUrl: break; case DownloaderClientState.Downloading: indeterminate = false; break; case DownloaderClientState.Failed: case DownloaderClientState.FailedCanceled: case DownloaderClientState.FailedFetchingUrl: case DownloaderClientState.FailedUnlicensed: paused = true; showDashboard = false; indeterminate = false; break; case DownloaderClientState.PausedNeedCellularPermission: case DownloaderClientState.PausedWifiDisabledNeedCellularPermission: showDashboard = false; paused = true; indeterminate = false; showCellMessage = true; break; case DownloaderClientState.PausedByRequest: paused = true; indeterminate = false; break; case DownloaderClientState.PausedRoaming: case DownloaderClientState.PausedSdCardUnavailable: paused = true; indeterminate = false; break; default: paused = true; break; } if (newState != DownloaderClientState.Completed) { this.dashboardView.Visibility = showDashboard ? ViewStates.Visible : ViewStates.Gone; this.useCellDataView.Visibility = showCellMessage ? ViewStates.Visible : ViewStates.Gone; this.progressBar.Indeterminate = indeterminate; this.UpdatePauseButton(paused); } else { await InitApp(); // this.ValidateExpansionFiles(); } }