Ejemplo n.º 1
0
 public void Add(Staffel staffel)
 {
     RepositoryLines.Add(new RepositoryLine()
     {
         Staffel = staffel
     });
 }
Ejemplo n.º 2
0
        private void EditFolge(Folge Current)
        {
            FolgeEdit Edit = new FolgeEdit((Folge)Current.Clone());

            if ((bool)Edit.ShowDialog())
            {
                Staffel CurrentStaffel = (Staffel)cbStaffeln.SelectedItem;
                CurrentStaffel.Folgen.Replace(Current, (Folge)Edit.Return);
            }
        }
Ejemplo n.º 3
0
        private void RemoveFolge(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement CurrentSender = (FrameworkElement)sender;
            Folge            CurrentFolge  = (Folge)CurrentSender.Tag;

            if (MessageBox.Show("Wirklich löschen?", "Löschen?", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                Staffel CurrentStaffel = (Staffel)cbStaffeln.SelectedItem;
                CurrentStaffel.Folgen.Remove(CurrentFolge);
            }
        }
Ejemplo n.º 4
0
 public void Remove(Staffel staffel)
 {
     foreach (var item in RepositoryLines.ToArray())
     {
         if (item.Staffel == staffel)
         {
             RepositoryLines.Remove(item);
             return;
         }
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Lädt die Serie mit allen Staffeln und allen Folgen
        /// </summary>
        /// <param name="ShowID"></param>
        /// <param name="AddEmptySeasons"></param>
        /// <returns></returns>
        public Serie LoadSeries(int ShowID, bool AddEmptySeasons)
        {
            TvShow ApiShow = Client.GetTvShow(ShowID);

            Serie Show = new Serie(ApiShow.Name);

            foreach (TvSeason ApiSeason in ApiShow.Seasons)
            {
                Staffel Season = this.LoadStaffel(ShowID, ApiSeason.SeasonNumber);
                if ((!AddEmptySeasons && Season.Folgen.Count > 0) || AddEmptySeasons)
                {
                    Show.Staffeln.Add(Season);
                }
            }

            return(Show);
        }
Ejemplo n.º 6
0
        private void EditStaffel(object sender, RoutedEventArgs e)
        {
            try {
                Staffel Current = (Staffel)cbStaffeln.SelectedItem;

                StaffelEdit Edit = new StaffelEdit((Staffel)Current.Clone());
                if ((bool)Edit.ShowDialog())
                {
                    int Selected = this.cbStaffeln.SelectedIndex;
                    ((ObservableCollection <Staffel>) this.cbStaffeln.ItemsSource).Replace(Current, (Staffel)Edit.Return);
                    this.cbStaffeln.SelectedIndex = Selected;
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message, "Staffel bearbeiten nicht möglich.");
            }
        }
Ejemplo n.º 7
0
        public void Add(Staffel staffel, params Host[] hosts)
        {
            foreach (var item in RepositoryLines)
            {
                if (item.Staffel == staffel)
                {
                    item.Hosts.AddRange(hosts);
                    return;
                }
            }
            var rl = new RepositoryLine()
            {
                Staffel = staffel
            };

            rl.Hosts.AddRange(hosts);
            RepositoryLines.Add(rl);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Lädt die Staffel mit allen Folgen
        /// </summary>
        /// <param name="SerienID"></param>
        /// <param name="StaffelNummer"></param>
        /// <returns></returns>
        public Staffel LoadStaffel(int SerienID, int StaffelNummer)
        {
            if (SerienID < 1)
            {
                throw new ArgumentException();
            }

            if (StaffelNummer < 0)
            {
                throw new ArgumentException();
            }

            TvSeason ApiSeason = Client.GetTvSeason(SerienID, StaffelNummer, TvSeasonMethods.Undefined, CultureInfo.CurrentCulture.TwoLetterISOLanguageName);

            Staffel Season = new Staffel(ApiSeason.SeasonNumber, null, ApiSeason.Name);

            foreach (TvEpisode Episode in ApiSeason.Episodes)
            {
                Season.Folgen.Add(new Folge(Episode.EpisodeNumber, false, null, Episode.Name));
            }

            return(Season);
        }
Ejemplo n.º 9
0
        private void SearchFolgenVerpasst(object sender, RoutedEventArgs e)
        {
            Staffel CurrentStaffel = (Staffel)cbStaffeln.SelectedItem;

            int NummerNeu = CurrentStaffel.Folgen.NummerNeueFolge();

            IEnumerable <int> Lücken = new int[0];

            if (NummerNeu > 1)
            {
                FromTo FT = new FromTo(1, NummerNeu - 1);
                Lücken = FT.Generate().Where(Current => !CurrentStaffel.Folgen.Select(InnerCurrent => InnerCurrent.Nummer).Contains(Current));
            }

            if (Lücken.Count() > 0)
            {
                MessageBox.Show(string.Join(", ", Lücken), "Verpasste Folgen", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                MessageBox.Show("Keine verpassten Folgen!", string.Empty, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
            }
        }
Ejemplo n.º 10
0
 public StaffelEdit(Staffel Current = null)
 {
     InitializeComponent();
     this.DataContext = Current;
 }
Ejemplo n.º 11
0
        private void AddNeueFolge(int AddDays)
        {
            if (this.ZuletztGesehenStaffel == null) {
                Staffel St = new Staffel(1);
                St.Folgen.Add(new Folge(1, new DateTime[] { DateTime.Today.AddDays(AddDays) }));
                this.Staffeln.Add(St);
            }
            else {
                this.ZuletztGesehenStaffel.Folgen.Add(new Folge(this.ZuletztGesehenFolge.Nummer + 1, new DateTime[] { DateTime.Today.AddDays(AddDays) }));
            }

            this.OnPropertyChanged("Staffeln");
            this.OnPropertyChanged("ZuletztGesehenStaffel");
            this.OnPropertyChanged("ZuletztGesehenFolge");
        }
Ejemplo n.º 12
0
 public StaffelEdit(Staffel Current = null)
 {
     InitializeComponent();
     this.DataContext = Current;
 }