Exemplo n.º 1
0
        public ImageViewer(IFilePathAdder filePathHandler, IImageDisplaySetter imageHandler)
        {
            // Base method call
            InitializeComponent();

            // Initiate the local '_filePathHandler', with the passed 'filePathHandler'
            _filePathHandler = filePathHandler;

            // Initiate the local '_imageHandler', with the passed 'imageHandler'
            _imageHandler = imageHandler;

            // Passed the 'PictureBox' to the 'imageHandler'
            _imageHandler.SetImageDisplay(imageBox);
        }
Exemplo n.º 2
0
        public Controller()
        {
            // INSTANTIATE '_model', with a new instance of Model
            _model = new Model();
            // INSTANTIATE '_fileHandler', with a new instance of FilePathHandler, pass it a reference to '_model'
            _fileHandler = new FilePathHandler(_model);
            // INSTANTIATE '_imageHandler', with a new instance of ImageHandler, pass it a reference to '_fileHandler' & '_model'
            _imageHandler = new ImageHandler(_fileHandler as IFilePathGetter, _model);

            /*
             * Run the application and pass it a reference to a new ImageViewer form.
             * Pass this ImageViewer a reference to the FilePathHandler & ImageHandler instances.
             */
            Application.Run(new ImageViewer(_fileHandler, _imageHandler));
        }