Exemplo n.º 1
0
        public ExtConnManager(ViCPUInfo cpu)
        {
            this.CPU = cpu;
            string cpuKey = cpu.Key;

            this.ExtConnPOEPath = cpu.CurrProject.ProjectEnvPath + cpuKey + ViNamedObject.PathSeperator + cpuKey + "_ExtCon.POE";
        }
Exemplo n.º 2
0
        /// <summary>
        /// 向工程中添加 CPU。
        /// </summary>
        /// <param name="makefile">CPU 的 Makefile 全路径名称。</param>
        /// <returns>成功与否?</returns>
        public bool AddCPU(ViCPUInfo cpu)
        {
            if (cpu == null)
            {
                return(false);
            }

            base.AddChild(cpu);

            return(true);
        }
Exemplo n.º 3
0
 public ExtVariablePath(ProjectManager project, ViCPUInfo cpu, string variablePath)
 {
     if (project != null)
     {
         ProjectName = project.ProjectName;
     }
     if (cpu != null)
     {
         CPUName = cpu.Name;
     }
     if (!string.IsNullOrEmpty(variablePath))
     {
         VariablePath = variablePath.Trim();
     }
 }
Exemplo n.º 4
0
        private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ViCPUInfo       currCpu  = (ViCPUInfo)d;
            SolutionManager solution = currCpu.TheSolution;

            if ((bool?)e.NewValue == true)
            {
                solution.LoopCPUs((cpu) =>
                {
                    if (cpu != currCpu && cpu.IsActive)
                    {
                        cpu.IsActive = false;
                    }
                    return(true);
                });
            }
        }
Exemplo n.º 5
0
        public override void ExecutedCommand(object sender, System.Windows.Input.ExecutedRoutedEventArgs e)
        {
            if (e.Command == ViCommands.Link)
            {
                this.Linked = true;
                ViCPUInfo cpu = this.Parent as ViCPUInfo;
                cpu.TaskManager.LinkTask(this.FullName);
            }
            else if (e.Command == ViCommands.Unlink)
            {
                this.Linked = false;
                ViCPUInfo cpu = this.Parent as ViCPUInfo;
                cpu.TaskManager.UnlinkTask(this.FullName);
            }

            base.ExecutedCommand(sender, e);
        }
Exemplo n.º 6
0
        protected override bool LoadDocument(XmlDocument doc)
        {
            XmlElement root = doc.DocumentElement;

            if (root == null || !Constants.TAG.Project.Equals(root.Name))
            {
                return(false);
            }

            this.Type = root.GetAttribute(Constants.Attribute.Type);
            //String version = root.GetAttribute(Constants.Attribute.Version);
            foreach (XmlNode groupNode in root.ChildNodes)
            {
                // 读取Project本身相关信息;
                if (Constants.TAG.GlobalVariable.Equals(groupNode.Name))
                {
                }
                else if (Constants.TAG.CPUs.Equals(groupNode.Name))
                {
                    // 读取文件相关信息;
                    foreach (XmlNode itemElement in groupNode.ChildNodes)
                    {
                        if (itemElement.NodeType == XmlNodeType.Comment)
                        {
                            continue;
                        }
                        // CPU
                        if (Constants.TAG.CPU.Equals(itemElement.Name))
                        {
                            ViCPUInfo cpu = new ViCPUInfo(String.Empty);
                            this.AddChild(cpu);
                            cpu.LoadElement(itemElement as XmlElement);
                        }
                    }
                }
            }

            return(true);
        }
Exemplo n.º 7
0
        private static void OnIsActiveChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ViCPUInfo       currCpu  = (ViCPUInfo)d;
            SolutionManager solution = currCpu.TheSolution;

            if (solution == null)
            {
                return;
            }

            if ((bool?)e.NewValue == true)
            {
                solution.LoopCPUs((cpu) =>
                {
                    if (cpu != currCpu && cpu.IsActive)
                    {
                        cpu.IsActive = false;
                    }
                    return(true);
                });
                //
                ProjectManager currProject = currCpu.CurrProject;
                currProject.IsActive = true;
                //
                foreach (var item in solution.Children)
                {
                    if (item != currProject && item is ProjectManager)
                    {
                        ProjectManager projectItem = item as ProjectManager;
                        if (projectItem.IsActive)
                        {
                            projectItem.IsActive = false;
                        }
                    }
                }
            }
        }