private void addData(object parameter) { Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog { InitialDirectory = App.PathCurrent, DefaultExt = "txt", Filter = "Text File|*.txt", AddExtension = true }; if (openFileDialog.ShowDialog() == true) { HashSet <string> ipList = IPManager.Import(openFileDialog.FileName); foreach (string ip in ipList) { IPListOC.Add(new IPProfile { IP = ip, Ping = 0, Remarks = null, }); } } }