Beispiel #1
0
        public HomePage()
        {
            InitializeComponent();
            scherm = (HomeWindow)Application.Current.MainWindow;
            menuBox.SelectionChanged += MenuBox_SelectionChanged;
            ServicePointManager.ServerCertificateValidationCallback += (send, certificate, chain, sslPolicyErrors) => { return(true); };
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;

            client.BaseAddress = new Uri(Adress.url);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
                "Basic",
                Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "basic_security", "2018"))));

            loadData();
        }
 public ChatboxPage()
 {
     InitializeComponent();
     scherm = (HomeWindow)Application.Current.MainWindow;
     menuBox.SelectionChanged += MenuBox_SelectionChanged;
     ServicePointManager.ServerCertificateValidationCallback += (send, certificate, chain, sslPolicyErrors) => { return(true); };
     ServicePointManager.Expect100Continue = true;
     ServicePointManager.SecurityProtocol  = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls;
     sendMessages.KeyDown += sendMessages_KeyDown;
     fetchTimer            = new DispatcherTimer();
     fetchTimer.Interval   = TimeSpan.FromSeconds(1);
     fetchTimer.Tick      += fetchTimer_Tick;
     counter            = 8;
     client.BaseAddress = new Uri(Adress.url);
     client.DefaultRequestHeaders.Accept.Clear();
     client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
     client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
         "Basic",
         Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", "basic_security", "2018"))));
     GetAllNames();
     chatterList.SelectionChanged += ComboBox_SelectionChangedAsync;
 }
        private async void Login()
        {
            loginButton.IsEnabled = false;
            messageLabel.Content  = "Velden controleren...";

            User user = await CheckUserAsync(emailBox.Text);


            if (user != null)
            {
                try
                {
                    var userUrl = "/api/users/login?username="******"&password="******"Verbinding met de server verbroken. Probeer later opnieuw.",
                                    "Serverfout", MessageBoxButton.OK, MessageBoxImage.Error);
                }



                if (user.accesToken != null)
                {
                    messageLabel.Content           = "Bezig met aanmelden...";
                    homeWindow                     = new HomeWindow(user);
                    Application.Current.MainWindow = homeWindow;
                    homeWindow.Owner               = Owner;
                    homeWindow.Show();
                    Close();
                }
                else
                {
                    errorBox.Content      = "Verkeerd paswoord of geen toegang!";
                    passwordBox.Password  = "";
                    messageLabel.Content  = "";
                    loginButton.IsEnabled = true;
                    attempts++;
                }
            }
            else
            {
                errorBox.Content      = "Email bestaat niet";
                messageLabel.Content  = "";
                loginButton.IsEnabled = true;
                attempts++;
            }

            if (!(attempts < (counter / 5 + 1)))
            {
                loginButton.IsEnabled = false;
                counter = attempts * 5;
                loginTimer.Start();
            }
            else
            {
                loginButton.IsEnabled = true;
            }
        }
Beispiel #4
0
 public SteganographyPage()
 {
     InitializeComponent();
     scherm = (HomeWindow)System.Windows.Application.Current.MainWindow;
 }