Exemple #1
0
 public MovieActor(Movie m, Actor a, bool NoAdd)
 {
     if (NoAdd == true)
     {
         Movie = m;
         Actor = a;
     }
 }
        private void btnEditSelectedActor_Click(object sender, EventArgs e)
        {
            FormEditActorList.SelectedActor = (Actor)lbActorList.SelectedItem;
            new FormEditActor().ShowDialog();

            foreach (var k in Actor.Actors.Keys)
                if (Actor.Actors[k] == FormEditActorList.SelectedActor)
                {
                    Actor.Actors[k].Name = FormEditActorList.SelectedActor.Name;
                    Actor.Actors[k].BirthDate = FormEditActorList.SelectedActor.BirthDate;
                }
            RefreshlbActorList();
        }
        private void lbActorList_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int index = this.lbActorList.IndexFromPoint(e.Location);
            if (index != System.Windows.Forms.ListBox.NoMatches)
            {
                FormEditActorList.SelectedActor = (Actor)lbActorList.SelectedItem;
                new FormEditActor().ShowDialog();

                foreach (var k in Actor.Actors.Keys)
                    if (Actor.Actors[k] == FormEditActorList.SelectedActor)
                    {
                        Actor.Actors[k].Name = FormEditActorList.SelectedActor.Name;
                        Actor.Actors[k].BirthDate = FormEditActorList.SelectedActor.BirthDate;
                    }
                RefreshlbActorList();
            }
        }
Exemple #4
0
 public MovieActor(Movie m, Actor a)
 {
     Movie = m; Actor = a;
     MovieActors.Add(this);
 }
Exemple #5
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //DataContractSerializer xs = new DataContractSerializer(typeof(DataBase));
            //XmlReader xr = XmlReader.Create(@"DataBase.xml");
            //DataBase tmp = (DataBase)xs.ReadObject(xr);
            //xr.Close();

            new FormWelcome().ShowDialog();
            this.Size = new System.Drawing.Size(290, 426);
            Movie m1 = new Movie() { Title = "Друзья", ReleaseDate = new DateTime(1994, 09, 22), Language = "Английский", CountryOfOrigin = "США" };
            Movie m2 = new Movie() { Title = "Город хищниц", ReleaseDate = new DateTime(2009, 09, 23), Language = "Английский", CountryOfOrigin = "США" };
            Movie m3 = new Movie() { Title = "Как я встретил вашу маму", ReleaseDate = new DateTime(2005, 09, 19), Language = "Английский", CountryOfOrigin = "США" };
            Movie m4 = new Movie() { Title = "Баффи — истребительница вампиров", ReleaseDate = new DateTime(1997, 03, 10), Language = "Английский", CountryOfOrigin = "США" };

            Actor a1 = new Actor() { Name = "Дженнифер Энистон", BirthDate = new DateTime(1969, 02, 11) };
            Actor a2 = new Actor() { Name = "Кортни Кокс", BirthDate = new DateTime(1964, 06, 15) };
            Actor a3 = new Actor() { Name = "Бизи Филиппс", BirthDate = new DateTime(1979, 06, 25) };
            Actor a4 = new Actor() { Name = "Нил Патрик Харрис", BirthDate = new DateTime(1973, 06, 15) };
            Actor a5 = new Actor() { Name = "Дэвид Швиммер", BirthDate = new DateTime(1966, 11, 02) };
            Actor a6 = new Actor() { Name = "Элисон Ханниган", BirthDate = new DateTime(1974, 03, 24) };
            Actor a7 = new Actor() { Name = "Сара Мишель Геллар", BirthDate = new DateTime(1977, 04, 14) };

            MovieActor ma1 = new MovieActor(m1, a1);
            MovieActor ma2 = new MovieActor(m1, a2);
            MovieActor ma3 = new MovieActor(m2, a2);
            MovieActor ma4 = new MovieActor(m2, a3);
            MovieActor ma5 = new MovieActor(m3, a3);
            MovieActor ma6 = new MovieActor(m3, a4);
            MovieActor ma7 = new MovieActor(m1, a5);
            MovieActor ma8 = new MovieActor(m3, a6);
            MovieActor ma9 = new MovieActor(m4, a6);
            MovieActor ma10 = new MovieActor(m4, a7);

            Country c1 = new Country() {Name = "США"};

            lbMovies.DataSource = Movie.Movies.Values.ToList();
            lbActors.DataSource = Actor.Actors.Values.ToList();

            if (authenticated == false) Application.Exit();

            //SerializeMovie(m1);

            //DataContractSerializer xs = new DataContractSerializer(typeof(Movie));
            //XmlReader xr = XmlReader.Create(@"F:\XmlFile.xml");
            //Movie tmp = (Movie)xs.ReadObject(xr);
            //xr.Close();
        }