Пример #1
0
        /// <summary>
        /// Initializes the contained controls.
        /// </summary>
        private void InitializeComponent()
        {
            // Instantiate
            this.leftBox           = new DynamicListBox();
            this.rightBox          = new DynamicListBox();
            this.moveRight         = new Button();
            this.moveLeft          = new Button();
            this.moveAllRight      = new Button();
            this.moveAllLeft       = new Button();
            this.moveUp            = new Button();
            this.moveDown          = new Button();
            this.leftBoxLabel      = new Label();
            this.rightBoxLabel     = new Label();
            this.allLeftContainer  = new PlaceHolder();
            this.allRightContainer = new PlaceHolder();

            // Customize
            this.leftBox.ID            = "LeftBox";
            this.leftBox.SelectionMode = ListSelectionMode.Multiple;
            this.leftBox.Rows          = 8;
            this.leftBox.ItemsChanged += new EventHandler(leftBox_ItemsChanged);

            this.rightBox.ID            = "RightBox";
            this.rightBox.SelectionMode = ListSelectionMode.Multiple;
            this.rightBox.Rows          = 8;
            this.rightBox.ItemsChanged += new EventHandler(rightBox_ItemsChanged);

            this.moveRight.ID               = "MoveRight";
            this.moveRight.Text             = ManagementHelper.GetConsoleResource("DUALLIST_MOVE_RIGHT") + " ->";
            this.moveRight.CausesValidation = false;
            this.moveRight.Click           += new EventHandler(moveRight_Click);

            this.moveAllRight.ID               = "MoveAllRight";
            this.moveAllRight.Text             = ManagementHelper.GetConsoleResource("DUALLIST_MOVE_ALL_RIGHT") + " ->>";
            this.moveAllRight.CausesValidation = false;
            this.moveAllRight.Click           += new EventHandler(moveAllRight_Click);

            this.moveLeft.ID               = "MoveLeft";
            this.moveLeft.Text             = "<- " + ManagementHelper.GetConsoleResource("DUALLIST_MOVE_LEFT");
            this.moveLeft.CausesValidation = false;
            this.moveLeft.Click           += new EventHandler(moveLeft_Click);

            this.moveAllLeft.ID               = "MoveAllLeft";
            this.moveAllLeft.Text             = "<<- " + ManagementHelper.GetConsoleResource("DUALLIST_MOVE_ALL_LEFT");
            this.moveAllLeft.CausesValidation = false;
            this.moveAllLeft.Click           += new EventHandler(moveAllLeft_Click);

            this.moveUp.ID               = "MoveUp";
            this.moveUp.Text             = ManagementHelper.GetConsoleResource("DUALLIST_MOVE_UP");
            this.moveUp.CausesValidation = false;
            this.moveUp.Width            = Unit.Parse("100%", System.Globalization.CultureInfo.InvariantCulture);
            this.moveUp.Click           += new EventHandler(moveUp_Click);

            this.moveDown.ID               = "MoveDown";
            this.moveDown.Text             = ManagementHelper.GetConsoleResource("DUALLIST_MOVE_DOWN");
            this.moveDown.CausesValidation = false;
            this.moveDown.Click           += new EventHandler(moveDown_Click);

            this.leftBoxLabel.Text  = ManagementHelper.GetConsoleResource("DUALLIST_AVAILABLE") + " " + this.ItemsName;
            this.rightBoxLabel.Text = ManagementHelper.GetConsoleResource("DUALLIST_CHOSEN") + " " + this.ItemsName;

            // Layout
            TableRow topRow = new TableRow();

            this.Controls.Add(topRow);
            topRow.Cells.AddRange(new TableCell[] { new TableCell(), new TableCell() });
            topRow.Cells[0].ColumnSpan = 2;
            topRow.Cells[0].Controls.Add(this.leftBoxLabel);
            topRow.Cells[1].ColumnSpan = 2;
            topRow.Cells[1].Controls.Add(this.rightBoxLabel);

            TableRow mainRow = new TableRow();

            this.Controls.Add(mainRow);
            mainRow.Cells.AddRange(new TableCell[] { new TableCell(), new TableCell(), new TableCell(), new TableCell() });

            TableCell currentCell;

            currentCell = mainRow.Cells[0];
            currentCell.Controls.Add(leftBox);
            currentCell.HorizontalAlign = HorizontalAlign.Center;

            currentCell = mainRow.Cells[1];
            currentCell.Controls.Add(moveRight);
            this.allRightContainer.Controls.Add(new LiteralControl("<br>"));
            this.allRightContainer.Controls.Add(moveAllRight);
            currentCell.Controls.Add(this.allRightContainer);
            currentCell.Controls.Add(new LiteralControl("<br>"));
            currentCell.Controls.Add(new LiteralControl("<br>"));
            currentCell.Controls.Add(moveLeft);
            this.allLeftContainer.Controls.Add(new LiteralControl("<br>"));
            this.allLeftContainer.Controls.Add(this.moveAllLeft);
            currentCell.Controls.Add(this.allLeftContainer);
            currentCell.HorizontalAlign = HorizontalAlign.Center;
            currentCell.VerticalAlign   = VerticalAlign.Middle;

            currentCell = mainRow.Cells[2];
            currentCell.Controls.Add(rightBox);
            currentCell.HorizontalAlign = HorizontalAlign.Center;

            currentCell = mainRow.Cells[3];
            currentCell.Controls.Add(this.moveUp);
            currentCell.Controls.Add(new LiteralControl("<br>"));
            currentCell.Controls.Add(this.moveDown);
            currentCell.HorizontalAlign = HorizontalAlign.Left;
            currentCell.VerticalAlign   = VerticalAlign.Middle;
        }