public void AddShow_Executed(object sender) { TimeSpan ts = new TimeSpan(10, 0, 0); Button btn = sender as Button; int row = Grid.GetRow(btn); int day = Grid.GetColumn(btn); for (int i = 0; i < row; i++) { ts = ts.Add(new TimeSpan(0, 30, 0)); } Show show = new Show(); show.Movie = Movies[ActiveMovie - 1]; show.MovieId = show.Movie.Id; show.StartTime = ts; show.EndTime = ts.Add(new TimeSpan(0, show.Movie.Length, 0)); show.ShowDate = _currentDate.AddDays(day); show.Hall = int.Parse(_halls[ActiveHall]); ShowsToAdd.Add(show); GenerateTable(null, null); }
// OBSERVER METHODE #region observer public void Update(Type t) { if (t == typeof(Movie)) { var _actualMovies = _db.GetObjects <Movie>(); Movies.Clear(); foreach (var movie in _actualMovies) { Movies.Add(movie); } } else if (t == typeof(Show)) { var _actualShows = _db.GetObjects <Show>(); ShowsToAdd.Clear(); foreach (var show in _actualShows) { ShowsToAdd.Add(show); } } }