private void ListView_Init() { try { foreach (string stvar in povezava.Vrni_vse()) { podatki_za_primerjat.Add(delo.Refactor_string(stvar)); } List <ListView_Data> abc = delo.Datoteke_namizje(); lis.ItemsSource = abc; } catch (Exception ex) { MessageBox.Show("ListtView_innit Error: " + ex, "ListtView_innit Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void premik(string kam) { List <string> namizje = new List <string>(); List <string> ne_premikat = null; try { string che; foreach (var nam in delo.Datoteke_namizje())// to do tukaj naredui nekaj da prepreci null { che = nam.Name; Console.WriteLine(che); if (delo.User_public_check(che)) { namizje.Add(Path.Combine(_publicPath, che.Remove(che.Length - 13)));// ce je slucajo namizje prazno bo vrglo nazaj null(pac dodaj exception in je) } else { namizje.Add(_desktopPath + "\\" + nam.Name);// ce je slucajo namizje prazno bo vrglo nazaj null(pac dodaj exception in je) } } ne_premikat = povezava.Vrni_vse(); ne_premikat.Add(kam); } catch (Exception ex) { MessageBox.Show("Neki ne dela v premiku" + ex, "Move error", MessageBoxButton.OK, MessageBoxImage.Error); } foreach (string last in namizje) { FileAttributes attr = File.GetAttributes(last); if ((attr & FileAttributes.Directory) == FileAttributes.Directory) { if (ne_premikat == null) { continue;// todo naredi da ce slucajno ne premakne nic da tudi napise da ni nic premakniilo ali neki } if (!ne_premikat.Contains(last)) { try { Console.WriteLine(last + "\\" + " " + kam + "\\" + delo.Refactor_string(last)); Directory.Move(last, kam + "\\" + delo.Refactor_string(last)); //Directory.Move(last, kam); } catch (Exception e) { Console.WriteLine(e.Message); } } //MessageBox.Show("Its a directory"); } else { if (ne_premikat == null) { continue;// todo naredi da ce slucajno ne premakne nic da tudi napise da ni nic premakniilo ali neki } if (!ne_premikat.Contains(last)) { try { File.Move(last, kam + "\\" + delo.Refactor_string(last)); } catch (Exception e) { Console.WriteLine(e.Message); } } } } }