/// <summary>
        /// This method works in conjunction with the Data Transfer app placing its time, which we assume to be the correct time,
        /// in a special registry location and then remotely starting this mobile app with the "SetTime" parameter.  It's important,
        /// though not critical, to keep the time on all the mobile devices as correct as possible.
        /// </summary>
        /// <returns>true - Time was changed   false - Time was not changed</returns>
        public static bool UpdateLocalTime()
        {
            DateTime currTime = DateTime.Now;
            string   sNewTime = RegistryCF.GetNewTime();

            RegistryCF.ClearNewTime();              // Good practice to clear this time value

            if (sNewTime != "")
            {
                //DateTime newTime = Convert.ToDateTime(sNewTime);
                DateTime newTime = Tools.GetDateFromString(sNewTime);

                // The 2nd test is to ensure that the date in the registry isn't completely bogus
                if ((newTime.ToString() != "") && (newTime.Year == currTime.Year))
                {
                    TimeSpan timeSpan = currTime - newTime;

                    if (Math.Abs(timeSpan.Minutes) > 5) // Don't bother changing if time difference is less than 5 minutes
                    {
                        DateTimeEx.SetLocalTime(newTime);
                        return(true);
                    }
                }
            }

            return(false);
        }
        /// <summary>
        /// Checks whether a GUID value exists and if not then creates one.
        /// </summary>
        public static void CheckGuid()
        {
            string sGuid = RegistryCF.GetGuid();

            if (sGuid == null)
            {
                Guid guid = PocketGuid.NewGuid();
                RegistryCF.SetGuid(guid.ToString());
            }
        }
        /// <summary>
        /// There is apparently no direct way from the desktop app to get the version number of the mobile
        /// 'PP.exe' file (which this code compiles into btw).  So this method, called upon startup, will
        /// ensure that the CF Registry is correctly updated with the version number.
        ///
        /// Note: If the user aborts an update then the version number will be incorrectly updated since
        ///       the new EXE won't actually be installed.  So this method is the key to resetting the
        ///       version number back to what is the real version number.
        /// </summary>
        /// <param name="updateRegistry"></param>   // Updates the registry, if required
        public static string GetVersionNumber(bool updateRegistry)
        {
            // Note: A bug was observed whereby the last digit of version retrieved from the assembly is not always correct
            string actualVersion   = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            string apparentVersion = RegistryCF.GetVersionNumber();

            if (updateRegistry)
            {
                if (Tools.CompareVersionNumbers(actualVersion, apparentVersion) == 1)
                {
                    RegistryCF.SetVersionNumber(actualVersion);
                }
            }

            return(actualVersion);
        }