コード例 #1
0
    public void IncrementMotivation()
    {
        if (MotivationManager.Instance == null)
        {
            return;
        }

        MotivationManager manager = MotivationManager.Instance;

        switch (type)
        {
        case MotivationType.Gain:
            manager.UpdateMotivation(MotivationType.Gain);
            break;

        case MotivationType.Reduce:
            manager.UpdateMotivation(MotivationType.Reduce);
            break;
        }
    }
コード例 #2
0
 public void OutputLog(string msg, MotivationManager.Model.LogModel.LogLevel level)
 {
     if (this.IsHandleCreated)
     {
         this.tbMsg.Invoke((MethodInvoker)delegate()
         {
             lock (this.tbMsg)
             {
                 DateTime dtime = DateTime.Now;
                 this.tbMsg.AppendText("[" + dtime + "] " + msg + "\r\n");
             }
         });
     }
 }
コード例 #3
0
 public void OutputLabel(string msg, MotivationManager.Model.LogModel.LogLevel level)
 {
     if (this.IsHandleCreated)
     {
         this.Invoke((MethodInvoker)delegate()
         {
             lock (this.lbMsg)
             {
                 this.lbMsg.Caption = msg;
                 Application.DoEvents();
                 Controller.Log.WriteLog(msg, level);
             }
         });
     }
 }
コード例 #4
0
 private void OnDestroy()
 {
     Instance = null;
 }
コード例 #5
0
 private void Awake()
 {
     Instance = this;
 }
コード例 #6
0
            public static XmlDocument SaveNumXml(XmlDocument xmlDoc, MotivationManager.Model.DTO.HandleNum handleNum, string filePath = "")
            {
                if (xmlDoc == null || handleNum == null)
                {
                    throw new Exception("XmlDoc或者个数为空");
                }
                //if (string.IsNullOrEmpty(filePath))
                //{
                //    throw new Exception("保存路径为空");
                //}
                XmlNode node = xmlDoc.SelectSingleNode("Performance/HandleNum/UKDetails");
                if (node != null)
                {
                    node.RemoveAll();

                    foreach (Model.DTO.UKHandleNumDetail detail in handleNum.UKDetails.Values)
                    {
                        XmlElement ele = xmlDoc.CreateElement("Detail");
                        ele.SetAttribute("ID", detail.ID);
                        ele.SetAttribute("ContractNum", detail.ContractNum);
                        ele.SetAttribute("StudentName", detail.StudentName);
                        ele.SetAttribute("Education", detail.Education);

                        XmlNode ukNode = xmlDoc.CreateElement("UK");
                        ((XmlElement)ukNode).SetAttribute("FirstFour", detail.UK.FirstFour);
                        ((XmlElement)ukNode).SetAttribute("Doctor", detail.UK.Doctor);
                        ((XmlElement)ukNode).SetAttribute("Cooperation", detail.UK.Cooperation);
                        ele.AppendChild(ukNode);

                        XmlNode typeNode = xmlDoc.CreateElement("QuanType");
                        ((XmlElement)typeNode).SetAttribute("ApplyNum", detail.QuanType.ApplyNum);
                        ((XmlElement)typeNode).SetAttribute("OnlineNum", detail.QuanType.OnlineNum);
                        ((XmlElement)typeNode).SetAttribute("PSNum", detail.QuanType.PSNum);
                        ele.AppendChild(typeNode);

                        XmlNode copywritingNode = xmlDoc.CreateElement("Copywriting");
                        ((XmlElement)copywritingNode).SetAttribute("Senior", detail.CopyWriting.Senior);
                        ((XmlElement)copywritingNode).SetAttribute("Author", detail.CopyWriting.Author);
                        ((XmlElement)copywritingNode).SetAttribute("OldSenior", detail.CopyWriting.OldSenior);
                        ((XmlElement)copywritingNode).SetAttribute("OldAuthor", detail.CopyWriting.OldAuthor);
                        ele.AppendChild(copywritingNode);

                        ele.SetAttribute("SendDate", detail.SendDate.ToString("yyyy/MM/dd"));
                        ele.SetAttribute("GetPeriod", detail.GetPeriod);
                        ele.SetAttribute("Note", detail.Note);
                        node.AppendChild(ele);

                    }
                }

                node = xmlDoc.SelectSingleNode("Performance/HandleNum/HKDetails");
                if (node != null)
                {
                    node.RemoveAll();
                    foreach (Model.DTO.HKHandleNumDetail detail in handleNum.HKDetails.Values)
                    {
                        XmlElement ele = xmlDoc.CreateElement("Detail");
                        ele.SetAttribute("ID", detail.ID);
                        ele.SetAttribute("ContractNum", detail.ContractNum);
                        ele.SetAttribute("StudentName", detail.StudentName);
                        ele.SetAttribute("Education", detail.Education);
                        ele.SetAttribute("Application", detail.Application);

                        XmlNode hkNode = xmlDoc.CreateElement("HK");
                        ((XmlElement)hkNode).SetAttribute("SingaporeMaster", detail.HK.SingaporeMaster);
                        ((XmlElement)hkNode).SetAttribute("Doctor", detail.HK.Doctor);
                        ele.AppendChild(hkNode);

                        ele.SetAttribute("Visa", detail.Visa);
                        XmlNode copywritingNode = xmlDoc.CreateElement("Copywriting");
                        ((XmlElement)copywritingNode).SetAttribute("Senior", detail.CopyWriting.Senior);
                        ((XmlElement)copywritingNode).SetAttribute("Author", detail.CopyWriting.Author);
                        ele.AppendChild(copywritingNode);

                        ele.SetAttribute("SendDate", detail.SendDate.ToString("yyyy/MM/dd"));
                        ele.SetAttribute("Note", detail.Note);
                        node.AppendChild(ele);

                    }
                }

                if (!string.IsNullOrEmpty(filePath))
                {
                    xmlDoc.Save(filePath);
                }
                return xmlDoc;
            }