Пример #1
0
        private void button_ppp_Click(object sender, EventArgs e)
        {
            List <Task> tasks = new List <Task>();

            char[] spliter = new char[] { ' ', ',', '-', ':' };
            foreach (var item in this.textBox_baseLines.Lines)
            {
                Task task = new Task();
                task.Sites = new List <Site>();

                task.Id            = ++BasicId;
                task.Name          = "PPP_" + BasicId;
                task.ResultFtp     = this.textBox_resultFtp.Text.Trim();
                task.Time          = new Time(this.dateTimePicker1.Value);
                task.OperationName = Interoperation.Bernese.PcfName.PPP;
                task.Campaign      = this.textBox_campaign.Text.Trim();
                string[] sites = item.Split(spliter, StringSplitOptions.RemoveEmptyEntries);
                foreach (var site in sites)
                {
                    task.Sites.Add(new Site()
                    {
                        Name = site
                    });
                }

                tasks.Add(task);
            }

            TaskMgr mgr = new TaskMgr();

            mgr.AddRange(tasks);
            mgr.Save();

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
Пример #2
0
 private void SiteNodeMgrForm_Load(object sender, EventArgs e)
 {
     taskMgr   = new TaskMgr();
     tasks     = new TaskMgr(Setting.GnsserConfig.TaskFilePath, Setting.GnsserConfig.SiteFilePath).GetAllTasks();
     siteNames = tasks.ToArray();// taskMgr.File.ReadAllLines(Setting.SiteFilePath);
     BindMain();
 }
Пример #3
0
        /// <summary>
        /// 解析XML
        /// </summary>
        /// <param name="ComputeNodeFilePath"></param>
        /// <param name="TaskFilePath"></param>
        /// <returns></returns>
        public static List <BerComputeNode> LoadComputeNodes(string ComputeNodeFilePath, string TaskFilePath, string sitePath)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(ComputeNodeFilePath);

            List <Task> tasks = new TaskMgr(TaskFilePath, sitePath).GetAllTasks();

            List <BerComputeNode> list = new List <BerComputeNode>();

            foreach (XmlNode item in doc.DocumentElement.ChildNodes)
            {
                BerComputeNode node = new BerComputeNode();
                node.Id      = int.Parse(item.SelectSingleNode("./Id").InnerText);
                node.Name    = item.SelectSingleNode("./Name").InnerText;
                node.Ip      = item.SelectSingleNode("./IP").InnerText;
                node.Port    = int.Parse(item.SelectSingleNode("./Port").InnerText);
                node.Enabled = Boolean.Parse(item.SelectSingleNode("./Enabled").InnerText);

                List <int> taskId = BerComputeNode.ParseTaskIdsString(item.SelectSingleNode("./TaskId").InnerText);
                try
                {
                    node.Tasks = tasks.FindAll(m => taskId.Contains(m.Id));
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }

                list.Add(node);
            }
            return(list);
        }
Пример #4
0
        private void BindMain()
        {
            mgr = new TaskMgr();

            List <Task> list = new TaskMgr(Setting.GnsserConfig.TaskFilePath, Setting.GnsserConfig.SiteFilePath).GetAllTasks();

            if (list.Count != 0)
            {
                TaskEditForm.BasicId           = list[list.Count - 1].Id;
                BuildtBaseLineStakForm.BasicId = list[list.Count - 1].Id;
            }
            this.bindingSource_task.DataSource = list;
        }