コード例 #1
0
        void FillFilmsButton()
        {
            FilmInfo filmInfo = filmController.GetFilmById(currFilmId);

            LabelZal.Content      = filmInfo.Zal;
            LabelDate.Content     = filmInfo.Time.ToShortDateString() + " " + filmInfo.Time.ToShortTimeString();
            LabelFilmName.Content = filmInfo.Name;

            for (int i = 0; i < filmInfo.places.Length; ++i)
            {
                for (int j = 0; j < filmInfo.places[i].Length; ++j)
                {
                    places[i][j].Background = filmInfo.places[i][j].isFree ?(i >= 4? Brushes.BlueViolet : Brushes.Aqua) : Brushes.Red;
                }
            }

            ImageTicket.Source = null;
            Place.Content      = Row.Content = Film.Content = Zal.Content = Date.Content = Price.Content = "";

            var films = filmController.GetFilmsArray(currFilmId - 1, 3);

            FilmBtn1.Content = new Image {
                Source  = new BitmapImage(new Uri(films[0].ImageSrc, UriKind.Relative)),
                Stretch = Stretch.Fill
            };
            FilmBtn2.Content = new Image {
                Source  = new BitmapImage(new Uri(films[1].ImageSrc, UriKind.Relative)),
                Stretch = Stretch.Fill
            };
            FilmBtn3.Content = new Image {
                Source  = new BitmapImage(new Uri(films[2].ImageSrc, UriKind.Relative)),
                Stretch = Stretch.Fill
            };
        }
コード例 #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string[] b = (e.Source as Button).Content.ToString().Split('/');
            Row.Content   = b[0];
            Place.Content = b[1];

            FilmInfo filmInfo = filmController.GetFilmById(currFilmId);

            Film.Content       = filmInfo.Name;
            Zal.Content        = filmInfo.Zal;
            Date.Content       = filmInfo.Time.ToShortDateString() + " " + filmInfo.Time.ToShortTimeString();
            Price.Content      = filmInfo.GetPriceByPlace(int.Parse(b[0]) - 1, int.Parse(b[1]) - 1);
            ImageTicket.Source = new BitmapImage(new Uri(filmInfo.ImageSrc, UriKind.Relative));
        }
コード例 #3
0
 private void BuyTicket(object sender, RoutedEventArgs e)
 {
     if (Place.Content != "" && Row.Content != "")
     {
         int row = int.Parse(Row.Content as string) - 1, col = int.Parse(Place.Content as string) - 1;
         if (Brushes.Red != places[row][col].Background)
         {
             FilmInfo filmInfo = filmController.GetFilmById(currFilmId);
             filmInfo.places[row][col].isFree = false;
             places[row][col].Background      = Brushes.Red;
             DisplayTicket();
         }
         else
         {
             MessageBox.Show("Це місце вже занято.\nВиберіть інше.", "Увага!", MessageBoxButton.OK, MessageBoxImage.Exclamation, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly);
         }
     }
 }
コード例 #4
0
ファイル: FilmController.cs プロジェクト: Team-on/works
        public FilmInfo[] GetFilmsArray(int idFirst, int length)
        {
            FilmInfo[] rez   = new FilmInfo[length];
            int        i     = 0;
            int        shift = 0;

            if (idFirst == -1)
            {
                idFirst = 0;
                shift   = 1;
                rez[0]  = filmInfo[filmInfo.Count - 1];
            }

            for (; i + shift < length; ++i)
            {
                rez[i + shift] = filmInfo[(i + idFirst) % filmInfo.Count];
            }
            return(rez);
        }
コード例 #5
0
ファイル: FilmController.cs プロジェクト: Team-on/works
 public void AddFilm(FilmInfo film) => filmInfo.Add(film);