///<summary> /// Constructs a multiselector ///</summary> ///<param name="controlFactory"></param> public MultiSelectorWin(IControlFactory controlFactory) { _controlFactory = controlFactory; InitializeComponent(); _gridLayoutManager = new GridLayoutManager(this, controlFactory); PanelWin optionsPanel = new PanelWin(); _availableOptionsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; optionsPanel.Controls.Add(_availableOptionsGroupBox); PanelWin buttonPanel = new PanelWin(); GridLayoutManager buttonPanelManager = new GridLayoutManager(buttonPanel, controlFactory); buttonPanelManager.SetGridSize(6, 1); buttonPanelManager.AddControl(null); buttonPanelManager.AddControl(_btnSelect); buttonPanelManager.AddControl(_btnSelectAll); buttonPanelManager.AddControl(_btnDeselectAll); buttonPanelManager.AddControl(_btnDeselect); buttonPanelManager.AddControl(null); buttonPanelManager.FixRow(0, 25); buttonPanelManager.FixRow(1, 25); buttonPanelManager.FixRow(2, 25); buttonPanelManager.FixRow(3, 25); buttonPanelManager.FixRow(4, 25); buttonPanelManager.FixRow(5, 25); buttonPanelManager.FixColumnBasedOnContents(0); PanelWin selectionsPanel = new PanelWin(); _selectionsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill; selectionsPanel.Controls.Add(_selectionsGroupBox); _gridLayoutManager.SetGridSize(1, 3); _gridLayoutManager.FixColumn(1, 100); _gridLayoutManager.AddControl(optionsPanel); _gridLayoutManager.AddControl(buttonPanel); _gridLayoutManager.AddControl(selectionsPanel); _manager = new MultiSelectorManager <T>(this); AvailableOptionsListBox.SelectedIndexChanged += delegate { GetButton(MultiSelectorButton.Select).Enabled = (AvailableOptionsListBox.SelectedIndex != -1); }; SelectedOptionsListBox.SelectedIndexChanged += delegate { GetButton(MultiSelectorButton.Deselect).Enabled = (SelectedOptionsListBox.SelectedIndex != -1); }; SetDoubleClickEventHandlers(); }
public void GetUniqueControlName_WhenNameNotUsed_ShouldReturnSame() { //---------------Set up test pack------------------- var controlNamingStrategy = CreateControlNamingStrategy(); var panel = new PanelWin(); panel.Controls.Add(CreatePanel("bob")); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var name = controlNamingStrategy.GetUniqueControlNameWithin(panel, "NewName"); //---------------Test Result ----------------------- Assert.AreEqual("NewName", name); }