Exemplo n.º 1
0
        private void InitializeConfig()
        {
            FileStream    file       = new FileStream(AppDomain.CurrentDomain.BaseDirectory + @"\" + "DataSynchConfig.xml", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            XmlSerializer serializer = new XmlSerializer(typeof(JobConfig));

            _systems = (JobConfig)serializer.Deserialize(file);
            file.Close();

            _allJobs = new Collection <Job>();
            foreach (SystemsJobDefine system in _systems.JobsOfSystem)
            {
                foreach (Job job in system.Jobs)
                {
                    _allJobs.Add(job);
                }
            }
        }
Exemplo n.º 2
0
        public SynchTreeView(JobConfig jobConfig)
        {
            ImageList list = new ImageList();

            list.ImageSize = new Size(16, 16);
            list.Images.Add(ResourceManager.GetSmallIcon(ResourceNames.Perform, IconType.Normal), Color.Magenta);
            list.Images.Add(ResourceManager.GetSmallIcon(ResourceNames.Stop, IconType.Normal), Color.Magenta);
            list.Images.Add(ResourceManager.GetSmallIcon(ResourceNames.FolderOpen, IconType.Normal), Color.Magenta);
            list.Images.Add(ResourceManager.GetSmallIcon(ResourceNames.NewDocument, IconType.Normal), Color.Magenta);
            list.Images.Add(ResourceManager.GetSmallIcon(ResourceNames.Delete, IconType.Normal), Color.Magenta);
            this.ImageList     = list;
            this.CheckBoxes    = false;
            this.HideSelection = false;

            CreateTree(jobConfig);


            this.AfterSelect += new TreeViewEventHandler(SynchTreeView_AfterSelect);
        }
Exemplo n.º 3
0
        private void CreateTree(JobConfig jobConfig)
        {
            if (jobConfig != null)
            {
                TreeNode root;
                TreeNode child;

                foreach (SystemsJobDefine system in jobConfig.JobsOfSystem)
                {
                    // 创建根节点
                    root = Nodes.Add(system.Name);
                    SetNodeIcon(root);

                    foreach (Job job in system.Jobs)
                    {
                        child     = root.Nodes.Add(job.Name);
                        child.Tag = job;
                        SetNodeIcon(child);
                    }
                }
            }
        }