Exemple #1
0
        private async void SelectedLocations_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            try
            {
                SelectedLocations.CollectionChanged -= SelectedLocations_CollectionChanged;

                if (e.NewItems != null)
                {
                    foreach (Location newItem in e.NewItems)
                    {
                        SelectedLocations.Add(newItem);
                        await _settingsService.AddLocationAsync(newItem);
                    }
                }

                if (e.OldItems != null)
                {
                    foreach (Location oldtem in e.OldItems)
                    {
                        SelectedLocations.Remove(oldtem);
                        await _settingsService.RemoveLocationAsync(oldtem);
                    }
                }

                SelectedLocations.CollectionChanged += SelectedLocations_CollectionChanged;
            }
            catch (Exception exeption)
            {
                _loggingService?.WriteError(exeption);
            }
        }
Exemple #2
0
        private void OnSelectedLocationDoubleClickCommand()
        {
            var location = SelectedSelectedLocation;

            if (location == null)
            {
                return;
            }
            SelectedLocations.Remove(location);
            NotSelectedLocations.Add(location);
            RaisePropertyChanged(() => SelectedLocations);
            RaisePropertyChanged(() => NotSelectedLocations);
        }