private void AddNewFolderInList() { string folder = cmBFolder.Text?.Trim(); if (string.IsNullOrEmpty(folder) || !Directory.Exists(folder)) { return; } ConnectionData connectionData = GetSelectedConnection(); if (connectionData != null) { if (lstVwFolders.ItemsSource != null && lstVwFolders.ItemsSource is ObservableCollection <string> coll ) { coll.Add(folder); } connectionData.AddTraceLastFolder(folder); } }