Adroit.Gui.PlanningView.AddTask C# (CSharp) Method

AddTask() public method

public AddTask ( ) : void
return void
        public void AddTask()
        {
            var task = new Task ();
            task.Title = String.Empty;

            var project = SelectedProject;
            if (project != null)
                task.ProjectId = project.Id;

            var command = new AddTaskCommand (task, m_storage);
            var commands = ServiceManager.Get<CommandService> ().Commands;
            commands.Do (command);

            /* XXX: Our closure uses the index rather than a reference to the
             *   path because there is a GC issue with the closure and GtkPath
             *   instances.
             */
            int index = 0;
            m_tasksTreeView.Model.Foreach (delegate (TreeModel model, TreePath p, TreeIter i) {
                index = p.Indices [0];
                return false;
            });

            var path = new TreePath (new int[] {index});
            m_tasksTreeView.SetCursor (path, task_title_column, true);
        }