/// <summary>
        ///     Устанавливает контейнер элементов.
        /// </summary>
        public void SetLayoutPanel(ILayoutPanel value)
        {
            if (_layoutPanel != value)
            {
                // Удаление старого контейнера и его элементов из контекста
                if (_layoutPanel != null)
                {
                    RemoveElementFromContext(_layoutPanel);

                    var childElements = _layoutPanel.GetAllChildElements();

                    if (childElements != null)
                    {
                        foreach (var childElement in childElements)
                        {
                            RemoveElementFromContext(childElement);
                        }
                    }
                }

                object content = null;

                // Добавление нового контейнера и его элементов в контекст
                if (value != null)
                {
                    AddElementToContext(value);

                    var childElements = value.GetAllChildElements();

                    if (childElements != null)
                    {
                        foreach (var childElement in childElements)
                        {
                            AddElementToContext(childElement);
                        }
                    }

                    content = value.GetControl();
                }

                _layoutPanel = value;

                Control.Content = content;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Occurs when the size has changed.
 /// </summary>
 /// <param name="oldSize">The size before changing.</param>
 /// <param name="newSize">The size after changing.</param>
 protected virtual void OnSizeChanged(Size oldSize, Size newSize)
 {
     //            EnsureSelectedControlRemoved();
     if (SizeChanged != null)
     {
         ChangedEventArgs <Size> e = new ChangedEventArgs <Size>(oldSize, newSize);
         SizeChanged(this, e);
     }
     if (!oldSize.IsEmpty)
     {
         Layouter.AdjustSize(this, oldSize, newSize, scaleFactor);
         ILayoutPanel c = this as ILayoutPanel;
         if (c != null)
         {
             Layouter.Layout(c, oldSize, newSize, defaultSize);
         }
     }
 }
Esempio n. 3
0
        public void AttachToParent(ILayoutPanel parent, int index)
        {
            switch (Model.Side)
            {
            case DockSide.Left:
                parent.AttachChild(this, AttachMode.Left, index);
                break;

            case DockSide.Right:
                parent.AttachChild(this, AttachMode.Right, index);
                break;

            case DockSide.Top:
                parent.AttachChild(this, AttachMode.Top, index);
                break;

            case DockSide.Bottom:
                parent.AttachChild(this, AttachMode.Bottom, index);
                break;
            }
        }
Esempio n. 4
0
        private async Task updatePanelAsync(eLayoutPanelType i_LayoutType)
        {
            contentSpinner.Visible = true;
            resetContentPanel();
            ILayoutPanel layout = LayoutPanelFactory.CreateLayout(i_LayoutType);

            try
            {
                m_Panel = await layout.GetLayoutPanelAsync(r_LoginService.LoggedInUser);

                m_Panel.Padding = new Padding(10);
                m_Panel.Dock    = DockStyle.Fill;
                contentPanel.Controls.Add(m_Panel);
            }
            catch (Exception)
            {
                MessageBox.Show(Resources.RetriveDataErrorMessage, Resources.RetriveDataErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                contentSpinner.Visible = false;
            }
        }
Esempio n. 5
0
 public static LayoutView <T> ToLayoutView <T>(this ILayoutPanel <T> panel) => new LayoutView <T>
 {
     Panel = panel,
     HorizontalAlignment = HorizontalAlignment.Stretch,
     VerticalAlignment   = VerticalAlignment.Stretch
 };
        /// <summary>
        ///     Устанавливает контейнер элементов страницы.
        /// </summary>
        public void SetLayoutPanel(ILayoutPanel layoutPanel)
        {
            _layoutPanel = layoutPanel;

            Control.Content = (layoutPanel != null) ? layoutPanel.GetControl() : null;
        }
        /// <summary>
        ///     Устанавливает контейнер элементов.
        /// </summary>
        public void SetLayoutPanel(ILayoutPanel value)
        {
            _layoutPanel = value;

            Control.Content = value.GetControl <UIElement>();
        }