Exemplo n.º 1
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     if (!_currentComponent.MovingBackFromComponent())
     {
         return;
     }
     UnsetComponenet(_currentComponent);
     _currentComponent = _currentComponent.PreviousComponent;
     SetComponent(_currentComponent);
 }
Exemplo n.º 2
0
        public async void SetComponent(ComponentBase component)
        {
            _currentComponent = component;
            this.Content = null;

            var newControl = component.MainControl;

            if (newControl == null)
            {
                throw new Exception("The component " + component.GetType().Name + " does not define a Control.  Every component needs a control");
            }
            this.Content = newControl;

            await component.Show();
        }
Exemplo n.º 3
0
        void component_MoveTo(object sender, MoveToEventArgs e)
        {
            if (!_currentComponent.MovingNextFromComponent())
            {
                return;
            }
            UnsetComponenet(_currentComponent);
            _currentComponent = e.Component;

            if (_currentComponent == null)
            {
                Environment.Exit(0);
            }
            else
            {
                SetComponent(_currentComponent);
            }
        }
Exemplo n.º 4
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (!_currentComponent.MovingNextFromComponent())
            {
                return;
            }
            UnsetComponenet(_currentComponent);
            _currentComponent = _currentComponent.NextComponent;

            if (_currentComponent == null)
            {
                Environment.Exit(0);
            }
            else
            {
                SetComponent(_currentComponent);
            }
        }
Exemplo n.º 5
0
        public async void SetComponent(ComponentBase component)
        {
            _currentComponent = component;
            Controls.Clear();

            var newControl = component.MainControl;

            if (newControl == null)
            {
                throw new Exception("The component " + component.GetType().Name + " does not define a Control.  Every component needs a control");
            }


            var host = new ElementHost();
            host.Child = newControl;

            Controls.Add(host);
            host.Dock = DockStyle.Fill;
            host.Margin = new System.Windows.Forms.Padding(0);

            await component.Show();
        }
Exemplo n.º 6
0
 private void InstallForm_Load(object sender, EventArgs e)
 {
     Show();
     _currentComponent = new IntroductionComponent();
     SetComponent(_currentComponent);
 }
Exemplo n.º 7
0
        private void UnsetComponenet(ComponentBase component)
        {
            tlpMain.Controls.Remove(component.MainControl);

            component.NextChanged -= NextChanged_Handler;
            component.PreviousChanged -= PreviousChanged_Handler;
            component.MoveToNext -= btnNext_Click;
            component.MoveTo -= component_MoveTo;
        }
Exemplo n.º 8
0
        private void SetComponent(ComponentBase component)
        {
            tlpMain.Controls.Clear();

            tlpMain.Controls.Add(panelButtons, 0, 1);
            var newControl = component.MainControl;

            if (newControl == null)
            {
                throw new Exception("The component " + component.GetType().Name + " does not define a Control.  Every component needs a control");
            }
            tlpMain.Controls.Add(component.MainControl, 0, 0);
            component.MainControl.Dock = DockStyle.Fill;
            component.MainControl.Margin = new System.Windows.Forms.Padding(0);

            component.NextChanged += NextChanged_Handler;
            component.PreviousChanged += PreviousChanged_Handler;
            component.MoveToNext += btnNext_Click;
            component.MoveTo += component_MoveTo;

            component.MovedToComponent();
        }