コード例 #1
0
        private void AddAnimatedMovieButton_Click(object sender, RoutedEventArgs e)
        {
            string animationStudioUserInput = txtBoxAnimationStudio.Text;
            string animationTypeUserInput   = txtBoxAnimationType.Text;

            AnimatedMovie animatedMovie = new AnimatedMovie("New Movie", DateTime.Now, animationStudioUserInput, animationTypeUserInput);

            MovieList.Add(animatedMovie);


            //clear original fields
            txtBoxAnimationStudio.Clear();
            txtBoxAnimationType.Clear();
        }
コード例 #2
0
        private void AddAnimationBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Convert.ToInt32(releaseYearInput.Text);
            }
            catch
            {
                MessageBox.Show("Please enter a valid year.");
                return;
            }
            AnimatedMovie movieToAdd = new AnimatedMovie(titleInput.Text, Convert.ToInt32(releaseYearInput.Text), AnimationStudioData.Text, AnimationTypeData.Text);

            MovieList.Add(movieToAdd);

            titleInput.Clear();
            releaseYearInput.Clear();
            AnimationStudioData.Clear();
            AnimationTypeData.Clear();
        }