Example #1
0
        public static VisionTaskInfoDoc LoadObj()
        {
            VisionTaskInfoDoc pDoc = new VisionTaskInfoDoc();

            try
            {
                XmlSerializer xmlSerializer = new XmlSerializer(typeof(VisionTaskInfoDoc));
                FileStream    fsReader      = null;
                fsReader = File.OpenRead(@".//Parameter/VisionTaskInfoDoc.xml");
                pDoc     = (VisionTaskInfoDoc)xmlSerializer.Deserialize(fsReader);
                fsReader.Close();
                pDoc.TasksInfoDic = pDoc.TasksInfoList.ToDictionary(p => p.TaskName);
                foreach (var item in pDoc.TasksInfoList)
                {
                    item.TaskToolInfoDic = item.TaskToolsInfo.ToDictionary(p => p.ToolName);
                }
            }
            catch
            {
                pDoc.TasksInfoList.Clear();
            }

            return(pDoc);
        }
 public static void LoadDoc()
 {
     doc = VisionTaskInfoDoc.LoadObj();
 }