Пример #1
0
 public void Close()
 {
     if (this._formContent != null)
     {
         this._formContent.Close();
         this._formBackground.Close();
         if (this._formContent != null)
         {
             this._formContent = null;
         }
         if (this._formBackground != null)
         {
             this._formBackground = null;
         }
     }
 }
Пример #2
0
        public void Execute(string headerText, ControlMenuItems items, int offsetIndex, int selectedIndex, ControlMenuItemSelectedDelegate onItemSelectedDelegate)
        {
            FormBackground formBackground = new FormBackground();

            formBackground.Tag = this;
            //rest of initialization is in Load event
            this._formBackground   = formBackground;
            formBackground.TopMost = true;
            formBackground.Show();

            FormContent formContent = new FormContent(this);

            formContent.Tag              = this;
            formContent.Owner            = formBackground;
            formContent.TopMost          = true;
            formContent.ShowInTaskbar    = false;
            formContent.Size             = (this._size.HasValue) ? this._size.Value : formContent.Size;
            formContent.Location         = (this._location.HasValue) ? this._location.Value : formContent.Location;
            formContent.Owner.Size       = formContent.Size;
            formContent.Owner.Location   = formContent.Location;
            formContent._arrowTopText    = this._arrowTopText;
            formContent._arrowBottomText = this._arrowBottomText;
            formContent._arrowRightText  = this._arrowRightText;
            //rest of initialization is in Load event
            this._formContent = formContent;


            this._headerText = headerText;
            this._items      = items;
            this._formContent.BottomArrowVisible = this._items.Count > this._showedItemsCountWithArrows;
            this._formContent.TopArrowVisible    = this._items.Count > this._showedItemsCountWithArrows;

            this._showedItemsCount = (this._items.Count > this._showedItemsCountWithArrows)?
                                     Helper.Min(this._showedItemsCountWithArrows - 2, this._items.Count):
                                     Helper.Min(this._showedItemsCountWithArrows, this._items.Count)
            ;
            this._offsetIndex  = offsetIndex;
            this.SelectedIndex = selectedIndex;

            this._formContent.InitializeItems(this, Helper.Min(this._showedItemsCount, this._items.Count));
            this.UpdateAllShowedItems();

            this.OnItemSelected -= onItemSelectedDelegate;
            this.OnItemSelected += onItemSelectedDelegate;
            formContent.ShowDialog();
        }