private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     Announcement.getAnnouncementsFromDatabase();
     lblWelcome.Content = "Welcome " + Environment.UserName.Substring(0, 1).ToUpper() + Environment.UserName.Substring(1) + ",";
     //      refreshAnnouncements();
     if (string.IsNullOrEmpty(Announcement_App_2.Properties.Settings.Default.xmlDocumentPath))
     {
         Announcement_App_2.Properties.Settings.Default.xmlDocumentPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\NPSSAnnouncements\\announcements.xml";
         Announcement_App_2.Properties.Settings.Default.Save();
     }
 }
        public void refreshAnnouncements()
        {
            dataGridAnnouncements.Items.Clear();

            foreach (Announcement announcement in Announcement.getAnnouncementsFromDatabase())
            {
                if (announcement.teacherName.ToLower() == Environment.UserName.ToLower())
                {
                    dataGridAnnouncements.Items.Add(announcement);
                }
            }
            sortDataGrid();
        }
        public void refreshAnnouncements()
        {
            dataGridAnnouncements.Items.Clear();
            List <Announcement> announcementList = Announcement.getAnnouncementsFromDatabase();

            foreach (Announcement announcement in announcementList)
            {
                if (announcement.description == "")
                {
                    announcement.description = "No Description.";
                }
                dataGridAnnouncements.Items.Add(announcement);
            }
            sortDataGrid();

            foreach (DataGridColumn column in dataGridAnnouncements.Columns)
            {
                column.SortDirection = null;
            }
        }