Esempio n. 1
0
        private void Schoof_button_Click(object sender, RoutedEventArgs e)
        {
            //new Tests().SchoofStatistics(20);
            bool leav = false;

            if (!CheckP())
            {
                leav = true;
            }
            if (!CheckAandB())
            {
                leav = true;
            }
            if (leav)
            {
                return;
            }
            this.warn_text_n.Visibility = Visibility.Hidden;
            BigInteger a = BigInteger.Parse(gen_textbox_a.value_textbox.Text);
            BigInteger b = BigInteger.Parse(gen_textbox_b.value_textbox.Text);
            BigInteger p = BigInteger.Parse(gen_textbox_p.value_textbox.Text);

            bw   = new BackgroundWorker();
            algo = new Schoof(1, a, b, p, bw);
            dt   = DateTime.Now;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork             += new DoWorkEventHandler(Bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Bw_RunWorkerCompleted);
            StartTimer();
            this.schoof_value.Text             = "";
            this.schoof_stop_button.Visibility = Visibility.Visible;
            bw.RunWorkerAsync();
        }
Esempio n. 2
0
        private void BeginRandomGeneration()
        {
            int        bits = Convert.ToInt32(this.complexity_rand_scheme.Text);
            Random     rnd  = new Random();
            BigInteger p    = Maths.genPseudoPrime(bits, rnd);

            gen_textbox_p.value_textbox.Text = p.ToString();
            BigInteger a = Maths.RandBigInteger(bits, rnd);

            gen_textbox_a.value_textbox.Text = a.ToString();
            BigInteger b = Maths.RandBigInteger(bits, rnd);

            gen_textbox_b.value_textbox.Text = b.ToString();
            bw   = new BackgroundWorker();
            algo = new Schoof(1, a, b, p, bw);
            bw.WorkerSupportsCancellation = true;
            bw.DoWork             += new DoWorkEventHandler(Bw_DoWork);
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Bw_RunWorkerCompletedRand);
            this.schoof_stop_button.Visibility = Visibility.Visible;
            this.schoof_value.Text             = "";
            bw.RunWorkerAsync();
        }
Esempio n. 3
0
 private void Iteration()
 {
     algo = new Schoof(1, a, b, primes[index], bw);
     bw.RunWorkerAsync();
 }