private void Button_Click(object sender, RoutedEventArgs e)
 {
     loader = new TextfileLoader();
     OpenFileDialog openFileDialog = new OpenFileDialog();
     openFileDialog.Multiselect = false;
     if (openFileDialog.ShowDialog() == true) list = loader.loadRisks(openFileDialog.FileName);
     SomeList.ItemsSource = list.risks;
 }
 public RiskBank loadRisks(object source)
 {
     if (source is string)
     {
         Encoding code;
         RiskBank bank = new RiskBank();
         bank.Title = Path.GetFileNameWithoutExtension((string) source);
         string line;
         System.IO.StreamReader file =
            new System.IO.StreamReader((string)source);
         while ((line = file.ReadLine()) != null)
         {
             bank.risks.Add(line);
         }
         return bank;
     }
     else return null;
 }