private void UpdateLayerList(LayerModel selectModel) { // Update the UI Layers.Clear(); SelectedLayer = null; if (SelectedProfile != null) { foreach (var selectedProfileLayer in SelectedProfile.Layers) { Layers.Add(selectedProfileLayer); } } if (selectModel == null) { return; } // A small delay to allow the profile list to rebuild Task.Factory.StartNew(() => { Thread.Sleep(100); SelectedLayer = selectModel; SelectedProfile?.OnOnProfileUpdatedEvent(); }); }