/// <summary> /// gør det muligt at søge efter invoice nr. /// så man kan finde filen hurtigere /// </summary> private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { string allowInput = "1234567890"; string returnValue = ""; for (int i = 0; i < (sender as TextBox).Text.Length; i++) { if (allowInput.Contains((sender as TextBox).Text.Substring(i, 1))) { returnValue += (sender as TextBox).Text.Substring(i, 1); } } (sender as TextBox).Text = returnValue; ListViewOpenFileNames.SelectedIndex = -1; ListViewOpenFileNames.Items.Clear(); fileClass.FileInfoSettings setup = this.fileSetup; foreach (var file in this.filesInUse) { if (file.fragtNumb.StartsWith(returnValue)) { ListViewOpenFileNames.Items.Add(SetUpListViewItem(file)); } } }
/// <summary> /// hent filerne og vis dem i listen /// </summary> private void loadListView() { List <fileClass.FileInfoClass> allFiles = new fileClass().GetFileList(); fileClass.FileInfoSettings setup = this.fileSetup; foreach (var file in allFiles) { if ((setup.showFragtXML) || (file.hasFragtPDF && setup.showFragtPDF) || (file.hasFaktura && setup.showFaktXML) || (file.hasFaktPDF && setup.showFaktPDF) || (file.fragtClosed && setup.showFragtClosed)) { this.filesInUse.Add(file); ListViewOpenFileNames.Items.Add(SetUpListViewItem(file)); } } }