Exemple #1
0
 static void PrintAllEntries()
 {
     using (var repo = new EntryRepo())
     {
         foreach (Entry e in repo.GetAll())
         {
             Console.WriteLine(e.ToString());
         }
         Console.WriteLine();
     }
 }
Exemple #2
0
 static void PrintSubjects()
 {
     using (var repo = new EntryRepo())
     {
         IList <Entry>    entries  = repo.GetAll();
         HashSet <string> subjects = new HashSet <string>(from e in entries select e.Subject);
         foreach (string s in subjects)
         {
             Console.WriteLine(s);
         }
         Console.WriteLine();
     }
 }
Exemple #3
0
        public MainWindowViewModel()
        {
            try
            {
                using (var repo = new EntryRepo())
                {
                    _entries = new List <Entry>(repo.GetAll());
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Unable to connect to data source", "Study Application");
                Environment.Exit(1);
            }

            uniqueSubjects = new ObservableCollection <string>(_entries.Select(e => e.Subject).Distinct().OrderBy(s => s));

            newSubject = new NewSubject(uniqueSubjects);

            DurationTimer        = new Timer(state => DurationTimer_Tick(), null, Timeout.Infinite, 1000);
            DurationTimerRunning = false;
        }