public MainWindow() { InitializeComponent(); this.DataConn = new Data.ConnectContainer(); if (debug) { this.WindowsCommandCollection.IsHitTestVisible = true; this.BlockingBackground.Visibility = Visibility.Collapsed; if (this.DataConn.Staffs.Count() > 0) { this.DataConn.Staffs.FirstOrDefault().Password = "******"; this.DataConn.SaveChanges(); } } this.Loaded += MainWindow_Loaded; }
private void Lg_LoginCompleted(object sender, EventArgs e) { //Login dialog instance Login.Login lg = (Login.Login)sender; //Disable the blocking border this.BlockingBackground.Visibility = Visibility.Collapsed; Grid G = (Grid)this.BlockingBackground.Parent; G.Children.Remove(BlockingBackground); //Close the dialog host this.DialogHost.Visibility = Visibility.Collapsed; this.DialogHost.IsOpen = false; //Create model this.DataConn = new Data.ConnectContainer(); //Logged in staff this.LoggedInStaff = lg.LoggedInStaff; this.StaffKey = this.LoggedInStaff.Key; //Get permission of current user this.Permission = this.DataConn.Permissions.Where(p => p.StaffKey == this.StaffKey).FirstOrDefault(); if (this.Permission != null) { this.CanManageUser = this.Permission.CanManageStaff; } //Enable the windows command button this.WindowsCommandCollection.IsHitTestVisible = true; //Create the view this.ProjectViewer.LoadTreeView(); this.ProjectViewer.LoadProjects(); }