private void Window_Loaded(object sender, RoutedEventArgs e) { try { string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString(); int i = username.IndexOf(@"\"); if (i != -1) { username = username.Substring(i + 1, username.Length - i - 1); } txtUsername.Text = username; AppConfig appConfig = new AppConfig(Constants.GetConfigFilePath()); contactManagement = new ContactManagement.ActiveDirectory.ContactManagement(Constants.GetADDomain()); contact = contactManagement.GetUserProfile(username); contact.Username = username; txtHomePhone.Text = contact.HomePhone; txtMobilePhone.Text = contact.MobilePhone; txtBusinessPhone.Text = contact.BusinessPhone; txtBusinessFax.Text = contact.BusinessFax; txtEmail.Text = contact.Email; txtAddress.Text = contact.Address; txtIPPhone.Text = contact.IPPhone; } catch (Exception ex) { MessageBox.Show(ex.Message); } }