void run_serch(object parametr) { // string _res = " "; List <DirectoryInfo> di; string _serch; param p = parametr as param; _serch = p.sr; di = p.root; // p.res = _res; Window2 s = new Window2(_serch, di, p.res); s.Show(); System.Windows.Threading.Dispatcher.Run(); }
private void serch_Click(object sender, RoutedEventArgs e) { if (serch_b.Content.ToString() == "Serch") { string serch_st = " "; Window1 w1 = new Window1(); if (w1.ShowDialog() == true) { serch_st = w1.name; } param p = new param(serch_st, inactiv_w.roots, rez); ParameterizedThreadStart pts = new ParameterizedThreadStart(run_serch); Thread sr = new Thread(pts); sr.IsBackground = true; sr.SetApartmentState(ApartmentState.STA); sr.Start(p); prog_bar1.Visibility = Visibility.Visible; serch_b.Content = "view rez"; } else { if (rez.fsi != null) { if (rez.Dir == "dir") { inactiv_w.current_dir = rez.fsi as DirectoryInfo; } else { FileInfo temp = rez.fsi as FileInfo; inactiv_w.current_dir = temp.Directory; } if (lr) { refr_r(); } else { refr_l(); } } else { System.Windows.MessageBox.Show("NO"); } prog_bar1.Visibility = Visibility.Hidden; serch_b.Content = "Serch"; } }