コード例 #1
0
        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)
            {
            }
        }
コード例 #2
0
ファイル: Competition.cs プロジェクト: Maasik/ax-toolbox
        public void ResetPilots()
        {
            Pilots.Clear();
            foreach (var p in Event.Instance.Pilots)
                Pilots.Add(p);

            RaisePropertyChanged("Pilots");
            RaisePropertyChanged("Status");
        }
コード例 #3
0
        public async Task Search()
        {
            Pilots.Clear();

            List <Pilot> tempPilots = await PilotService.GetAll();

            foreach (var item in tempPilots)
            {
                Pilots.Add(item);
            }
        }
コード例 #4
0
        protected void SearchAsync()
        {
            List <Pilot> temp = Pilots.ToList();

            Pilots.Clear();
            if (string.IsNullOrWhiteSpace(SearchFilter))
            {
                temp.Clear();
                UpdateDataAsync();
            }
            else
            {
                Pilots = new ObservableCollection <Pilot>(temp.Where(s => s.FirstName.StartsWith(SearchFilter, StringComparison.CurrentCultureIgnoreCase) ||
                                                                     s.LastName.StartsWith(SearchFilter, StringComparison.CurrentCultureIgnoreCase)).ToList());
            }
            RaisePropertyChanged(nameof(Pilots));
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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);
            }
        }