private void cbSortType_SelectionChanged(object sender, SelectionChangedEventArgs e) { AppPrefs.SetInt("cbSortType", cbSortType.SelectedIndex); if (m_current != null) { m_current.Sort((SortType)cbSortType.SelectedValue); List <DirItem> list = new List <DirItem>(); list.Add(m_current); tvDirTree.ItemsSource = list; } }
private void btnCalc_Click(object sender, RoutedEventArgs e) { var dirPath = cbBaseDir.Text; if (!Directory.Exists(dirPath)) { Debuger.LogError("目录不存在:{0}", dirPath); return; } AppPrefs.SetString("cbBaseDir", cbBaseDir.Text); AppPrefs.Save(); m_current = new DirItem(new DirectoryInfo(dirPath)); m_current.CalcSize(); m_current.Sort((SortType)cbSortType.SelectedValue); List <DirItem> list = new List <DirItem>(); list.Add(m_current); tvDirTree.ItemsSource = list; }