private void AddPERTTask() { bool checkName = true; foreach (var t in PERTTaskList) { if (t.Name == Name) { checkName = false; } } if (Name != null && Name.Length > 0 && Optimistic_a > 0 && Pessimistic_b > 0 && MostLikely_m > 0 && checkName == true) { PERTTask perttask = new PERTTask(Name, Optimistic_a, Pessimistic_b, MostLikely_m, new List <PERTTask>()); PERTTaskList.Add(perttask); } else { ErrorMessage er = new ErrorMessage("The name exists or cost < 1!"); er.ShowDialog(); } setVariable(); }
private void RemovePERTTask(object name) { string tmpName = name.ToString(); PERTTask findPERTTask = PERTTaskList.Where(x => x.Name == tmpName).FirstOrDefault(); foreach (var t in PERTTaskList) { foreach (var preT in t.PreTask.ToList()) { if (preT.Name == findPERTTask.Name) { t.PreTask.Remove(findPERTTask); } } } PERTTaskList.Remove(findPERTTask); setVariable(); }
private void Calculate() { PERTTaskResult = new ObservableCollection <PERTTask>(pertObject.criticalPath(PERTTaskList.ToList())); RaisePropertyChanged("items"); }