Aspose.Tasks.Examples.CSharp.WorkingWithTasks.ReadTaskOutlineProperties.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:ReadTaskOutlineProperties
            // Read project from file stream
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
            FileStream fs = new FileStream(dataDir + "TaskOutlineProperties.mpp", FileMode.Open);
            Project prj = new Project(fs);
            fs.Close();

            // Create a ChildTasksCollector instance
            ChildTasksCollector collector = new ChildTasksCollector();

            // Collect all the tasks from RootTask using TaskUtils
            TaskUtils.Apply(prj.RootTask, collector, 0);

            // Parse through all the collected tasks
            foreach (Task tsk1 in collector.Tasks)
            {
                Console.WriteLine(tsk1.Get(Tsk.Name) + " - Outline Level : " + tsk1.Get(Tsk.OutlineLevel));
                Console.WriteLine(tsk1.Get(Tsk.Name) + " - Outline Number : " + tsk1.Get(Tsk.OutlineNumber));
            }
            // ExEnd:ReadTaskOutlineProperties
        }
    }
ReadTaskOutlineProperties