protected override async void OnNavigatedTo(NavigationEventArgs e) { var result = await Service.GetAll(); result.ForEach(x => Pilots.Add(x)); lastId = Pilots.LastOrDefault().Id; }
public async void Delete(object sender, RoutedEventArgs e) { if (SaveButton.Visibility == Visibility.Visible) { SaveButton.Visibility = Visibility.Collapsed; } if (AddButton.Visibility == Visibility.Visible) { AddButton.Visibility = Visibility.Collapsed; } try { if (TextId.IsReadOnly) { TextId.IsReadOnly = false; } await _service.Delete(SelectedPilot.Id.ToString()); // refresh listView Pilots.Clear(); foreach (var airplaneType in await _service.LoadData()) { Pilots.Add(airplaneType); } } catch (Exception) { } }
private async void BtnCreate_OnClick(object sender, RoutedEventArgs e) { Canvas.Visibility = Visibility.Collapsed; if (isCreate) { var pilot = ReadTextBoxesData(); if (pilot != null) { try { await Service.Create(pilot); } catch { Info.Text = "Server error!"; } lastId++; pilot.Id = lastId; Pilots.Add(pilot); isCreate = false; CreateInfo(); Info.Text = "Choose new action!"; } } else { CreateInfo(); isCreate = true; Info.Text = "Info : Input data and press 'Create' "; } }
private void ImportPilot(string[] record) { if (Competitions.Count() == 0) { throw new InvalidOperationException("Pilot import is not allowed when no competitions are defined"); } var number = int.Parse(record[1]); Pilot pilot; if (Pilots.Any(p => p.Number == number)) { pilot = Pilots.First(p => p.Number == number); } else { if (Tasks.Count() > 0) { throw new InvalidOperationException("Cannot add pilots when there are tasks defined"); } pilot = new Pilot() { Number = number }; Pilots.Add(pilot); } pilot.Name = record[2].Trim(); pilot.Country = (record.Length > 3) ? record[3].Trim() : ""; pilot.Balloon = (record.Length > 4) ? record[4].Trim() : ""; }
private async void Create() { var created = await airportConnector.PilotEndpoint.Create(newPilot); Pilots.Add(created); newPilot = new Pilot(); RaisePropertyChanged(() => Pilots); RaisePropertyChanged(() => NewPilot); }
public void ResetPilots() { Pilots.Clear(); foreach (var p in Event.Instance.Pilots) Pilots.Add(p); RaisePropertyChanged("Pilots"); RaisePropertyChanged("Status"); }
private async void FillPilotsCollection() { var temp = await service.GetEntities(); foreach (var item in temp) { Pilots.Add(item); } }
private void extractIds() { foreach (Uri filmUri in FilmUris) { Films.Add(extractId(filmUri)); } foreach (Uri pilotUri in PilotUris) { Pilots.Add(extractId(pilotUri)); } }
public async Task Search() { Pilots.Clear(); List <Pilot> tempPilots = await PilotService.GetAll(); foreach (var item in tempPilots) { Pilots.Add(item); } }
private async void FillAdditionalCollections() { var pilots = await pilotService.GetEntities(); foreach (var item in pilots) { Pilots.Add(item); } var stewardesses = await stewardessService.GetEntities(); foreach (var item in stewardesses) { Stewardesses.Add(item); } }
public async void LoadData(object sender, RoutedEventArgs e) { if (SaveButton.Visibility == Visibility.Visible) { SaveButton.Visibility = Visibility.Collapsed; } if (AddButton.Visibility == Visibility.Visible) { AddButton.Visibility = Visibility.Collapsed; } Pilots.Clear(); foreach (var airplaneType in await _service.LoadData()) { Pilots.Add(airplaneType); } }
public async void Add(object sender, RoutedEventArgs e) { SelectedPilot.Id = 0; SelectedPilot.FirstName = TextFirstName.Text; SelectedPilot.LastName = TextLastName.Text; SelectedPilot.Birthdate = DateTime.Parse(TextBirthdate.Text); SelectedPilot.Experience = int.Parse(TextExperience.Text); await _service.Create(SelectedPilot); AddButton.Visibility = Visibility.Collapsed; TextId.IsReadOnly = false; // refresh listView Pilots.Clear(); foreach (var airplaneType in await _service.LoadData()) { Pilots.Add(airplaneType); } }
public bool AddPilot(IPilot pilot) { Pilots.Add(pilot.Id, pilot); NotifySquadronChanges(); return(true); }
private async void LoadPilots() { var result = await PilotService.GetAll(); result.ForEach(x => Pilots.Add(x)); }