Ejemplo n.º 1
0
 private void LawView_Load(object sender, EventArgs e)
 {
     //mh = new Utity.MouseHook();
     //mh.SetHook();
     //mh.MouseMoveEvent += Mh_MouseMoveEvent;
     //this.Text += "-"+law.title + " " + law.version;
     lbl_title.Text    = law.title + " " + law.version;
     lbl_welcome.Text += Global.user.Xm;
     if (law != null)
     {
         //如果在线,且未下载到本地,则从远程获取章节信息,并入库
         if (Global.online && "0" == law.isLocal)
         {
             List <Node> nodes = RemoteWorker.getBookContent(law.lawId);   //获取法规整体章节结构
             RemoteWorker.getNodeDetail(nodes.Select(n => n.Id).ToList()); //再获取每个章节的内容
         }
         nodes = db.getNodeByLawId(law.lawId);
         //绑定关系
         tags = NodeWorker.buildRelationFromNode(nodes);
         bindTagsToDGW();
         //绑定树结构
         string content = NodeWorker.buildFromNodeContext(NodeTree, nodes);
         //绑定法规内容
         wb.DocumentText = content;
         SetAutoWrap(true);
         if (Global.online)// && string.IsNullOrEmpty(law.isLocal))
         {
             //远程获取评论
             RemoteWorker.getOpinionList(law.lawId);
             //加载评论
             loadComment();
         }
         //加载文档信息
         lawInfo1.law        = law;
         lawInfo1.parentForm = this.parentForm;
         lawInfo1.fillLawVersion(laws);
         lawInfo1.fillLawInfo();
         lawInfo1.bindState = true;
         //写入阅读历史
         ViewHistory history = new ViewHistory()
         {
             Id       = law.lawId,
             LawID    = law.lawId,
             UserID   = Global.user.Id,
             ViewDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
         };
         if (db.saveHistory(history))
         {
             ((LibraryList)parentForm).addHistory(history);
         }
     }
 }