示例#1
0
        public AddUpdateMovieForm(Movie movie, ActorDirectorGetter actorDirectorGetter,
                                  LocationGetter locationGetter, MovieAdder movieAdder)
        {
            InitializeComponent();

            _isInitialising      = true;
            _movie               = movie;
            _actorDirectorGetter = actorDirectorGetter;
            _locationGetter      = locationGetter;
            _movieAdder          = movieAdder;

            movieBindingSource.DataSource = _movie;
            actorBindingSource.DataSource =
                _actorDirectorGetter.GetListForAddUpdateMovie();
            directorBindingSource.DataSource =
                _actorDirectorGetter.GetListForAddUpdateMovie(isForDirectors: true);
            locationBindingSource.DataSource =
                _locationGetter.GetList();

            if (_movie.IsNew)
            {
                Text = "Add Movie";
            }
            else
            {
                Text = _movie.Title;
                submitButton.Text = "OK";
                closeButton.Text  = "Cancel";

                SelectCorrectActor();
                SelectCorrectDirector();
                SelectCorrectLocation();
            }
            _isInitialising = false;
        }
示例#2
0
        public MainForm()
        {
            //TODO Add a splash screen while loading all this stuff (it could take a while
            //     with lots of actors, directors, or locations)
            //TODO Add an icon for the application and all resizable forms
            //TODO Implement sorting on all grids
            //TODO Move Domain and Models into their own assembly (MovieCollectionLib), so we
            //     can have multiple types of clients all using it
            //TODO Add linking table between Movie and Actor, so we can have multiple actors
            //     per movie, and update UI and all code to support this
            //TODO Make LocationsForm and ActorsDirectorsForm single instance
            Cursor          = Cursors.WaitCursor;
            _isInitialising = true;
            InitializeComponent();
            _actorDirectorGetter = new ActorDirectorGetter();
            _locationGetter      = new LocationGetter();
            _movieResultGetter   = new MovieResultGetter();
            _movieGetter         = new MovieGetter();
            _movieAdder          = new MovieAdder();

            RefreshActors();
            RefreshDirectors();
            RefreshLocations();
            _isInitialising = false;
            DoFilter(); //This will set the cursor back to default
        }