public void MoveToNextSetupState() { if (wizardViewState == WizardViewState.NumberOfTasks) { List <TaskViewModel> tasks = new List <TaskViewModel>(); int averageSeconds = totalTimeInfo.TotalSeconds / numberOfTasks; int leftoverSeconds = totalTimeInfo.TotalSeconds % numberOfTasks; for (int i = 1; i <= numberOfTasks; ++i) { var task = new TaskViewModel(String.Format("Task {0}", i.ToString()), ColorInfo.GetRandomColor(), new TimeInfoViewModel(averageSeconds)); tasks.Add(task); } //Add the remaining seconds for (int i = 0; i < leftoverSeconds; ++i) { tasks[i].OriginalTime.TotalSeconds++; } parent.ActivateItem(new SetupViewModel(parent, totalTimeInfo, tasks, windowManager)); } WizardViewState++; }
public void AddTask(System.Windows.Controls.DataGrid tasksGrid) { //GetTimeRemaining() SelectedTask = InternalAddTask(String.Format("Task {0}", tasks.Count + 1), ColorInfo.GetRandomColor(), new TimeInfoViewModel()); if (tasksGrid != null) { tasksGrid.ScrollIntoView(selectedTask); var cellInfo = new System.Windows.Controls.DataGridCellInfo(selectedTask, tasksGrid.Columns[1]); int row = tasksGrid.Items.IndexOf(selectedTask); tasksGrid.CurrentCell = cellInfo; var cell = tasksGrid.GetCell(row, 1); if (cell != null) { cell.Focus(); } tasksGrid.BeginEdit(); } NotifyOfPropertyChange(() => CanAddTask); NotifyOfPropertyChange(() => CanStartTasks); NotifyOfPropertyChange(() => CanAddTasks); CalculateValidationErrors(); }