public void ChangeProgress(DownloadBarMode inMode, double inPercentComplete = -1, double inSpeed = -1) { ChangeBarModeIfApplicable(inMode); string taskToken = ConvertDownloadBarModeToDisplayString(inMode); string speedToken = ConvertBytesPerSecondToSpeedString(inSpeed); string percentToken = ConvertPercentToDisplayString(inPercentComplete); BarLabel.Text = taskToken + percentToken + speedToken; FillLoadingBars(inPercentComplete); }
private static string ConvertDownloadBarModeToDisplayString(DownloadBarMode inMode) { switch (inMode) { case DownloadBarMode.Waiting: return("Waiting for something to do..."); case DownloadBarMode.DownloadingGame: return("Downloading Yandere Simulator:"); case DownloadBarMode.DownloadingLauncher: return("Downloading new launcher"); case DownloadBarMode.Extracting: return("Extracting files"); default: throw new NotImplementedException(); } }
private void ChangeBarModeIfApplicable(DownloadBarMode inMode) { if (inMode != mPreviousBarMode) { // If leaving Extracting if (mPreviousBarMode == DownloadBarMode.Extracting) { CompositionTarget.Rendering -= DoThrobbingRender; } mPreviousBarMode = inMode; // If entering Extracting if (mPreviousBarMode == DownloadBarMode.Extracting) { CompositionTarget.Rendering += DoThrobbingRender; } else if (mPreviousBarMode == DownloadBarMode.Waiting) { FillLoadingBars(0); } } }