private void UpdateVisibility() { bool useLengthEffect = getUseLengthEffectFunc(FailureMechanism); DataGridViewControl.GetColumnFromIndex(initialFailureMechanismResultProfileProbabilityIndex).Visible = useLengthEffect; DataGridViewControl.GetColumnFromIndex(refinedProfileProbabilityIndex).Visible = useLengthEffect; DataGridViewControl.GetColumnFromIndex(profileProbabilityIndex).Visible = useLengthEffect; DataGridViewControl.GetColumnFromIndex(sectionNIndex).Visible = useLengthEffect; }
private void UpdateStochasticSoilProfileColumn() { using (new SuspendDataGridViewColumnResizes(DataGridViewControl.GetColumnFromIndex(stochasticSoilProfileColumnIndex))) { foreach (DataGridViewRow dataGridViewRow in DataGridViewControl.Rows) { FillAvailableSoilProfilesList(dataGridViewRow); } } }
private void UpdateVisibility() { bool useLengthEffect = FailureMechanism.GeneralInput.ApplyLengthEffectInSection; DataGridViewControl.GetColumnFromIndex(initialFailureMechanismResultProfileProbabilityIndex).Visible = useLengthEffect; DataGridViewControl.GetColumnFromIndex(probabilityRefinementTypeIndex).Visible = useLengthEffect; DataGridViewControl.GetColumnFromIndex(refinedProfileProbabilityIndex).Visible = useLengthEffect; DataGridViewControl.GetColumnFromIndex(profileProbabilityIndex).Visible = useLengthEffect; DataGridViewControl.GetColumnFromIndex(sectionNIndex).Visible = useLengthEffect; }
private void UpdateForeshoreProfilesColumn() { var column = (DataGridViewComboBoxColumn)DataGridViewControl.GetColumnFromIndex(foreshoreProfileColumnIndex); using (new SuspendDataGridViewColumnResizes(column)) { foreach (DataGridViewRow dataGridViewRow in DataGridViewControl.Rows) { FillAvailableForeshoreProfilesList(dataGridViewRow); } } }
protected override void PrefillComboBoxListItemsAtColumnLevel() { base.PrefillComboBoxListItemsAtColumnLevel(); // Need to prefill for all possible data in order to guarantee 'combo box' columns // do not generate errors when their cell value is not present in the list of available // items. var foreshoreProfiles = (DataGridViewComboBoxColumn)DataGridViewControl.GetColumnFromIndex(foreshoreProfileColumnIndex); using (new SuspendDataGridViewColumnResizes(foreshoreProfiles)) { SetItemsOnObjectCollection(foreshoreProfiles.Items, GetForeshoreProfileDataSource(FailureMechanism.ForeshoreProfiles)); } }
protected override void PrefillComboBoxListItemsAtColumnLevel() { base.PrefillComboBoxListItemsAtColumnLevel(); var stochasticSoilModelColumn = (DataGridViewComboBoxColumn)DataGridViewControl.GetColumnFromIndex(stochasticSoilModelColumnIndex); var stochasticSoilProfileColumn = (DataGridViewComboBoxColumn)DataGridViewControl.GetColumnFromIndex(stochasticSoilProfileColumnIndex); // Need to prefill for all possible data in order to guarantee 'combo box' columns // do not generate errors when their cell value is not present in the list of available // items. using (new SuspendDataGridViewColumnResizes(stochasticSoilModelColumn)) { PipingStochasticSoilModelCollection stochasticSoilModels = FailureMechanism.StochasticSoilModels; SetItemsOnObjectCollection(stochasticSoilModelColumn.Items, GetStochasticSoilModelsDataSource(stochasticSoilModels).ToArray()); } using (new SuspendDataGridViewColumnResizes(stochasticSoilProfileColumn)) { IEnumerable <PipingStochasticSoilProfile> pipingSoilProfiles = GetPipingStochasticSoilProfilesFromStochasticSoilModels(); SetItemsOnObjectCollection(stochasticSoilProfileColumn.Items, GetSoilProfilesDataSource(pipingSoilProfiles).ToArray()); } }
public void Constructor_WithFactory_DataGridViewCorrectlyInitialized() { // Setup mockRepository.ReplayAll(); using (new UseCustomTileSourceFactoryConfig(tileFactory)) { // Call using (var control = new WmtsLocationControl(null, wmtsCapabilityFactory)) using (var form = new Form()) { form.Controls.Add(control); // Assert DataGridViewControl dataGridViewControl = form.Controls.Find("dataGridViewControl", true).OfType<DataGridViewControl>().First(); DataGridView dataGridView = dataGridViewControl.Controls.OfType<DataGridView>().First(); Assert.AreEqual(DataGridViewSelectionMode.FullRowSelect, dataGridViewControl.SelectionMode); Assert.IsFalse(dataGridViewControl.MultiSelect); Assert.AreEqual(4, dataGridView.ColumnCount); var mapLayerIdColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerIdColumnIndex); Assert.AreEqual("Kaartlaag", mapLayerIdColumn.HeaderText); Assert.AreEqual("Id", mapLayerIdColumn.DataPropertyName); Assert.IsTrue(mapLayerIdColumn.ReadOnly); var mapLayerFormatColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerFormatColumnIndex); Assert.AreEqual("Formaat", mapLayerFormatColumn.HeaderText); Assert.AreEqual("Format", mapLayerFormatColumn.DataPropertyName); Assert.IsTrue(mapLayerFormatColumn.ReadOnly); var mapLayerTitleColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerTitleColumnIndex); Assert.AreEqual("Titel", mapLayerTitleColumn.HeaderText); Assert.AreEqual("Title", mapLayerTitleColumn.DataPropertyName); Assert.IsTrue(mapLayerTitleColumn.ReadOnly); var mapLayerCoordinateSystemColumn = (DataGridViewTextBoxColumn) dataGridViewControl.GetColumnFromIndex(mapLayerCoordinateSystemColumnIndex); Assert.AreEqual("Coördinatenstelsel", mapLayerCoordinateSystemColumn.HeaderText); Assert.AreEqual("CoordinateSystem", mapLayerCoordinateSystemColumn.DataPropertyName); Assert.IsTrue(mapLayerCoordinateSystemColumn.ReadOnly); CollectionAssert.IsEmpty(dataGridViewControl.Rows); Label urlLocationLabel = form.Controls.Find("urlLocationLabel", true).OfType<Label>().First(); Assert.AreEqual("Locatie (URL)", urlLocationLabel.Text); ComboBox urlLocations = form.Controls.Find("urlLocationComboBox", true).OfType<ComboBox>().First(); Assert.AreEqual(ComboBoxStyle.DropDownList, urlLocations.DropDownStyle); Assert.IsInstanceOf<ICollection<WmtsConnectionInfo>>(urlLocations.DataSource); Assert.AreEqual("Name", urlLocations.DisplayMember); Assert.AreEqual("Url", urlLocations.ValueMember); Assert.IsTrue(urlLocations.Sorted); Assert.IsNotNull(urlLocations.SelectedItem); Button buttonConnectTo = form.Controls.Find("connectToButton", true).OfType<Button>().First(); Assert.AreEqual("Verbinding maken", buttonConnectTo.Text); Assert.IsTrue(buttonConnectTo.Enabled); Button buttonAddLocation = form.Controls.Find("addLocationButton", true).OfType<Button>().First(); Assert.AreEqual("Locatie toevoegen...", buttonAddLocation.Text); Button buttonEditLocation = form.Controls.Find("editLocationButton", true).OfType<Button>().First(); Assert.AreEqual("Locatie aanpassen...", buttonEditLocation.Text); } } }