private void Load() { Instance = this; timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 2); timer.IsEnabled = true; timer.Tick += timer_Tick; timer.Start(); if (Properties.Settings.Default.UserDprcGovUaEmail != "" && Properties.Settings.Default.UserDprcGovUaPassword != "") { //TODO MAIN WINDOW SHOWED MainWindow mainWindow = new MainWindow(); mainWindow.ShowDialog(); this.Close(); } else { _animation.Initialize(this); btnNextStep.Visibility = System.Windows.Visibility.Visible; // Slide loading controls SlideLoad(imageFly); SlideLoad(imageTrain); } }
private void dispatcherTimer_Tick(object sender, EventArgs e) { if (isRegisterLoad) { webBrowser1.Document.GetElementById("register_form").Focus(); isRegisterLoad = false; //Check for validate registration form if (webBrowser1.Url.Equals(new Uri("https://dprc.gov.ua/register.php")) && webBrowser1.Document.GetElementById("aggr_error") == null && webBrowser1.Document.GetElementById("email_error") == null && webBrowser1.Document.GetElementById("pwd_error") == null && webBrowser1.Document.GetElementById("phone_error") == null && webBrowser1.Document.GetElementById("cap_error") == null) { System.Windows.MessageBox.Show("На указанную почту отправлено сообщение для подтверждения регистрации. Пожалуйста подтвердите регистрацию.", "Information", MessageBoxButton.OK, MessageBoxImage.Information); AuthQuestionWindow authQuestionWindow = new AuthQuestionWindow(); authQuestionWindow.ShowDialog(); this.Close(); } //USED FOR PRINT SCREEN CAPTCHA MAYBE HELP IN TODO //Rectangle bounds = Screen.GetBounds(Point.Empty); //Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height); //using (Graphics g = Graphics.FromImage(bitmap)) //{ // g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size); //} //Bitmap captcha = CopyBitmap(bitmap, new Rectangle(573,410,133,40)); //RegistrationWindow registrationWindow = new RegistrationWindow(captcha); //registrationWindow.Show(); //dispatcherTimer.Stop(); //this.Close(); } }