private SubPage SwitchStart4User()
        {
            SubPage sp = new SubPage();

            switch (Acumulator.Instance().HuidigGebruiker.Rol)
            {
            case UserRole.Admin:
                sp.Titel = "Kies Project en Bouwnummer";
                sp.Addcontrol(new InputBouwNr(Acumulator.Instance().HuidigGebruiker.Rol));
                NewUserBtn.Visibility   = Visibility.Visible;
                SwitchBnrBtn.Visibility = Visibility.Visible;
                AfspraakBtn.Visibility  = Visibility.Visible;
                break;

            case UserRole.Showroom:
            case UserRole.Demo:
            case UserRole.Adviseur:
                sp.Titel = "Kies Bouwnummer";
                sp.Addcontrol(new InputBouwNr(Acumulator.Instance().HuidigGebruiker.Rol));
                SwitchBnrBtn.Visibility = Visibility.Visible;
                AfspraakBtn.Visibility  = Visibility.Visible;
                break;

            case UserRole.Bewoner:
                var ctx = new eBrochureDomainContext();
                Acumulator.Instance().ctx = ctx;
                ctx.Load(ctx.GetGebruikersQuery()).Completed += (sender, args) =>
                {
                    ctx.Load(ctx.GetBouwnummerSetOpbouwQuery()).Completed += (sender2, args2) =>
                    {
                        ctx.Load(ctx.GetBouwnummersQuery()).Completed += (sender3, args3) =>
                        {
                            var bnr = (from b in ctx.BouwnummerSetOpbouws
                                       join g in ctx.Gebruikers on b.BouwnummerSet_NR equals g.BouwnummerSet_NR
                                       join baseb in ctx.Bouwnummers on b.Bouwnummer_NR equals baseb.B_ID
                                       where g.Naam.ToLower() == Acumulator.Instance().GebruikersNaam.ToLower()
                                       select new { b.Bouwnummer_NR, baseb.PR_NR }).FirstOrDefault();
                            Acumulator.Instance().Bouwnr    = bnr.Bouwnummer_NR;
                            Acumulator.Instance().Projectnr = bnr.PR_NR;
                            BB.GeenInputBouwnummer();
                        };
                    };
                };
                AfspraakBtn.Visibility = Visibility.Visible;
                break;
            }
            return(sp);
        }
 private void HandleCompletionEvent(object sender, EventArgs e)
 {
     try
     {
         if (_op.HasError)
         {
             MessageBox.Show(_op.Error.Message.ToString());
             this.DialogResult = false;
             LogHelper.SendLog("Login Failed: " + _op.Error.Message.ToString(), LogType.error);
         }
         else if (_op.User != null && _op.User.Identity.IsAuthenticated)
         {
             eBrochureDomainContext ctx = new eBrochureDomainContext();
             ctx.Load(ctx.GetGebruikersQuery()).Completed += (args, sender0) =>
             {
                 var gebr = (from g in ctx.Gebruikers
                             where g.Naam.ToLower() == NaamBox.Text.ToLower()
                             select new LoggedInUser()
                 {
                     GebruikersNaam = g.Naam, Rol = (UserRole)g.Rol_NR, ID = g.GebruikersID
                 }).FirstOrDefault();
                 Acumulator.Instance().HuidigGebruiker = gebr;
                 this.DialogResult = true;
                 LogHelper.SendLog("Login by User: "******" - " + gebr.Rol.ToString(), LogType.activity);
                 LogHelper.SendLog("Site accessed from: " + Application.Current.Resources["ClientIP"] + " by user: "******"Login Failed", LogType.error);
             this.DialogResult = false;
         }
         this._op         = null;
         BusyIndie.IsBusy = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Handle Complete Catched: " + ex.Message);
     }
 }