当前位置: 首页>>代码示例>>C#>>正文


C# Project.Get方法代码示例

本文整理汇总了C#中Project.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Project.Get方法的具体用法?C# Project.Get怎么用?C# Project.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Project的用法示例。


在下文中一共展示了Project.Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // ExStart:ReadResourceTimephasedData
            // Create project instance
            Project project1 = new Project(dataDir + "ResourceTimephasedData.mpp");

            // Get the Resource by its ID
            Resource resource = project1.Resources.GetByUid(1);

            // Print Timephased data of ResourceWork
            Console.WriteLine("Timephased data of ResourceWork");
            foreach (TimephasedData td in resource.GetTimephasedData(project1.Get(Prj.StartDate), project1.Get(Prj.FinishDate)))
            {
                Console.Write("Start: " + td.Start.ToShortDateString());
                Console.Write(" Work: " + td.Value + Environment.NewLine);
            }

            // Print Timephased data of ResourceCost
            Console.WriteLine("Timephased data of ResourceCost");
            foreach (TimephasedData td in resource.GetTimephasedData(project1.Get(Prj.StartDate), project1.Get(Prj.FinishDate), TimephasedDataType.ResourceCost))
            {
                Console.Write("Start: " + td.Start.ToShortDateString());
                Console.Write(" Cost: " + td.Value + Environment.NewLine);
            }
            // ExEnd:ReadResourceTimephasedData
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:29,代码来源:ReadResourceTimephasedData.cs

示例2: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // ExStart:PrintProjectPagesToSeparateFiles
            Project project = new Project(dataDir + "CreateProject2.mpp");
            ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFileFormat.PNG);
            saveOptions.StartDate = project.Get(Prj.StartDate).AddDays(-3);
            saveOptions.EndDate = project.Get(Prj.FinishDate);
            
            saveOptions.MarkCriticalTasks = true;
            saveOptions.LegendOnEachPage = false;
            
            saveOptions.Gridlines = new List<Gridline>();
            
            Gridline gridline = new Gridline();
            gridline.GridlineType = GridlineType.GanttRow;
            gridline.Color = Color.CornflowerBlue;
            gridline.Pattern = LinePattern.Dashed;
            saveOptions.Gridlines.Add(gridline);
 
            // Save the whole project layout to one file
            project.Save(dataDir + "PrintProjectPagesToSeparateFiles1_out.png", saveOptions);
            
            // Save project layout to separate files
            saveOptions.SaveToSeparateFiles = true;
            project.Save(dataDir + "PrintProjectPagesToSeparateFiles2_out.png", saveOptions);
            // ExEnd:PrintProjectPagesToSeparateFiles
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:30,代码来源:PrintProjectPagesToSeparateFiles.cs

示例3: Run

        public static void Run()
        {
            // ExStart:DetermineProjectVersion
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);  
            
            // Read project from template file
            Project project = new Project(dataDir + "DetermineProjectVersion.mpp");

            // Display project version
            Console.WriteLine("Project Version : " + project.Get(Prj.SaveVersion).ToString());
            Console.WriteLine("Last Saved : " + project.Get(Prj.LastSaved).ToShortDateString());
            // ExEnd:DetermineProjectVersion
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:14,代码来源:DetermineProjectVersion.cs

示例4: Run

        public static void Run()
        {
            // ExStart:ReadFiscalYearProperties
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
            
            // Create a project instance
            Project project = new Project(dataDir + "ReadFiscalYearProperties.mpp");

            // Display fiscal year properties
            Console.WriteLine("Fiscal Year Start Date : " + project.Get(Prj.FyStartDate).ToString());
            Console.WriteLine("Fiscal Year Numbering : " + project.Get(Prj.FiscalYearStart).ToString());
            // ExEnd:ReadFiscalYearProperties
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:14,代码来源:ReadFiscalYearProperties.cs

示例5: Run

        public static void Run()
        {
            // ExStart:CalculateSplitTaskFinishDate
            // Read project            
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
            string projectName = "SplitTaskFinishDate.mpp";
            Project project = new Project(dataDir + projectName);

            // Find a split task
            Task splitTask = project.RootTask.Children.GetByUid(4);

            // Find the project calendar
            Calendar calendar = project.Get(Prj.Calendar);

            // Calculate task's finish date with different durations
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 8 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(8, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 16 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(16, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 24 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(24, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 28 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(28, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 32 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(32, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 46 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(46, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 61 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(61, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 75 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(75, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 80 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(80, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 120 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(120, 0, 0)));
            Console.WriteLine("Start Date: " + splitTask.Get(Tsk.Start).ToShortDateString() + "\n+ Duration 150 hours\nFinish Date: " + calendar.GetTaskFinishDateFromDuration(splitTask, new TimeSpan(150, 0, 0)));
            // ExEnd:CalculateSplitTaskFinishDate
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:28,代码来源:CalculateSplitTaskFinishDate.cs

示例6: Run

        /// <summary>
        /// By default, the project calculation mode is set to automatic that recalculates everything and sets the dates. 
        /// If you are creating a new project, it's start date is as of today and rest of the dates are calculated 
        /// Automatically with reference to this start date. 
        /// </summary>
        public static void Run()
        {
            // ExStart:TaskSettingStartFinishDates
            Project project = new Project();
            Console.WriteLine(project.Get(Prj.StartDate));
            Console.WriteLine(project.CalculationMode.ToString());

            project.CalculationMode = CalculationMode.None;

            Console.WriteLine(project.CalculationMode.ToString());

            Task task = project.RootTask.Children.Add("Task1");

            task.Set(Tsk.Start, new DateTime(2012, 8, 1));
            task.Set(Tsk.Finish, new DateTime(2012, 8, 5));

            Console.WriteLine("*************** Before Recalculate *****************");
            Console.WriteLine(task.Get(Tsk.Start));
            Console.WriteLine(task.Get(Tsk.Finish));


            project.Recalculate();

            Console.WriteLine("*************** After Recalculate *****************");
            Console.WriteLine(task.Get(Tsk.Start));
            Console.WriteLine(task.Get(Tsk.Finish));

            // ExEnd:TaskSettingStartFinishDates
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:34,代码来源:TaskSettingStartFinishDates.cs

示例7: Run

        public static void Run()
        {
            // ExStart:CreateSplitTasks
            // Create new project
            Project splitTaskProject = new Project();

            // Get a standard calendar
            Calendar calendar = splitTaskProject.Get(Prj.Calendar);

            // Set project's calendar settings
            splitTaskProject.Set(Prj.StartDate, new DateTime(2000, 3, 15, 8, 0, 0));
            splitTaskProject.Set(Prj.FinishDate, new DateTime(2000, 4, 21, 17, 0, 0));

            // Add a new task to root task
            Task rootTask = splitTaskProject.RootTask;
            rootTask.Set(Tsk.Name, "Root");
            Task taskToSplit = rootTask.Children.Add("Task1");
            taskToSplit.Set(Tsk.Duration, splitTaskProject.GetDuration(3));

            // Create a new resource assignment and generate timephased data
            ResourceAssignment splitResourceAssignment = splitTaskProject.ResourceAssignments.Add(taskToSplit, null);
            splitResourceAssignment.TimephasedDataFromTaskDuration(calendar);

            // Split the task into 3 parts.
            // Provide start date and finish date arguments to SplitTask method which will be used for split
            splitResourceAssignment.SplitTask(new DateTime(2000, 3, 16, 8, 0, 0), new DateTime(2000, 3, 16, 17, 0, 0), calendar);
            splitResourceAssignment.SplitTask(new DateTime(2000, 3, 18, 8, 0, 0), new DateTime(2000, 3, 18, 17, 0, 0), calendar);
            splitResourceAssignment.Set(Asn.WorkContour, WorkContourType.Contoured);

            // Save the Project
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
            splitTaskProject.Save(dataDir + "CreateSplitTasks_out.xml", SaveFileFormat.XML);
            // ExEnd:CreateSplitTasks
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:34,代码来源:CreateSplitTasks.cs

示例8: Run

        public static void Run()
        {
            // ExStart:ReadWeekdayProperties
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Create project instance
            Project project = new Project(dataDir + "ReadWeekdayProperties.mpp");

            // Display week days properties
            Console.WriteLine("Week Start Date : " + project.Get(Prj.WeekStartDay).ToString());
            Console.WriteLine("Days Per Month : " + project.Get(Prj.DaysPerMonth).ToString());
            Console.WriteLine("Minutes Per Day : " + project.Get(Prj.MinutesPerDay).ToString());
            Console.WriteLine("Minutes Per Week : " + project.Get(Prj.MinutesPerWeek).ToString());
            // ExEnd:ReadWeekdayProperties            
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:16,代码来源:ReadWeekdayProperties.cs

示例9: Run

        public static void Run()
        {
            // ExStart:ReadCurrencyProperties
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Create project instance
            Project project = new Project(dataDir + "ReadCurrencyProperties.mpp");

            // Display currency properties
            Console.WriteLine("Currency Code : " + project.Get(Prj.CurrencyCode).ToString());
            Console.WriteLine("<br>Currency Digits : " + project.Get(Prj.CurrencyDigits).ToString());
            Console.WriteLine("<br>Currency Symbol : " + project.Get(Prj.CurrencySymbol).ToString());
            Console.WriteLine("Currency Symbol Position" + project.Get(Prj.CurrencySymbolPosition).ToString());
            // ExEnd:ReadCurrencyProperties
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:16,代码来源:ReadCurrencyProperties.cs

示例10: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // ExStart:GetCurrencySymbol
            Project project1 = new Project(dataDir + "project.mpp");
            Console.WriteLine(project1.Get(Prj.CurrencySymbol));
            // ExEnd:GetCurrencySymbol
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:10,代码来源:GetCurrencySymbol.cs

示例11: Run

        public static void Run()
        {
            // ExStart:ReplaceCalendar
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
            Project project = new Project(dataDir + "ReplaceCalendar.mpp");

            // Add a new calendar to the project's calendars collection
            project.Calendars.Add("New cal1", project.Get(Prj.Calendar));

            // Now traverse through project calendars and replace the already added calendar with a new one
            CalendarCollection calColl = project.Calendars;

            foreach (Calendar c in calColl)
            {
                if (c.Name == "New cal1")
                {
                    calColl.Remove(c);
                    calColl.Add("New cal2", project.Get(Prj.Calendar));
                    break;
                }
            }
            // ExEnd:ReplaceCalendar            
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:24,代码来源:ReplaceCalendar.cs

示例12: Run

        public static void Run()
        {
            // ExStart:ReadProjectInfo
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName); 

            // Create a project reader instance
            Project project = new Project(dataDir + "ReadProjectInfo.mpp");

            // Display project information
            if (project.Get(Prj.ScheduleFromStart))
                Console.WriteLine("Project Finish Date : " + project.Get(Prj.StartDate).ToShortDateString());
            else
                Console.WriteLine("Project Finish Date : " + project.Get(Prj.FinishDate).ToShortDateString());
            Console.WriteLine(project.Get(Prj.Author));
            Console.WriteLine(project.Get(Prj.LastAuthor));
            Console.WriteLine(project.Get(Prj.Revision));
            Console.WriteLine(project.Get(Prj.Keywords));
            Console.WriteLine(project.Get(Prj.Comments));
            Console.WriteLine("The program has run successfully");
            // ExEnd:ReadProjectInfo
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:22,代码来源:ReadProjectInfo.cs

示例13: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Create project instance
            Project project1 = new Project(dataDir + "ConstraintAsLateAsPossible.mpp");

            // ExStart:SetConstraintAsLateAsPossible
            // Set constraint As Late As Possible for task with Id 11
            Task wallBoard = project1.RootTask.Children.GetById(11);
            wallBoard.Set(Tsk.ConstraintType, ConstraintType.AsLateAsPossible);            
                        
            // Save project as pdf
            SaveOptions options = new PdfSaveOptions();
            options.StartDate = project1.Get(Prj.StartDate);
            options.Timescale = Timescale.ThirdsOfMonths;
            project1.Save(dataDir + "project_AsLateAsPossible_out.pdf", options);
            // ExEnd:SetConstraintAsLateAsPossible
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:20,代码来源:SetConstraintAsLateAsPossible.cs

示例14: Run

        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Create project instance
            Project project1 = new Project(dataDir + "ConstraintMustStartOn.mpp");

            // ExStart:SetConstraintMustStartOn
            // Set constraint Must Start On for task with Id 5
            Task roof = project1.RootTask.Children.GetById(5);
            roof.Set(Tsk.ConstraintType, ConstraintType.MustStartOn);
            roof.Set(Tsk.ConstraintDate, new DateTime(2017, 1, 1, 9, 0, 0));
                        
            // Save project as pdf
            SaveOptions options = new PdfSaveOptions();
            options.StartDate = project1.Get(Prj.StartDate);
            options.Timescale = Timescale.ThirdsOfMonths;
            project1.Save(dataDir + "project_MustStartOn_out.pdf", options);
            // ExEnd:SetConstraintMustStartOn
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:21,代码来源:SetConstraintMustStartOn.cs

示例15: Run

        public static void Run()
        {           
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Create project instance
            Project project1 = new Project(dataDir + "ConstraintFinishNoEarlierThan.mpp");

            // ExStart:SetConstraintFinishNoEarlierThan
            // Set constraint Finish No Earlier Than on task with Id 2
            Task first = project1.RootTask.Children.GetById(2);
            first.Set(Tsk.ConstraintType, ConstraintType.FinishNoEarlierThan);
            first.Set(Tsk.ConstraintDate, new DateTime(2016, 12, 1, 18, 0, 0));
                        
            // Save project as pdf
            SaveOptions options = new PdfSaveOptions();
            options.StartDate = project1.Get(Prj.StartDate);
            options.Timescale = Timescale.ThirdsOfMonths;
            project1.Save(dataDir + "project_FinishNoEarlierThan_out.pdf", options);
            // ExEnd:SetConstraintFinishNoEarlierThan
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:21,代码来源:SetConstraintFinishNoEarlierThan.cs


注:本文中的Project.Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。