/// <summary> /// Wyszukujemy wszyskie pliki których nazwy zawieraja podany przez /// nas ciag znakow w textboxie /// </summary> private void button12_Click(object sender, RoutedEventArgs e) { MyDirectory myDirectory1 = new MyDirectory(directoryPath.Text); listOfUserControls1.Children.Clear(); List <DiscElement> subElements1 = myDirectory1.GetDiscElements(); List <DiscElement> results = subElements1.FindAll(x => x.Name.Contains(textBox.Text)); foreach (DiscElement discElement in results) { { ElementsViews discElementViews = new ElementsViews(discElement); listOfUserControls1.Children.Add(discElementViews); discElementViews.checkedChangeEv += CheckedChangeEv; } } //------------------------------------------------------------ MyDirectory myDirectory2 = new MyDirectory(directoryPath2.Text); listOfUserControls2.Children.Clear(); List <DiscElement> subElements2 = myDirectory2.GetDiscElements(); List <DiscElement> results2 = subElements2.FindAll(x => x.Name.Contains(textBox.Text)); foreach (DiscElement discElement in results2) { ElementsViews discElementViews = new ElementsViews(discElement); listOfUserControls2.Children.Add(discElementViews); discElementViews.checkedChangeEv += CheckedChangeEv; } }
/// <summary> /// Metoda generuje naszą listę podfolderów i plików w folderze dla 2 stack panelu /// </summary> private void GenerateFilesList2() { MyDirectory myDirectory2 = new MyDirectory(directoryPath2.Text); listOfUserControls2.Children.Clear(); List <DiscElement> subElements2 = myDirectory2.GetDiscElements(); foreach (DiscElement discElement in subElements2) { ElementsViews discElementViews = new ElementsViews(discElement); listOfUserControls2.Children.Add(discElementViews); discElementViews.checkedChangeEv += CheckedChangeEv; } }
//---------------------------------------------- private void Open_new_folder2(string path) { directoryPath2.Text = path; MyDirectory myDirectory2 = new MyDirectory(directoryPath2.Text); listOfUserControls2.Children.Clear(); List <DiscElement> subElements2 = myDirectory2.GetDiscElements(); foreach (DiscElement discElement in subElements2) { ElementsViews discElementViews = new ElementsViews(discElement); listOfUserControls2.Children.Add(discElementViews); discElementViews.checkedChangeEv += CheckedChangeEv; } }
//------------------------------------------------- private void button11_Click(object sender, RoutedEventArgs e) { MyDirectory myDirectory2 = new MyDirectory(directoryPath2.Text); listOfUserControls2.Children.Clear(); List <DiscElement> subElements2 = myDirectory2.GetDiscElements(); subElements2.Sort((x, y) => DateTime.Compare(x.CreationTime, y.CreationTime)); foreach (DiscElement discElement in subElements2) { ElementsViews discElementViews = new ElementsViews(discElement); listOfUserControls2.Children.Add(discElementViews); discElementViews.checkedChangeEv += CheckedChangeEv; } }
/// <summary> /// Sortujemy liste po nazwie (A-Z) /// </summary> private void button8_Click(object sender, RoutedEventArgs e) { MyDirectory myDirectory1 = new MyDirectory(directoryPath.Text); listOfUserControls1.Children.Clear(); List <DiscElement> subElements1 = myDirectory1.GetDiscElements(); subElements1.Sort((x, y) => string.Compare(x.Name, y.Name)); foreach (DiscElement discElement in subElements1) { ElementsViews discElementViews = new ElementsViews(discElement); listOfUserControls1.Children.Add(discElementViews); discElementViews.checkedChangeEv += CheckedChangeEv; } }