Ejemplo n.º 1
0
 private void _BKWGraduationPlanLoader_DoWork(object sender, DoWorkEventArgs e)
 {
     _LoadGraduationPlanAgain = true;
     while (_LoadGraduationPlanAgain)
     {
         try
         {
             _LoadGraduationPlanAgain = false;
             _Items = new Dictionary <string, GraduationPlanInfo>();
             DSResponse        resp     = QueryGraduationPlan.GetGraduationPlan();
             List <XmlElement> SortList = new List <XmlElement>();
             foreach (XmlElement gPlan in resp.GetContent().GetElements("GraduationPlan"))
             {
                 SortList.Add(gPlan);
             }
             SortList.Sort(new GPlanXmlSorter());
             foreach (XmlElement gPlan in SortList)
             {
                 _Items.Add(gPlan.SelectSingleNode("@ID").InnerText, new GraduationPlanInfo(gPlan));
             }
         }
         catch (Exception exc)
         {
             SmartSchool.ExceptionHandler.BugReporter.ReportException(new Exception("取得課程規劃表資料時發生錯誤。", exc), false);
         }
     }
     _LoadingEvent.Set();
 }
Ejemplo n.º 2
0
        public void InvokGraduationPlanUpdated(string id)
        {
            GraduationPlanInfo oldInfo = null;
            GraduationPlanInfo newInfo = null;

            if (GraduationPlan.GraduationPlan.Instance._Items.ContainsKey(id))
            {
                oldInfo = GraduationPlan.GraduationPlan.Instance._Items[id];
                DSResponse        resp     = QueryGraduationPlan.GetGraduationPlan(id);
                List <XmlElement> SortList = new List <XmlElement>();
                XmlElement        gPlan    = resp.GetContent().GetElement("GraduationPlan");
                if (gPlan != null)
                {
                    newInfo = new GraduationPlanInfo(gPlan);
                    GraduationPlan.GraduationPlan.Instance._Items[id] = newInfo;
                }
                else
                {
                    GraduationPlan.GraduationPlan.Instance._Items.Remove(id);
                }
            }
            if (GraduationPlanUpdated != null)
            {
                GraduationPlanUpdated.Invoke(this, new UpdateGraduationPlanEventArgs(oldInfo, newInfo));
            }
        }