public static DashboardTaskProperty CreateTaskProperty(MyTask task, string propertyName)
        {
            if (propertyName == null)
                propertyName = "Enabled";

            return new DashboardTaskProperty(task, task.GetType().GetProperty(propertyName));
        }
예제 #2
0
 public MyDebugTaskNode(MyTask task)
     : base(task)
 {
     Icon = Properties.Resources.gears;
     OwnerName = task.GetType().Name;
 }
예제 #3
0
        public override void Restore(MyProject project)
        {
            string[] idSplit = PropertyId.Split(new[] { SerializationIdSeparator }, StringSplitOptions.RemoveEmptyEntries);

            Node = FindNode(project, idSplit[0]);

            var workingNode = Node as MyWorkingNode;
            if (workingNode == null)
                throw new SerializationException("A task dashboard property found a node without tasks");

            Task = workingNode.GetTaskByPropertyName(idSplit[1]);

            if (Task == null)
                throw new SerializationException("A task dashboard property did not find the target task");

            PropertyInfo = Task.GetType().GetProperty(idSplit[2]);

            if (PropertyInfo == null)
                throw new SerializationException("A task dashboard property was not found on the task");
        }
예제 #4
0
 public DashboardTaskProperty(MyTask task, PropertyInfo propertyInfo)
     : base(task.GenericOwner, propertyInfo)
 {
     Task = task;
 }
예제 #5
0
        public override void Restore(MyProject project)
        {
            string[] idSplit = PropertyId.Split(new [] {SerializationIdSeparator}, StringSplitOptions.RemoveEmptyEntries);

            var success = false;

            int nodeId;
            if (int.TryParse(idSplit[0], out nodeId))
            {
                Node = project.GetNodeById(nodeId);
                if (Node != null)
                    success = true;
            }

            if (!success)
                throw new SerializationException("A task dashboard property did not find the specified node");

            var workingNode = Node as MyWorkingNode;
            if (workingNode == null)
                throw new SerializationException("A task dashboard property found a node without tasks");

            Task = workingNode.GetTaskByPropertyName(idSplit[1]);

            if (Task == null)
                throw new SerializationException("A task dashboard property did not find the target task");

            PropertyInfo = Task.GetType().GetProperty(idSplit[2]);

            if (PropertyInfo == null)
                throw new SerializationException("A task dashboard property was not found on the task");
        }