public void Clear()
 {
     _bands.Clear();
     _groups.Clear();
     _showsummary = false;
     _showheader  = true;
     _showfooter  = true;
     _width       = 80;
     _height      = 60;
     _paperwidth  = 850;
     _paperheight = 1100;
     _cpi         = CPIEnum._10cpi;
     _name        = "";
 }
示例#2
0
 /// <summary>Schedule a grid scan. It will happen over the course of several next ticks, depending on how large the grid is.</summary>
 public void ScanGrid()
 {
     if (GroupFeed != null || BlockFeed != null)
     {
         return; //grid scan already in progress, ignore
     }
     GroupList.Clear();
     PB.GridTerminalSystem.GetBlockGroups(GroupList);
     GroupFeed = FeedList(GroupList, GroupScanTick).GetEnumerator();
     Blocks.Clear();
     PB.GridTerminalSystem.GetBlocks(Blocks);
     BlockFeed = FeedList(Blocks, BlockFound).GetEnumerator();
     Tick1    += RescanTick;
 }
示例#3
0
        /// <summary>
        /// 设置全校有效的组、有课的班级和有课的教师(GroupList、SquadList、TeacherList)
        /// </summary>
        private void SetDataList()
        {
            GroupList.Clear();
            SquadList.Clear();
            TeacherList.Clear();

            foreach (EnClsLesson clsLsn in DataRule.Lsn.eachClsLesson())
            {
                if (clsLsn.SharedTime > 0)
                {
                    if (!SquadList.Contains(clsLsn.Squad))
                    {
                        SquadList.Add(clsLsn.Squad);
                    }
                    if (clsLsn.Teacher != null && !TeacherList.Contains(clsLsn.Teacher))
                    {
                        TeacherList.Add(clsLsn.Teacher);
                    }
                }
            }

            GroupList.Add(AllMember);
            GroupList.Add(AllSquad);
            GroupList.Add(AllTeacher);

            foreach (EnSquad sqd in SquadList)
            {
                foreach (EnSquadGroup grp in DataRule.Sqd.GetGroups(sqd))
                {
                    if (!GroupList.Contains(grp))
                    {
                        GroupList.Add(grp);
                    }
                }
            }

            foreach (EnTeacher tch in TeacherList)
            {
                foreach (EnTeacherGroup grp in DataRule.Tch.GetGroups(tch))
                {
                    if (!GroupList.Contains(grp))
                    {
                        GroupList.Add(grp);
                    }
                }
            }
        }
 private void FileToDatas(string filename)
 {
     for (int dayHour = 0; dayHour < 24; dayHour++)
     {
         string monday    = null;
         string tuesday   = null;
         string wednesday = null;
         string thursday  = null;
         string friday    = null;
         string saturday  = null;
         string sunday    = null;
         Week   week      = new Week((dayHour + " - " + (dayHour + 1)), monday, tuesday, wednesday, thursday, friday, saturday, sunday);
         this.WeekGrid.RemoveAt(dayHour);
         this.WeekGrid.Insert(dayHour, week);
     }
     StudentList.Clear();
     GroupStudentList.Clear();
     GroupList.Clear();
     using (var readFromFile = new StreamReader(filename))
     {
         var deserializer = new XmlSerializer(typeof(ObservableCollection <Student>));
         ObservableCollection <Student> tmpStudentList = (ObservableCollection <Student>)deserializer.Deserialize(readFromFile);
         foreach (var item in tmpStudentList)
         {
             StudentList.Add(item);
         }
         deserializer = new XmlSerializer(typeof(ObservableCollection <Student>));
         foreach (var item in tmpStudentList)
         {
             GroupStudentList.Add(item);
         }
         deserializer = new XmlSerializer(typeof(ObservableCollection <Group>));
         ObservableCollection <Group> tmpGroupList = (ObservableCollection <Group>)deserializer.Deserialize(readFromFile);
         foreach (var item in tmpGroupList)
         {
             GroupList.Add(item);
         }
         deserializer = new XmlSerializer(typeof(ObservableCollection <Week>));
         ObservableCollection <Week> tmpWeekGrid = (ObservableCollection <Week>)deserializer.Deserialize(readFromFile);
         foreach (var item in tmpWeekGrid)
         {
             WeekGrid.Add(item);
         }
     }
 }
 private void NewButtonClick(object sender, RoutedEventArgs e)
 {
     for (int dayHour = 0; dayHour < 24; dayHour++)
     {
         string monday    = null;
         string tuesday   = null;
         string wednesday = null;
         string thursday  = null;
         string friday    = null;
         string saturday  = null;
         string sunday    = null;
         Week   week      = new Week((dayHour + " - " + (dayHour + 1)), monday, tuesday, wednesday, thursday, friday, saturday, sunday);
         this.WeekGrid.RemoveAt(dayHour);
         this.WeekGrid.Insert(dayHour, week);
     }
     StudentList.Clear();
     GroupStudentList.Clear();
     GroupList.Clear();
 }
        public void getListOfGroups(ObservableCollection <Model.FlashCard> flashCards)                    // used to display the group names in to the listview
        {
            ListOfGroups = new ObservableCollection <string>(flashCards.Select(f => f.Group).Distinct()); // locate all the unique group names

            if (GroupList != null)                                                                        // if the listview is full already clear it
            {
                GroupList.Clear();
            }
            foreach (string groupName in ListOfGroups) // loop through all the unique groupname to forge them into objects and add to a new list that will be shown on screen
            {
                ListOfUniqueGroups tempGroup = new ListOfUniqueGroups(groupName);
                if (GroupList == null)
                {
                    GroupList = new ObservableCollection <ListOfUniqueGroups>()
                    {
                        new ListOfUniqueGroups(groupName)
                    };
                }

                GroupList.Add(tempGroup);
            }
            _ = UpdateCloudStorage();
        }
示例#7
0
 void RescanTick(UpdateFrequency freq)
 {   //Feed next part of group/block lists to consumers.
     if (GroupFeed != null)
     {
         if (!GroupFeed.MoveNext())
         {
             GroupFeed = null;
         }
     }
     if (GroupFeed == null && BlockFeed != null)
     {
         if (!BlockFeed.MoveNext())
         {
             BlockFeed = null;
         }
     }
     if (GroupFeed == null && BlockFeed == null)
     {   //once done, we disable ourselves.
         Tick1 -= RescanTick;
         GroupList.Clear();
         Blocks.Clear();
         //we keep the group dictionary, tho
     }
 }
示例#8
0
 public void Clear()
 {
     Groups.Clear();
     GroupList.Clear();
     this.counter = 0;
 }