// Method to store the intervals (in percent complete) from the current invocation of // the splash screen to the registry. private void StoreIncrements() { string stepTimes = ""; double actualElapsedMilliseconds = ElapsedMilliSeconds(); for (int i = 0; i < m_actualStepDurations.Count; i++) { stepTimes += m_actualStepDurations[i].ToString("0.####", System.Globalization.NumberFormatInfo.InvariantInfo) + " "; } RegistryAccess.SetStringRegistryValue(REGVALUE_PB_STEP_DURATIONS, m_taskLabel, stepTimes); //m_incrementPerTimerInterval = 1.0/(double)m_actualTickCount; //RegistryAccess.SetStringRegistryValue( REGVALUE_PB_MILISECOND_INCREMENT, m_taskLabel, m_incrementPerTimerInterval.ToString("#.000000", System.Globalization.NumberFormatInfo.InvariantInfo)); RegistryAccess.SetStringRegistryValue(REGVALUE_PB_TOTAL_TIME, m_taskLabel, actualElapsedMilliseconds.ToString("#.000000", System.Globalization.NumberFormatInfo.InvariantInfo)); }
// Function to read the checkpoint intervals from the previous invocation of the // splashscreen from the registry. private void ReadIncrements() { /* string sPBIncrementPerTimerInterval = RegistryAccess.GetStringRegistryValue( REGVALUE_PB_MILISECOND_INCREMENT, m_taskLabel, "0.0015"); * double dblResult; * if( Double.TryParse(sPBIncrementPerTimerInterval, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out dblResult) == true ) * m_incrementPerTimerInterval = dblResult; * else * m_incrementPerTimerInterval = .0015; * * if(m_incrementPerTimerInterval > 0.2)//was stuck at a +infinity value * m_incrementPerTimerInterval = 0.01; */ string s = RegistryAccess.GetStringRegistryValue(REGVALUE_PB_TOTAL_TIME, m_taskLabel, "2"); double dblResult; if (Double.TryParse(s, System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out dblResult) == true) { m_expectedTotalMilliSeconds = (int)dblResult; } else { m_expectedTotalMilliSeconds = 2; } string stepTimes = RegistryAccess.GetStringRegistryValue(REGVALUE_PB_STEP_DURATIONS, m_taskLabel, ""); m_expectedStepDurations = new List <double>(); if (stepTimes != "") { string [] aTimes = stepTimes.Split(null); for (int i = 0; i < aTimes.Length; i++) { double dblVal; if (Double.TryParse(aTimes[i], System.Globalization.NumberStyles.Float, System.Globalization.NumberFormatInfo.InvariantInfo, out dblVal)) { m_expectedStepDurations.Add(dblVal); } else { m_expectedStepDurations.Add(1.0); } } } }