private bool FrontLoader_FindUnPlannedActivity() { UnPlannedActivity = (UnPlannedActivityRole)AllActivities.FirstOrDefault(a => a.EarlyStart == 0 && !Model.PredecessorsOf(a).Any(p => p.EarlyFinish == 0)); return(UnPlannedActivity != null); }
public void FrontLoader_Plans() { AllActivities.ForEach(a => a.EarlyStart = 0); while (FrontLoader_FindUnPlannedActivity()) { UnPlannedActivity_FrontLoad(); } }
public void AddActivity(Activity activity) { if (!AllActivities.Any()) { activity.StartTime = BeginTime; } else { var last = AllActivities.Last(); activity.StartTime = last.StartTime + last.Length; } activity.PropertyChanged += OnActivityChanged; _activityList.AddActivity(activity); }
// Goes through the list of activities and updates their start time (makes sure that an activity always starts when the previous one ends). private void RecalculateActivityStartTimes() { if (AllActivities.Any()) { var start = BeginTime; var length = TimeSpan.Zero; foreach (var activity in AllActivities) { activity.StartTime = start + length; start = activity.StartTime.Value; length = activity.Length; } } }
public Activity GetActivityById(int activityId) { return(AllActivities.FirstOrDefault(p => p.ActivityId == activityId)); }