// Method to store the intervals (in percent complete) from the current invocation of
        // the splash screen to the registry.
        private void StoreIncrements()
        {
            var sPercent = "";
            var dblElapsedMilliseconds = ElapsedMilliseconds();

            foreach (var timeVal in m_ActualTimes)
            {
                sPercent +=
                    (timeVal / dblElapsedMilliseconds).ToString("0.####",
                                                                System.Globalization.NumberFormatInfo
                                                                .InvariantInfo) + " ";
            }

            RegistryAccess.SetStringRegistryValue(REG_VALUE_PB_PERCENTS, sPercent);

            if (m_iActualTicks < 1)
            {
                m_iActualTicks = 1;
            }

            m_dblPBIncrementPerTimerInterval = 1.0 / m_iActualTicks;
            RegistryAccess.SetStringRegistryValue(REG_VALUE_PB_MILLISECOND_INCREMENT,
                                                  m_dblPBIncrementPerTimerInterval.ToString("#.000000",
                                                                                            System.Globalization
                                                                                            .NumberFormatInfo
                                                                                            .InvariantInfo));
        }
Exemplo n.º 2
0
        // Function to read the checkpoint intervals from the previous invocation of the
        // splashscreen from the registry.
        private void ReadIncrements()
        {
            var sPBIncrementPerTimerInterval = RegistryAccess.GetStringRegistryValue(REGVALUE_PB_MILLISECOND_INCREMENT,
                                                                                     "0.0015");
            double dblResult;

            if (double.TryParse(sPBIncrementPerTimerInterval, System.Globalization.NumberStyles.Float,
                                System.Globalization.NumberFormatInfo.InvariantInfo, out dblResult))
            {
                m_dblPBIncrementPerTimerInterval = dblResult;
            }
            else
            {
                m_dblPBIncrementPerTimerInterval = .0015;
            }

            var sPBPreviousPctComplete = RegistryAccess.GetStringRegistryValue(REGVALUE_PB_PERCENTS, "");

            if (sPBPreviousPctComplete != "")
            {
                var aTimes = sPBPreviousPctComplete.Split(null);
                m_alPreviousCompletionFraction = new List <double>();

                foreach (var timeVal in aTimes)
                {
                    double dblVal;
                    if (double.TryParse(timeVal, System.Globalization.NumberStyles.Float,
                                        System.Globalization.NumberFormatInfo.InvariantInfo, out dblVal))
                    {
                        m_alPreviousCompletionFraction.Add(dblVal);
                    }
                    else
                    {
                        m_alPreviousCompletionFraction.Add(1.0);
                    }
                }
            }
            else
            {
                m_bFirstLaunch        = true;
                lblTimeRemaining.Text = "";
            }
        }
        // Function to read the checkpoint intervals from the previous invocation of the
        // splash screen from the registry.
        private void ReadIncrements()
        {
            var sPBIncrementPerTimerInterval = RegistryAccess.GetStringRegistryValue(REG_VALUE_PB_MILLISECOND_INCREMENT,
                                                                                     "0.0015");

            if (clsUtilities.ParseDouble(sPBIncrementPerTimerInterval, out var dblResult))
            {
                m_dblPBIncrementPerTimerInterval = dblResult;
            }
            else
            {
                m_dblPBIncrementPerTimerInterval = .0015;
            }

            var sPBPreviousPctComplete = RegistryAccess.GetStringRegistryValue(REG_VALUE_PB_PERCENTS, "");

            if (sPBPreviousPctComplete != "")
            {
                var aTimes = sPBPreviousPctComplete.Split(null);
                m_alPreviousCompletionFraction = new List <double>();

                foreach (var timeVal in aTimes)
                {
                    if (clsUtilities.ParseDouble(timeVal, out var dblVal))
                    {
                        m_alPreviousCompletionFraction.Add(dblVal);
                    }
                    else
                    {
                        m_alPreviousCompletionFraction.Add(1.0);
                    }
                }
            }
            else
            {
                m_bFirstLaunch        = true;
                lblTimeRemaining.Text = "";
            }
        }