本文整理汇总了C#中Project.Set方法的典型用法代码示例。如果您正苦于以下问题:C# Project.Set方法的具体用法?C# Project.Set怎么用?C# Project.Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public static void Run()
{
try
{
// ExStart:WriteMPPProjectSummary
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
// Instantiate Project class
Project project = new Project(dataDir + "WriteMPPProjectSummary.mpp");
// Set project summary
project.Set(Prj.Author, "Author");
project.Set(Prj.LastAuthor, "Last Author");
project.Set(Prj.Revision, 15);
project.Set(Prj.Keywords, "MSP Aspose");
project.Set(Prj.Comments, "Comments");
project.Save(dataDir + "WriteMPPProjectSummary_out.mpp", SaveFileFormat.MPP);
// ExEnd:WriteMPPProjectSummary
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
}
}
示例2: 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
}
示例3: Run
public static void Run()
{
// ExStart:RescheduleProjectStartOrFinishDate
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
Project project = new Project(dataDir + "Project2.mpp");
project.Set(Prj.ScheduleFromStart, false);
project.Set(Prj.FinishDate, new DateTime(2020, 1, 1));
// Now all tasks dates (Start, Finish, EarlyStart, EarlyFinish, LateStart, LateFinish) are calculated. To get the critical path we need to calculate slacks (can be invoked in separate thread, but only after calculation of all early/late dates)
project.Recalculate();
TaskCollection criticalPath = project.CriticalPath;
// ExEnd:RescheduleProjectStartOrFinishDate
}
示例4: Run
public static void Run()
{
try
{
var lic = new License();
lic.SetLicense(@"E:\Aspose\License\Aspose.Tasks.lic");
// ExStart:WriteFormulasInExtendedAttributesToMPP
// Create project instance
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
Project project = new Project(dataDir + "Project1.mpp");
project.Set(Prj.NewTasksAreManual, false);
// Create new custom field (Task Text1) with formula which will double task cost
ExtendedAttributeDefinition attr = new ExtendedAttributeDefinition();
attr.FieldId = ExtendedAttributeTask.Text1.ToString("D");
attr.Alias = "Double Costs";
attr.Formula = "[Cost]*2";
project.ExtendedAttributes.Add(attr);
// Add a task
Task task = project.RootTask.Children.Add("Task");
// Set task cost
task.Set(Tsk.Cost, 100);
// Save project
project.Save(dataDir + "WriteFormulasInExtendedAttributesToMPP_out.mpp", SaveFileFormat.MPP);
// ExEnd:WriteFormulasInExtendedAttributesToMPP
}
catch(Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
}
}
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:35,代码来源:WriteFormulasInExtendedAttributesToMPP.cs
示例5: Run
public static void Run()
{
// ExStart:ApplyCalculationModeManual
// Create empty project and set calculation mode to Manual
Project project = new Project();
project.CalculationMode = CalculationMode.Manual;
// Set project start date and add new tasks
project.Set(Prj.StartDate, new DateTime(2015, 4, 15));
Task task1 = project.RootTask.Children.Add("Task 1");
Task task2 = project.RootTask.Children.Add("Task 2");
// The necessary properties are set in manual mode
Console.WriteLine("Task1.Id Equals 1 : {0} ", task1.Get(Tsk.Id).Equals(1));
Console.WriteLine("Task1 OutlineLevel Equals 1 : {0} ", task1.Get(Tsk.OutlineLevel).Equals(1));
Console.WriteLine("Task1 Start Equals 15/04/2015 08:00 AM : {0} ", task1.Get(Tsk.Start).Equals(new DateTime(2015, 4, 15, 8, 0, 0)));
Console.WriteLine("Task1 Finish Equals 15/04/2015 05:00 PM : {0} ", task1.Get(Tsk.Finish).Equals(new DateTime(2015, 4, 15, 17, 0, 0)));
Console.WriteLine("Task1 Duration Equals 1 day : {0} ", task1.Get(Tsk.Duration).ToString().Equals("1 day"));
Console.WriteLine("Task2 Start Equals 15/04/2015 08:00 AM : {0} ", task2.Get(Tsk.Start).Equals(new DateTime(2015, 4, 15, 8, 0, 0)));
Console.WriteLine("Task2 Finish Equals 15/04/2015 05:00 PM : {0} ", task2.Get(Tsk.Finish).Equals(new DateTime(2015, 4, 15, 17, 0, 0)));
Console.WriteLine("Task2 Duration Equals 1 day : {0} ", task2.Get(Tsk.Duration).ToString().Equals("1 day"));
// When we link two tasks together their dates are not recalculated in manual mode
TaskLink link = project.TaskLinks.Add(task1, task2, TaskLinkType.FinishToStart);
// Task 2 Start has not been changed
Console.WriteLine("Task1 Start Equals Task2 Start : {0} ", task1.Get(Tsk.Start).Equals(task2.Get(Tsk.Start)));
Console.WriteLine("Task1 Finish Equals Task2 Finish : {0} ", task1.Get(Tsk.Finish).Equals(task2.Get(Tsk.Finish)));
// ExEnd:ApplyCalculationModeManual
}
示例6: Run
public static void Run()
{
// ExStart:UpdateProjectAndRescheduleUncompletedWork
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
// Create a new project and set start date
Project project = new Project();
project.Set(Prj.StartDate, new DateTime(2014, 1, 27, 8, 0, 0));
// Add new tasks
Task task1 = project.RootTask.Children.Add("Task 1");
Task task2 = project.RootTask.Children.Add("Task 2");
task2.Set(Tsk.Duration, task2.ParentProject.GetDuration(16, TimeUnitType.Hour));
Task task3 = project.RootTask.Children.Add("Task 3");
task3.Set(Tsk.Duration, task2.ParentProject.GetDuration(24, TimeUnitType.Hour));
Task task4 = project.RootTask.Children.Add("Task 4");
task4.Set(Tsk.Duration, task2.ParentProject.GetDuration(16, TimeUnitType.Hour));
Task task5 = project.RootTask.Children.Add("Task 5");
task5.Set(Tsk.Duration, task2.ParentProject.GetDuration(16, TimeUnitType.Hour));
// Add links between tasks
TaskLink link12 = project.TaskLinks.Add(task1, task2, TaskLinkType.FinishToStart);
TaskLink link23 = project.TaskLinks.Add(task2, task3, TaskLinkType.FinishToStart);
// One day lag
link23.LinkLag = 4800;
TaskLink link34 = project.TaskLinks.Add(task3, task4, TaskLinkType.FinishToStart);
TaskLink link45 = project.TaskLinks.Add(task4, task5, TaskLinkType.FinishToStart);
// Add new tasks
Task task6 = project.RootTask.Children.Add("Task 6");
Task task7 = project.RootTask.Children.Add("Task 7");
task7.Set(Tsk.Duration, task7.ParentProject.GetDuration(24, TimeUnitType.Hour));
Task task8 = project.RootTask.Children.Add("Task 8");
task8.Set(Tsk.Duration, task2.ParentProject.GetDuration(16, TimeUnitType.Hour));
Task task9 = project.RootTask.Children.Add("Task 9");
task9.Set(Tsk.Duration, task2.ParentProject.GetDuration(16, TimeUnitType.Hour));
Task task10 = project.RootTask.Children.Add("Task 10");
// Add links between tasks
TaskLink link67 = project.TaskLinks.Add(task6, task7, TaskLinkType.FinishToStart);
TaskLink link78 = project.TaskLinks.Add(task7, task8, TaskLinkType.FinishToStart);
TaskLink link89 = project.TaskLinks.Add(task8, task9, TaskLinkType.FinishToStart);
TaskLink link910 = project.TaskLinks.Add(task9, task10, TaskLinkType.FinishToStart);
task6.Set(Tsk.IsManual, true);
task7.Set(Tsk.IsManual, true);
task8.Set(Tsk.IsManual, true);
task9.Set(Tsk.IsManual, true);
task10.Set(Tsk.IsManual, true);
// Save project before and after updating work as completed
project.Save(dataDir + "RescheduleUncompletedWork_not updated_out.xml", SaveFileFormat.XML);
project.UpdateProjectWorkAsComplete(new DateTime(2014, 1, 28, 17, 0, 0), false);
project.Save(dataDir + "RescheduleUncompletedWork_updated_out.xml", SaveFileFormat.XML);
// Save project after rescheduling uncompleted work
project.RescheduleUncompletedWorkToStartAfter(new DateTime(2014, 2, 7, 8, 0, 0));
project.Save(dataDir + "RescheduleUncompletedWork_rescheduled_out.xml", SaveFileFormat.XML);
// ExEnd:UpdateProjectAndRescheduleUncompletedWork
}
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:60,代码来源:UpdateProjectAndRescheduleUncompletedWork.cs
示例7: Run
public static void Run()
{
// ExStart:WriteWeekdayProperties
// 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+ "WriteWeekdayProperties.mpp");
// Set week days properties
project.Set(Prj.WeekStartDay, DayType.Monday);
project.Set(Prj.DaysPerMonth, 24);
project.Set(Prj.MinutesPerDay, 540);
project.Set(Prj.MinutesPerWeek, 3240);
project.Save(dataDir + "WriteWeekdayProperties_out.xml", SaveFileFormat.XML);
// ExEnd:WriteWeekdayProperties
}
示例8: Run
public static void Run()
{
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
// ExStart:CustomizeDateFormats
Project project = new Project(dataDir + "CreateProject2.mpp");
project.Set(Prj.StartDate, new DateTime(2014, 9, 22));
// By default project.DateFormat == DateFormat.Date_ddd_mm_dd_yy (Mon 09/22/14) customize DateFormat (September 22, 2014)
project.Set(Prj.DateFormat, DateFormat.DateMmmmDdYyyy);
project.Save(dataDir + "CustomizeDateFormats1_out.pdf", SaveFileFormat.PDF);
// Export to date format 19/07/2016
project.Set(Prj.DateFormat, DateFormat.DateDdMmYyyy);
project.Save(dataDir + "CustomizeDateFormats2_out.pdf", SaveFileFormat.PDF);
// ExEnd:CustomizeDateFormats
}
示例9: Run
public static void Run()
{
// ExStart:WriteCurrencyProperties
// 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 + "WriteCurrencyProperties.mpp");
// Set currency properties
project.Set(Prj.CurrencyCode, "AUD");
project.Set(Prj.CurrencyDigits, 2);
project.Set(Prj.CurrencySymbol, "$");
project.Set(Prj.CurrencySymbolPosition, CurrencySymbolPositionType.After);
// Save the project as XML project file
project.Save(dataDir + "WriteCurrencyProperties_out.xml", SaveFileFormat.XML);
// ExEnd:WriteCurrencyProperties
}
示例10: Run
public static void Run()
{
// ExStart:WriteUpdatedCalendarDataToMPP
string resultFile = "result_WriteUpdatedCalendarDataToMPP_out.mpp";
string newFile = "project_update_test.mpp";
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
try
{
// Create project instance and access calendar
Project project = new Project(dataDir + newFile);
Calendar cal = project.Calendars.GetByUid(3);
// Update the calendar information
Calendar.MakeStandardCalendar(cal);
cal.Name = "Test calendar";
CalendarException exc = new CalendarException();
exc.FromDate = DateTime.Now;
exc.ToDate = DateTime.Now.AddDays(2);
exc.DayWorking = true;
WorkingTime wt1 = new WorkingTime();
wt1.FromTime = new DateTime(10, 1, 1, 9, 0, 0);
wt1.ToTime = new DateTime(10, 1, 1, 13, 0, 0);
WorkingTime wt2 = new WorkingTime();
wt2.FromTime = new DateTime(10, 1, 1, 14, 0, 0);
wt2.ToTime = new DateTime(10, 1, 1, 19, 0, 0);
WorkingTime wt3 = new WorkingTime();
wt3.FromTime = new DateTime(10, 1, 1, 20, 0, 0);
wt3.ToTime = new DateTime(10, 1, 1, 21, 0, 0);
exc.WorkingTimes.Add(wt1);
exc.WorkingTimes.Add(wt2);
exc.WorkingTimes.Add(wt3);
cal.Exceptions.Add(exc);
CalendarException exc2 = new CalendarException();
exc2.FromDate = DateTime.Now.AddDays(7);
exc2.ToDate = exc2.FromDate;
exc2.DayWorking = false;
cal.Exceptions.Add(exc2);
project.Set(Prj.Calendar, cal);
// Save project
project.Save(dataDir + resultFile, SaveFileFormat.MPP);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
}
// ExEnd:WriteUpdatedCalendarDataToMPP
}
示例11: Run
public static void Run()
{
// ExStart:SetCurrencyDigits
// Create new project and set currency digits
Project project1 = new Project();
project1.Set(Prj.CurrencyDigits, 2);
// ExEnd:SetCurrencyDigits
// Save project as XML
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
project1.Save(dataDir + "project_CurrencyDigits_out.xml", SaveFileFormat.XML);
}
示例12: Run
public static void Run()
{
// ExStart:ReadWriteTimephasedData
// Create project instance
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);
Project project1 = new Project(dataDir + "ReadWriteTimephasedData.mpp");
// Set project properties
project1.Set(Prj.StartDate, new DateTime(2013, 10, 30, 9, 0, 0));
project1.Set(Prj.NewTasksAreManual, false);
// Add task and resources
Task task = project1.RootTask.Children.Add("Task");
Resource rsc = project1.Resources.Add("Rsc");
// Set resource rates and task duration
rsc.Set(Rsc.StandardRate, 10);
rsc.Set(Rsc.OvertimeRate, 15);
task.Set(Tsk.Duration, project1.GetDuration(6));
// Create resource assignment
ResourceAssignment assn = project1.ResourceAssignments.Add(task, rsc);
assn.Set(Asn.Stop, DateTime.MinValue);
assn.Set(Asn.Resume, DateTime.MinValue);
// Set Backloaded contour, it increases task duration from 6 to 10 days
assn.Set(Asn.WorkContour, WorkContourType.BackLoaded);
project1.SetBaseline(BaselineType.Baseline);
task.Set(Tsk.PercentComplete, 50);
// Read timephased data
List<TimephasedData> td = assn.GetTimephasedData(assn.Get(Asn.Start), assn.Get(Asn.Finish), TimephasedDataType.AssignmentRemainingWork).ToList();
Console.WriteLine(td.Count);
foreach(TimephasedData timePhasedValue in td)
{
Console.WriteLine(timePhasedValue.Value);
}
// ExEnd:ReadWriteTimephasedData
}
示例13: CreateTestProjectWithCustomFieldWithoutResource
static Project CreateTestProjectWithCustomFieldWithoutResource()
{
Project project = new Project();
project.Set(Prj.StartDate, new DateTime(2015, 3, 6, 8, 0, 0));
ExtendedAttributeDefinition attr = new ExtendedAttributeDefinition();
attr.FieldId = ExtendedAttributeTask.Text1.ToString("D");
project.ExtendedAttributes.Add(attr);
Task task = project.RootTask.Children.Add("Task");
ExtendedAttribute a = attr.CreateExtendedAttribute();
task.ExtendedAttributes.Add(a);
return project;
}
示例14: Run
public static void Run()
{
try
{
// ExStart:WriteFiscalYearProperties
// 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 + "WriteFiscalYearProperties.mpp");
// Set fiscal year properties
project.Set(Prj.FyStartDate, Month.July);
project.Set(Prj.FiscalYearStart, true);
project.Save(dataDir + "WriteFiscalYearProperties_out.mpp", SaveFileFormat.MPP);
// ExEnd:WriteFiscalYearProperties
}
catch (Exception ex)
{
Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
}
}
示例15: CreateTestProjectWithCustomField
private static Project CreateTestProjectWithCustomField()
{
Project project = new Project();
project.Set(Prj.StartDate, new DateTime(2015, 3, 6, 8, 0, 0));
ExtendedAttributeDefinition attr = new ExtendedAttributeDefinition();
attr.FieldId = ExtendedAttributeTask.Text1.ToString("D");
project.ExtendedAttributes.Add(attr);
Task task = project.RootTask.Children.Add("Task");
ExtendedAttribute extendedAttribute = attr.CreateExtendedAttribute();
task.ExtendedAttributes.Add(extendedAttribute);
Resource rsc = project.Resources.Add("Rsc");
ResourceAssignment resourceAssignment = project.ResourceAssignments.Add(task, rsc);
return project;
}