Beispiel #1
0
        public static LongActivityDefinition ParseCSV(string line)
        {
            string[] toks = line.Split(',');
            LongActivityDefinition longDef = new LongActivityDefinition {
                Sport    = toks[0],
                Duration = TimeSpan.Parse(toks[1])
            };

            return(longDef);
        }
Beispiel #2
0
 public static void LoadLongDefinitions()
 {
     try {
         DeleteTableContents("longdefs");
         var          assembly = IntrospectionExtensions.GetTypeInfo(typeof(MainPage)).Assembly;
         Stream       stream   = assembly.GetManifestResourceStream("TrainingDB.long.txt");
         StreamReader input    = new StreamReader(stream);
         while (!input.EndOfStream)
         {
             string line = input.ReadLine();
             LongActivityDefinition activity = LongActivityDefinition.ParseCSV(line);
             conn.Insert(activity);
         }
     }
     catch (Exception e) {
     }
 }