private async Task LoadEmployeePickerSource() { await repoEmployee.ReadAsync(); EmployeeSource.Clear(); foreach (var item in repoEmployee.Items) { EmployeeSource.Add(item.Name); } }
private void ReloadDataGrid() { var selectedIndex = EmployeeDataGrid.SelectedIndex; EmployeeSource.Clear(); foreach (var employee in Employee.GetEmployees()) { EmployeeSource.Add(employee); } EmployeeDataGrid.SelectedIndex = selectedIndex; }
private void ReloadDataGrid() { var text = SearchTextBox.Text == DefaultText ? "" : SearchTextBox.Text; var selectionId = EmployeeDataGrid.SelectedIndex; EmployeeSource.Clear(); foreach (var employee in Employee.GetEmployees(name: text)) { EmployeeSource.Add(employee); } EmployeeDataGrid.SelectedIndex = EmployeeDataGrid.Items.Count > selectionId ? selectionId : EmployeeDataGrid.Items.Count - 1; }
public ContactPageViewModel_del(INavigationService navigationService) { _navigationService = navigationService; DepartmentSelectedCommand = new DelegateCommand(async() => { var fooBackup = EmployeeSelectedItem; // 變更到最新的 Picker2 的可選取清單 await LoadEmployeePickerSource();//repoEmployee.GetAsync(DepartmentSelectedItem); if (EmployeeSource.Contains(fooBackup)) { await Task.Delay(100); EmployeeSelectedItem = EmployeeSource.FirstOrDefault(x => x == fooBackup); } }); }
static async Task Main(string[] args) { if (args.Length != 1 || string.IsNullOrEmpty(args[0])) { Console.WriteLine("Please supply the connection string as the only argument. Press enter to quit"); Console.ReadKey(); return; } var connectionString = args[0]; Console.WriteLine($"Initializing Database! {connectionString}"); var source = new EmployeeSource(new System.Net.Http.HttpClient() { BaseAddress = new Uri("https://randomuser.me") }); var tb = new TableBuilder(connectionString); var ec = new EmployeeCommands(connectionString); var bootstrapper = new DBBootstrapper(tb, ec, source); await bootstrapper.Initialize(); Console.WriteLine($"Initialized Database! {connectionString}"); }