示例#1
0
        private FractalDocument _document;//Model of the application

        public MainViewPresenter(
            IMainView mainView,
            TrackBarControlPanelView trackBarControlPanelView,
            NumbersControlPanelView numbersControlPanelView,
            FractalDataGridView fractalDataGridView,
            FractalEditorView fractalEditorView,
            IDimensionCalculatorFactory dimensionCalculatorFactory)
        {
            if (mainView == null)
            {
                throw new ArgumentNullException("mainView");
            }
            if (trackBarControlPanelView == null)
            {
                throw new ArgumentNullException("trackBarControlPanelView");
            }
            if (numbersControlPanelView == null)
            {
                throw new ArgumentNullException("numbersControlPanelView");
            }
            if (fractalDataGridView == null)
            {
                throw new ArgumentNullException("fractalDataGridView");
            }
            if (fractalEditorView == null)
            {
                throw new ArgumentNullException("fractalEditorView");
            }
            if (dimensionCalculatorFactory == null)
            {
                throw new ArgumentNullException("dimensionCalculatorFactory");
            }
            _mainView = mainView;
            _trackBarControlPanelView = trackBarControlPanelView;
            _numbersControlPanelView  = numbersControlPanelView;
            _fractalDataGridView      = fractalDataGridView;
            _fractalEditorView        = fractalEditorView;

            _numberViewPresenter    = new ControlPanelViewPresenter(_numbersControlPanelView);
            _trackBarsViewPresenter = new ControlPanelViewPresenter(_trackBarControlPanelView);
            _dataGridPresenter      = new FractalDataGridViewPresenter(_fractalDataGridView);
            _editorViewPresenter    = new FractalEditorViewPresenter(_fractalEditorView);

            _dimensionCalculatorFactory = dimensionCalculatorFactory;
            _mainView.SelectedChanged  += new SelectedFractalEventHandler(SelectedFractalChanged);
            _document          = FractalDocument.GetInstance();
            _mainView.Load    += new EventHandler(_mainView_Load);
            _document.Changed += new EventHandler(_document_Changed);
        }
示例#2
0
 public MainForm2(
     TrackBarControlPanelView trackBarControlPanelView,
     NumbersControlPanelView numbersControlPanelView,
     FractalDataGridView fractalDataGridView,
     FractalEditorView fractalEditorView)
 {
     InitializeComponent();
     this.SetStyle(ControlStyles.DoubleBuffer |
                   ControlStyles.OptimizedDoubleBuffer |
                   ControlStyles.UserPaint |
                   ControlStyles.AllPaintingInWmPaint, true);
     _trackBarControlPanelView = trackBarControlPanelView;
     _numbersControlPanelView  = numbersControlPanelView;
     _fractalDataGridView      = fractalDataGridView;
     _fractalEditorView        = fractalEditorView;
 }
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Logger.LoggerProvider.Instance = new FileLogger(@".\logger.txt");

            NumbersControlPanelView  ncp = new NumbersControlPanelView();
            TrackBarControlPanelView tbc = new TrackBarControlPanelView();
            FractalDataGridView      fdg = new FractalDataGridView();
            FractalEditorView        fev = new FractalEditorView();

            ControlPanelSlimViewValidator validator1 = new ControlPanelSlimViewValidator(tbc);
            ControlPanelSlimViewValidator validator2 = new ControlPanelSlimViewValidator(ncp);

            var mainForm = new MainForm2(tbc, ncp, fdg, fev);
            var boxDimensionCalculatorFactory = new BoxDimensionCalculatorFactory();
            var mainPresenter = new MainViewPresenter(
                mainForm, tbc, ncp, fdg, fev, boxDimensionCalculatorFactory);

            mainForm.MainViewPresenter = mainPresenter;

            Application.Run(mainForm);
        }