Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs =================================================================== diff -u -r0631da0684dd736f5ca061237ea606314f272366 -r11eb517ba7a480b4a415855798a7fadefc0cfe54 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs (.../BackgroundMapDataSelectionDialog.cs) (revision 0631da0684dd736f5ca061237ea606314f272366) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/BackgroundMapDataSelectionDialog.cs (.../BackgroundMapDataSelectionDialog.cs) (revision 11eb517ba7a480b4a415855798a7fadefc0cfe54) @@ -37,8 +37,8 @@ /// public partial class BackgroundMapDataSelectionDialog : DialogBase { - private readonly HashSet mapDatas; - private IBackgroundMapDataSelectionControl currentBackgroundMapDataSelectionControl; + private readonly HashSet mapDatas; + private BackgroundMapDataSelectionControl currentBackgroundMapDataSelectionControl; private bool mapLayerComboBoxUpdating; /// @@ -50,17 +50,16 @@ public BackgroundMapDataSelectionDialog(IWin32Window dialogParent, ImageBasedMapData mapData) : base(dialogParent, RingtoetsCommonFormsResources.SelectionDialogIcon, 500, 350) { - mapDatas = new HashSet + mapDatas = new HashSet { new WellKnownMapDataControl(mapData as WellKnownTileSourceMapData), new WmtsLocationControl(mapData as WmtsMapData, new BruTileWmtsCapabilityFactory()) }; InitializeComponent(); InitializeButtons(); - InitializeComboBox(); - IBackgroundMapDataSelectionControl controlToSelect = GetBackgroundMapDataControlToSelect(mapData); + BackgroundMapDataSelectionControl controlToSelect = GetBackgroundMapDataControlToSelect(mapData); PreSelectComboBox(controlToSelect); } @@ -78,7 +77,7 @@ base.Dispose(disposing); } - private IBackgroundMapDataSelectionControl GetBackgroundMapDataControlToSelect(ImageBasedMapData mapData) + private BackgroundMapDataSelectionControl GetBackgroundMapDataControlToSelect(ImageBasedMapData mapData) { if (mapData is WellKnownTileSourceMapData) { @@ -91,17 +90,16 @@ return mapDatas.First(); } - private void UpdatePropertiesGroupBox(IBackgroundMapDataSelectionControl newBackgroundMapDataSelectionControl) + private void UpdatePropertiesGroupBox(BackgroundMapDataSelectionControl newBackgroundMapDataSelectionControl) { if (currentBackgroundMapDataSelectionControl != null) { currentBackgroundMapDataSelectionControl.SelectedMapDataChanged -= OnSelectedMapDataSelectionChanged; } propertiesGroupBox.Controls.Clear(); - Control userControl = newBackgroundMapDataSelectionControl.UserControl; - propertiesGroupBox.Controls.Add(userControl); - userControl.Dock = DockStyle.Fill; + propertiesGroupBox.Controls.Add(newBackgroundMapDataSelectionControl); + newBackgroundMapDataSelectionControl.Dock = DockStyle.Fill; newBackgroundMapDataSelectionControl.SelectedMapDataChanged += OnSelectedMapDataSelectionChanged; currentBackgroundMapDataSelectionControl = newBackgroundMapDataSelectionControl; @@ -129,18 +127,13 @@ #region ComboBox - private void InitializeComboBox() + private void PreSelectComboBox(BackgroundMapDataSelectionControl controlToSelect) { - mapLayerComboBox.ValueMember = nameof(IBackgroundMapDataSelectionControl.UserControl); - } - - private void PreSelectComboBox(IBackgroundMapDataSelectionControl controlToSelect) - { mapLayerComboBox.BeginUpdate(); mapLayerComboBoxUpdating = true; mapLayerComboBox.DataSource = mapDatas.ToArray(); - mapLayerComboBox.DisplayMember = nameof(IBackgroundMapDataSelectionControl.DisplayName); + mapLayerComboBox.DisplayMember = nameof(BackgroundMapDataSelectionControl.DisplayName); mapLayerComboBox.SelectedItem = null; mapLayerComboBoxUpdating = false; @@ -173,7 +166,7 @@ return; } - UpdatePropertiesGroupBox((IBackgroundMapDataSelectionControl) mapLayerComboBox.SelectedItem); + UpdatePropertiesGroupBox((BackgroundMapDataSelectionControl) mapLayerComboBox.SelectedItem); } #endregion