Exemplo n.º 1
0
        /// <summary>
        /// Get number
        /// </summary>
        private async void BtnGetNumber_Click(object sender, EventArgs e)
        {
            //Initial Digit Set
            if (!DigitSet.DigitSetStatus)
            {
                await RunThread(PINThreadName.DigitInitial);
            }
            //Execute async thread
            int randomDigtit = await RunThread(PINThreadName.GetNumber);

            if (randomDigtit >= SystemConfiguration.MinDigit)
            {
                //get a valid PIN
                this.txtNumber.Text = randomDigtit.ToString();
                RefreshQuantity();
            }
            else
            {
                //Digit run out
                if (System.Windows.Forms.MessageBox.Show("All of the digits have been used. Do you want to reuse the preceding digits?\r\n\r\nIf you click \"Yes\", all of the used digits will be cleared , then the digits can be used again.\r\nIf you click \"No\" ,nothing will happen."
                                                         , "Infomation"
                                                         , MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    DigitSet.ExceptionSet.Clear(SystemConfiguration.ExceptionDigitDataSet);
                    DigitSet.UnusedSet.Clear(SystemConfiguration.UnusedDigitDataSet);
                    DigitSet.UsedSet.Clear(SystemConfiguration.UsedDigitDataSet);
                    DigitSet.SetReInitial();
                    this.BtnGetNumber_Click(sender, e);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// DigitSet must be initial first.
 /// </summary>
 /// <returns>initial is successful or not</returns>
 public override bool CheckParameter()
 {
     if (!DigitSet.DigitSetStatus)
     {
         DigitSet.Initial();
     }
     return(DigitSet.DigitSetStatus);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Execute Initial Function and Refresh quantity on the Mainform.
 /// </summary>
 /// <returns>it is not important</returns>
 public override int RunSubThread()
 {
     //judage if threading is cancelled.
     this.IsTaskCanceled();
     DigitSet.Initial();
     param.RefreshQuantityFunction();
     return(0);
 }