public SelectSub(netFileCollection filelist, string filename, Window Owner) { InitializeComponent(); this.Owner = Owner; this.sub_file_list = new netFileCollection(); foreach (var nf in filelist) { if (nf.Type == fileType.Subtitle) { int l = (filename.Length > nf.Name.Length) ? nf.Name.Length : filename.Length; for (int i = 0; i < l; ++i) { if (filename[i] != nf.Name[i]) { break; } else if (filename[i] == '.' && nf.Name[i] == '.') { suburl.Add(nf.Url); havesub = true; break; } } this.sub_file_list.Add(nf); listBox.Items.Add(nf.Name); } } if ((sub_file_list.Count > 0) && (suburl.Count == 0)) { this.ShowDialog(); } }
private void search_button_Click(object sender, RoutedEventArgs e) { var search_text = search_textbox.Text; if (search_text == "") { return; } var search_result = new netFileCollection(); search_result.Add(new netFile( Name: "<Return>", Url: "", Isdir: true )); foreach (var nf in this.cur_flb.filelist) { if (nf.Name.IndexOf(search_text, StringComparison.OrdinalIgnoreCase) > -1) { search_result.Add(nf); } } grid.Children.Remove(this.cur_flb); this.cur_flb = new FileListBox(search_result); this.cur_flb.MouseDoubleClick += new MouseButtonEventHandler(listBox_MouseDoubleClick); flb_stack.Push(this.cur_flb); this.cur_flb.SetValue(Grid.RowProperty, 1); grid.Children.Add(this.cur_flb); search_textbox.Text = ""; }
public FileListBox(netFileCollection filelist) { InitializeComponent(); this.filelist = filelist; foreach (var nf in this.filelist) { listBox.Items.Add(nf.Name); } }