void AddTestData() { for( int i = 0; i < 50; ++i ) { TodoListTask task = new TodoListTask(); task.Description = "Test " + i; task.TimeCreated = TodoList.ToUnixTimestamp( 2012, Random.Range( 1, 5 ), Random.Range( 1, 30 ), Random.Range( 1, 24 ), Random.Range( 0, 60 ) ); task.Status = "Task not started"; task.SetCompleted( true ); task.TimeCompleted = task.TimeCreated + 60 * 60 * 24 * Random.Range( 50, 90 ); task.Status = "Completed"; task.Developer = "Unassigned"; task.Category = "Unassigned"; task.IsMatchingSearchString = true; task.Order = Window.GetCurrentList().GetHighestOrder() + 1; Window.GetCurrentList().AddTask( task ); } }
void DisplayTaskStatus( TodoListTask task ) { GUILayout.Label( task.Status, GUILayout.Width( GetFieldSize( TodoListFieldTypes.Status ) - 28 ) ); List<string> transitions = Window.GetCurrentList().GetTransitions( task.Status ); transitions.Insert( 0, "" ); GUIStyle popupStyle = new GUIStyle( EditorStyles.popup ); popupStyle.margin.top = 4; popupStyle.margin.right = 8; int selectedIndex = 0; if( transitions.Count > 1 ) { selectedIndex = EditorGUILayout.Popup( 0, transitions.ToArray(), popupStyle, GUILayout.Width( 16 ) ); } else { GUILayout.Space( 24 ); } if( selectedIndex != 0 ) { Window.GetCurrentList().OnTaskChanged( task, "Edit Task Status" ); task.SetCompleted( Window.GetCurrentList().IsStatusFinished( transitions[ selectedIndex ] ) ); task.Status = transitions[ selectedIndex ]; task.AddPost( "", transitions[ selectedIndex ], "" ); } }