Пример #1
0
        public void LetterCancel()
        {
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                Window w = WindowSwitcher.GetActiveWindow();

                if (WindowInBlacklist(w, abort_blacklist))
                {
                    return;
                }

                WindowSwitcher.OpenClosing();
                WindowSwitcher.Closing.Show();
                User.inputBlocked = true;
                User.ClearUser();

                Thread thread = new Thread(() =>
                {
                    Thread.Sleep(2000);

                    Application.Current.Dispatcher.Invoke(new Action(() =>
                    {
                        WindowSwitcher.ResetUserState();
                        User.inputBlocked = false;
                    }));
                });
                thread.Start();
            }));
        }
Пример #2
0
        public void LetterBack()
        {
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                Window w = WindowSwitcher.GetActiveWindow();

                if (WindowInBlacklist(w, back_blacklist))
                {
                    return;
                }

                if (w != null)
                {
                    w.Close();
                }
            }));
        }
Пример #3
0
        private void TagHandler(string tag)
        {
            if (User.GetTag().Length != 0)
            {
                if (User.GetTag().Equals(tag))
                {
                    InputHandler("TAG CHECK OK");
                }
                Console.WriteLine("SAME TAG PRESENTED");

                Application.Current.Dispatcher.Invoke(new Action(() => {
                    if (WindowSwitcher.GetActiveWindow().Title.Equals("MainWindow"))
                    {
                        User.SetTag("");
                    }
                }));
                return;
            }

            User.SetTag(tag);
            Console.WriteLine("TAG: " + tag);

            JObject json = new WebHandler().GetCardValid();

            if (json.GetValue("error") != null)
            {
                Console.WriteLine("Connection error!");
                Application.Current.Dispatcher.Invoke(new Action(() => {
                    new NoNetwork().Show();
                }));

                return;
            }


            Boolean cardExists = (Boolean)json.GetValue("exists");

            if (!cardExists)
            {
                User.SetError("Deze kaart komt niet voor in onze database");
                WindowSwitcher.OpenErrorOccurredWindow();
                User.SetTag("");
                return;
            }

            WindowSwitcher.OpenPinWindow();

            int tries = (int)json.GetValue("tries");

            if (tries == 3)
            {
                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    WindowSwitcher.PinWindow.ERROR.Content    = "Uw pas is geblokeerd, neem zo snel mogelijk contact op";
                    WindowSwitcher.PinWindow.ERROR.Visibility = Visibility.Visible;
                    User.inputBlocked = true;
                }));


                Thread thread = new Thread(() =>
                {
                    Thread.Sleep(5000);
                    WindowSwitcher.OpenThanksGoodbyeWindow();
                });
                //thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }

            else if (tries != 0)
            {
                UpdateTries(3 - tries);
            }
        }