当前位置: 首页>>代码示例>>C#>>正文


C# TaskList.AddTask方法代码示例

本文整理汇总了C#中TaskList.AddTask方法的典型用法代码示例。如果您正苦于以下问题:C# TaskList.AddTask方法的具体用法?C# TaskList.AddTask怎么用?C# TaskList.AddTask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TaskList的用法示例。


在下文中一共展示了TaskList.AddTask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
 {
     if (tasklist.HasSameTask(arguments.GetParameter(1)) == false)
     {
         Task task = new Task();
         FileIO loader = new FileIO();
         task.TaskDescription = arguments.GetParameter(1);
         task.IsNewTask = true;
         task = CheckDueDate(arguments, task);
         tasklist.AddTask(ref task);
         loader.SaveTasks(tasklist.GetTasks());
         Console.WriteLine("Task {0} added", task.TaskDescription);
     }
     else Console.WriteLine("Task already in list");
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:15,代码来源:AddCommand.cs

示例2: LoadData

        public override Dictionary<string, List<TaskList>> LoadData(TaskListRepository repository)
        {
            LoadXmlDataFromFile();

            RootNode = XmlData.Root;

            if (RootNode == null)
            {
                RootNode = new XElement("TaskData");
                XmlData.Add(RootNode);
            }

            Dictionary<string, List<TaskList>> taskData =
                new Dictionary<string, List<TaskList>>(StringComparer.CurrentCultureIgnoreCase);

            foreach (XElement channelNode in RootNode.Nodes())
            {
                var channelNodeAttribute = channelNode.Attribute("Name");
                if (channelNodeAttribute != null)
                {
                    List<TaskList> channelLists = new List<TaskList>();
                    foreach(XElement taskListNode in channelNode.Nodes())
                    {
                        var taskListCreator = taskListNode.Attribute(TaskListCreatorAttributeName);
                        var taskListName = taskListNode.Attribute("Name");
                        var taskListDefaultStatus = taskListNode.Attribute("DefaultStatus");

                        if(taskListCreator != null && taskListName != null && taskListDefaultStatus != null)
                        {
                            TaskList taskList = new TaskList(taskListCreator.Value, taskListName.Value, repository, taskListDefaultStatus.Value);

                            foreach(XElement taskNode in taskListNode.Nodes())
                            {
                                var taskText = taskNode.Value;
                                var taskCreatorNode = taskNode.Attribute("Creator");
                                var taskOwnerAttribute = taskNode.Attribute("Owner");
                                var taskIdAttribute = taskNode.Attribute("TaskId");
                                var taskStatus = taskNode.Attribute("Status");

                                if (taskCreatorNode != null && taskOwnerAttribute != null
                                    && taskIdAttribute != null && taskStatus != null)
                                {
                                    int taskId = Convert.ToInt32(taskIdAttribute.Value);

                                    if (taskId >= repository.NextTaskId)
                                        repository.NextTaskId = taskId + 1;

                                    Task task = new Task(taskText, taskCreatorNode.Value, taskId, taskList);
                                    task.WasTakenBy(taskOwnerAttribute.Value);
                                    task.UpdateStatus(taskStatus.Value);
                                    taskList.AddTask(task);
                                }
                            }
                            channelLists.Add(taskList);
                        }
                    }

                    taskData.Add(channelNodeAttribute.Value, channelLists);
                }
            }

            return taskData;
        }
开发者ID:krishemenway,项目名称:IrcBot,代码行数:63,代码来源:XmlPersistance.cs

示例3: RemoveByKey

        private static void RemoveByKey(string key, string searchPath)
        {
            var folderPaths = Directory.GetDirectories(searchPath, "*_" + key, SearchOption.AllDirectories);
            foreach (var folderPath in folderPaths)
            {
                var path = Path.Combine(folderPath, "..\\");
                if (!Directory.Exists(path))
                    continue;
                // Trace.WriteLine("deleting " + path);
                try
                {
                    Directory.Delete(path, true);
                }
                catch (Exception e)
                {
                    Trace.WriteLine("error: " + e.Message);
                }
            }
            // find any left over files by key and delete them
            var assNames = GetByKey(key, searchPath);
            var t = new TaskList();
            var gac = new GacUtility();
            foreach (var s in assNames)
            {
                string a = s;
                t.AddTask(() => gac.Remove(a));
            }
            t.WaitForAll();

        }
开发者ID:J4S0Nc,项目名称:Useful.Utilities,代码行数:30,代码来源:GACUtility.cs


注:本文中的TaskList.AddTask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。