Exemple #1
0
 ///<summary>Verifies the given unlockCode and Invokes _unlockGeneratedFuc before setting the form locked.</summary>
 private void VerifyAndSetUnlockCode(string unlockCode)
 {
     if (unlockCode.IsNullOrEmpty())
     {
         MsgBox.Show(this, "Unlock code is empty.");
         return;
     }
     if (unlockCode.Length != 6)           //Verify that code is valid.
     {
         MsgBox.Show(this, "Unlock code must be 6 characters.");
         return;
     }
     if (MobileDataBytes.IsValidUnlockCode(unlockCode))             //Code alreay in use.
     {
         MsgBox.Show(this, "Please choose another unlock code.");
         return;
     }
     if (!TryInvoke(unlockCode, out _mobileDataByte))
     {
         return;
     }
     if (!MobileDataBytes.IsValidUnlockCode(unlockCode))             //Verify that code made it into db.
     {
         MsgBox.Show(this, "Unlock code invalid.");
         return;
     }
     SetFormLocked(unlockCode);
 }
Exemple #2
0
        ///<summary>Once we have a valid Unlock Code in the DB we check to see if the Unlock Code has been used yet.
        ///Once it has we close the form.</summary>
        private void UnlockCodeTimer_Tick(object sender, EventArgs e)
        {
            string unlockCode = GetUiUnlockCode();

            if (_isFormLocked && !MobileDataBytes.IsValidUnlockCode(unlockCode))
            {
                _unlockCodeTimer.Stop();
                DialogResult = DialogResult.OK;
            }
        }