예제 #1
0
 public void RemoveStation(int station)
 {
     App.Current.Dispatcher.Invoke(() =>
     {
         var StationToRemove = Stations.Where(s => s.StationNumber == station).FirstOrDefault();
         if (StationToRemove != null)
         {
             Stations.Remove(StationToRemove);
         }
     });
 }
예제 #2
0
        public async Task DeleteStationAsync(RadioStation station)
        {
            var songs = Songs.Where(p => p.RadioId == station.Id);

            foreach (var song in songs)
            {
                await DeleteSongAsync(song);
            }

            await _sqlService.DeleteItemAsync(station);

            Stations.Remove(station);
        }
예제 #3
0
        public override void Delete()
        {
            base.Delete();

            if (Chest1 != null && !Chest1.Deleted)
            {
                Chest1.Delete();
            }

            if (Chest2 != null && !Chest2.Deleted)
            {
                Chest2.Delete();
            }

            if (Stations != null && Stations.Contains(this))
            {
                Stations.Remove(this);
            }
        }
예제 #4
0
        public void Del()
        {
            switch (CurrentOption)
            {
            case Options.Station:
                Stations.Remove(SelectedItemStation);
                CountLine = Stations.Count;
                break;

            case Options.OperativeSchedule:
                OperativeSchedules.Remove(SelectedItemOperativeSchedule);
                CountLine = OperativeSchedules.Count;
                break;

            case Options.RegulatorySchedule:
                RegulatorySchedules.Remove(SelectedItemRegulatorySchedule);
                CountLine = RegulatorySchedules.Count;
                break;
            }
        }
        private async Task UpdateList(RecordChangedEventArgs <Station> e)
        {
            await Task.Delay(1);

            if (e.ChangeType == ChangeType.None)
            {
                return;
            }

            if (e.ChangeType == ChangeType.Delete)
            {
                var s = Stations.FirstOrDefault(c => c.Model.StationId == e.Entity.StationId);
                if (s == null)
                {
                    return;
                }

                Stations.Remove(s);
            }
            if (e.ChangeType == ChangeType.Insert)
            {
                if (Stations.Contains(new StationModel(e.Entity, _repository)))
                {
                    return;
                }
                Stations.Add(new StationModel(e.Entity, _repository));
            }
            if (e.ChangeType == ChangeType.Update)
            {
                var s = Stations.FirstOrDefault(c => c.Model.StationId == e.Entity.StationId);
                if (s == null)
                {
                    return;
                }
                var i = Stations.IndexOf(s);
                Stations.Remove(s);
                Stations.Insert(i, new StationModel(e.Entity, _repository));
            }
        }
예제 #6
0
        public bool Remove(Station station) //remove station
        {
            if (station == null)
            {
                throw new ArgumentNullException("station");
            }
            if (station.StationName == "")
            {
                throw new ArgumentException("station");
            }

            Station s = FindStation(station.StationName);

            if (s != null)
            {
                Stations.Remove(s); //remove from list
                if (OnStationUpdate != null)
                {
                    OnStationUpdate(this, s, false);
                }
                return(true);
            }
            return(false);
        }