//****************************************

        public GtkChildController(GuiChildPresenter presenter, GuiViewController parent, Type targetType) : base(presenter)
        {               //****************************************
            Container ParentWidget;

            //****************************************

            if (parent is GtkChildController)
            {
                ParentWidget = ((GtkChildController)parent).Control;
            }
            else if (parent is GtkFormController)
            {
                ParentWidget = ((GtkFormController)parent).Window;
            }
            else
            {
                throw new ArgumentException("Not a Gtk controller");
            }

            //****************************************

            // Search the widgets underneath the parent for our desired user-control
            _Control = WalkWidgets(ParentWidget, targetType);

            //****************************************
        }
        //****************************************

        internal WpfChildController(GuiChildPresenter presenter, GuiViewController parent, Type targetType) : base(presenter)
        {               //****************************************
            ContentControl ParentControl;

            //****************************************

            _TargetType = targetType;

            if (parent is WpfChildController)
            {
                ParentControl = ((WpfChildController)parent).UserControl;
            }
            else if (parent is WpfFormController)
            {
                ParentControl = ((WpfFormController)parent).Window;
            }
            else
            {
                throw new ArgumentException("Not a WPF controller");
            }

            _UserControl             = WalkControls(ParentControl, targetType);
            _UserControl.DataContext = Presenter;
            _UserControl.Resources.Add("Proximity.Gui.Presentation.GuiPresenter", Presenter);
        }
        internal WinChildController(GuiChildPresenter presenter, GuiViewController parent, Type targetType) : base(presenter)
        {               //****************************************
            Control        ParentControl;
            IWinController ParentController = parent as IWinController;

            //****************************************

            if (ParentController == null)
            {
                throw new ArgumentException("Not a WinForms controller");
            }

            ParentControl = ParentController.Control;
            ParentController.Attach(this);

            //****************************************

            // Search the controls underneath the parent for our desired UserControl
            _UserControl = WalkControls(ParentControl, targetType);

            if (_UserControl == null)
            {
                throw new InvalidOperationException("Control does not exist");
            }

            _UserControl.Enter         += OnGotFocus;
            _UserControl.HandleCreated += OnLoad;
            _UserControl.Leave         += OnLostFocus;

            //****************************************

            _Provider = ((WinToolkit)GuiService.Toolkit).GetProvider(presenter.Host);
            _ViewDef  = _Provider.GetViewDef(this.Name);
        }
        //****************************************

        internal WinChildController(GuiChildPresenter presenter, GuiViewController parent, UserControl control) : base(presenter)
        {
            if (parent is IWinController)
            {
                ((IWinController)parent).Attach(this);
            }
            else
            {
                throw new ArgumentException("Not a WinForms controller");
            }

            //****************************************

            _UserControl = control;
            _Provider    = ((WinToolkit)GuiService.Toolkit).GetProvider(presenter.Host);
            _ViewDef     = _Provider.GetViewDef(this.Name);

            //****************************************

            _UserControl.Enter += OnGotFocus;
            if (_UserControl.IsHandleCreated)
            {
                OnLoad(_UserControl, EventArgs.Empty);
            }
            else
            {
                _UserControl.HandleCreated += OnLoad;
            }

            _UserControl.Leave += OnLostFocus;
        }
예제 #5
0
        protected void SetView(GuiPresenter presenter, GuiViewController controller)
        {
            if (presenter.View != null)
            {
                throw new InvalidOperationException("View has already been set");
            }

            presenter.View = controller;
        }
예제 #6
0
        internal GuiChildController GetChildController(GuiChildPresenter presenter, GuiViewController parent)
        {               //****************************************
            Type ViewType;

            //****************************************

            if (!_PresenterMappings.TryGetValue(presenter.GetType(), out ViewType))
            {
                throw new ArgumentException(string.Format("Component {0} does not have any Views for Presenter {1}", _Component.Name, presenter.GetType().FullName));
            }

            //****************************************

            Log.Verbose("Attaching Child Controller {0} to Presenter {1}", ViewType.Name, presenter.GetType().Name);

            return(GuiService.Toolkit.FindChildController(presenter, parent, ViewType));
        }
예제 #7
0
 public override GuiChildController FindChildController(GuiChildPresenter presenter, GuiViewController parent, Type childType)
 {
     return(new GtkChildController(presenter, parent, childType));
 }
예제 #8
0
 public abstract GuiChildController FindChildController(GuiChildPresenter presenter, GuiViewController parent, Type childType);