private async void ChatUserPopup2_Opened(object sender, EventArgs e) { OutOfOfficeStatus = string.Empty; if (User != null && !User.IsBot) { try { PART_OOOStatus.Visibility = Visibility.Collapsed; PART_OOORefresh.Visibility = Visibility.Visible; var employees = await EmployeeSearchHelper.GetAndoverEmployeesAsync(); var employee = employees.FirstOrDefault(emp => emp.NetworkLogon == User.Username); if (employee != null) { OutOfOfficeStatus = employee.OutOfOfficeStatus; } } finally { PART_OOOStatus.Visibility = Visibility.Visible; PART_OOORefresh.Visibility = Visibility.Collapsed; } } }
private void CommandBinding_Executed_2(object sender, ExecutedRoutedEventArgs e) { string[] names = NewUserText.Split(new char[] { ' ' }); IEnumerable <EmployeeSearchResult> result; try { Mouse.OverrideCursor = Cursors.Wait; result = EmployeeSearchHelper.FindEmployee(names[0], names[1]); } finally { Mouse.OverrideCursor = null; } if (result != null && result.Count() > 0) { string username = $"{result.First().FirstName} {result.First().LastName}"; if (_userList.Contains(username)) { HylandMedConfig.Windows.MedConfigMessageBox.ShowInfo("Employee is already in lisst"); } else { _userList.Add($"{result.First().FirstName} {result.First().LastName}"); NewUserText = string.Empty; } } else { HylandMedConfig.Windows.MedConfigMessageBox.ShowError("Could not find employee"); } }