public PanelTCViewModel() { UpdateAvailableDrives(); CurrentPathContent = new ObservableCollection <string>(); SelectedDrive = AvailableDrives.Any(x => x.Contains("C")) ? AvailableDrives.Where(x => x.Contains("C")).First() : AvailableDrives.First(); DropDownOpen = new RelayCommand(DropDownOpenExecute, arg => true); ItemDoubleClick = new RelayCommand(ItemDoubleClickExecute, arg => true); ItemEnterKey = new RelayCommand(ItemEnterKeyExecute, ItemEnterKeyCanExecute); }
void Refresh() { AvailableDrives.Clear(); CDInfo devInfo; for (var i = 0; BassCd.GetInfo(i, out devInfo); ++i) { AvailableDrives.Add(devInfo); } }
public SideViewModel() { UpdateAvailableDrives(); CurrentPathContent = new ObservableCollection <string>(); //any func + lambda //x.Contains("C")).First() always disk containt C at first SelectedDrive = AvailableDrives.Any(x => x.Contains("C")) ? AvailableDrives.Where(x => x.Contains("C")).First() : AvailableDrives.First(); DropDownOpen = new RelayCommand(DropDownOpenExecute, argument => true); ItemDoubleClick = new RelayCommand(ItemDoubleClickExecute, argument => true); ItemEnterKey = new RelayCommand(ItemEnterKeyExecute, ItemEnterKeyCanExecute); }
public void UpdateCurrentPathContent() { CurrentPathContent.Clear(); if (!AvailableDrives.Contains(CurrentPath)) { CurrentPathContent.Add(Resources.ParentDirectory); } foreach (var dir in GetDirectories(CurrentPath)) { CurrentPathContent.Add(Resources.DriveSign + Path.GetFileName(dir)); } foreach (var file in GetFiles(CurrentPath)) { CurrentPathContent.Add(Path.GetFileName(file)); } }