コード例 #1
0
        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);
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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);
                }
            }
        }