private void KeyVm_SelectedItemChanged1(object sender, EventArguments.KeyFolderSelectedItemChangedEventArgs e) { var keyVm = sender as IKeyFolderViewModel; var selectedIndex = KeyFolders.IndexOf(keyVm); var nextItemIndex = selectedIndex + 1; try { if (e.Path != null) { var directories = Directory.GetDirectories(e.Path); if (nextItemIndex > KeyFolders.Count - 1) { if (directories.Count() > 0) { NotifyCreatePanel.Invoke(this, EventArgs.Empty); KeyFolders[nextItemIndex].Load(directories, e.Path); } } else { KeyFolders[nextItemIndex].Load(directories, e.Path); } } IList <IKeyFolderViewModel> keyVmList = new List <IKeyFolderViewModel>(); for (int i = nextItemIndex + 1; i < KeyFolders.Count; i++) { if (i <= 2) { KeyFolders[i].ClearItems(); continue; } keyVmList.Add(KeyFolders[i]); } NotifyRemovePanel.Invoke(this, keyVmList.ToArray()); } catch (Exception ex) { KeyFolders[nextItemIndex].ClearItems(); //NotifyCreatePanel.Invoke(this, EventArgs.Empty); } }
private void KeyOffAllPreviousItems(IKeyFolderViewModel currentVm) { var idx = KeyFolders.IndexOf(currentVm); if (idx > 0 && idx - 1 >= 0) { var prevVm = KeyFolders[idx - 1]; foreach (var item in prevVm.KeyPaths) { item.Value.Add(currentVm.SelectedItem); } } }
public void LoadFirstKeyFolder() { if (KeyFolders.Count > 0) { var keyFolder = KeyFolders.First(); keyFolder.Load(FolderPath); foreach (var key in KeyFolders) { if (key == KeyFolders.First()) { continue; } key.ClearItems(); } } }