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


C# ArgumentList.GetParameter方法代码示例

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


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

示例1: Execute

 public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
 {
     ILister lister = new Lister();
     if (arguments.GetParameter(arguments.GetLength() - 1) == "--export")
         lister = new HtmlLister();
     lister.ListFiltered(tasklist.FilterTasks(arguments.GetParameter(1)), arguments.GetParameter(1));
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:7,代码来源:FilterCommand.cs

示例2: Execute

 public void Execute(ArgumentList arguments, TaskList tasks, TagList tags, TagFolder folder)
 {
     FileIO loader = new FileIO();
     TaskTagger tagTasks = new TaskTagger(tasks.GetTasks());
     if (tagTasks.Untag(arguments.GetParameter(1), arguments.GetParameter(2)))
         loader.SaveTasks(tagTasks.GetTasks());
     else
         Console.WriteLine("No task with that id found to untag");
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:9,代码来源:UntagCommand.cs

示例3: Execute

 public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
 {
     FileIO loader = new FileIO();
     if (tasklist.RemoveTask(arguments.GetParameter(1)))
         {
         loader.SaveTasks(tasklist.GetTasks());
         Console.WriteLine("Task " + arguments.GetParameter(1) + " removed.");
         }
     else
     Console.WriteLine("No task with that id found to remove");
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:11,代码来源:RemoveCommand.cs

示例4: Execute

 public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
 {
     ILister lister = new Lister();
     if (arguments.GetParameter(arguments.GetLength() - 1) == "--export")
         lister = new HtmlLister();
     if (arguments.GetLength() == 1 || arguments.GetParameter(1) == "--export")
         lister.ListNotDone(tasklist.GetTasks(), string.Empty);
     else if (arguments.GetParameter(1) == "all")
         lister.ListAllTasks(tasklist.GetTasks());
     else if (arguments.GetParameter(1) == "tags")
         lister.ListTags(tags, tasklist);
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:12,代码来源:ListCommand.cs

示例5: Execute

 public void Execute(ArgumentList arguments, TaskList tasks, TagList tags, TagFolder folder)
 {
     ILister lister = new Lister();
     if (arguments.GetParameter(arguments.GetLength() - 1) == "--export")
         lister = new HtmlLister();
     if (arguments.GetLength() == 1 || arguments.GetParameter(1) == "--export")
         lister.ListNotDone(tasks.FilterDue("past"), string.Empty);
     else if (arguments.GetParameter(1) == "today")
         lister.ListNotDone(tasks.FilterDue("today"), string.Empty);
     else if (arguments.GetParameter(1) == "thisWeek")
         lister.ListNotDone(tasks.FilterDue("thisWeek"), string.Empty);
     else if (arguments.GetParameter(1) == "nextWeek")
         lister.ListNotDone(tasks.FilterDue("nextWeek"), string.Empty);
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:14,代码来源:DueCommand.cs

示例6: 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

示例7: Execute

 public void Execute(ArgumentList arguments, TaskList tasks, TagList tags, TagFolder folder)
 {
     FileIO loader = new FileIO();
     TaskTagger tagTasks = new TaskTagger(tasks.GetTasks());
     if (tagTasks.DeleteTag(arguments.GetParameter(1)) || tags.HasTag(arguments.GetParameter(1)))
     {
         Tag tagToRemove = tags.GetTag(tags.GetTagIndex(arguments.GetParameter(1)));
         tags.RemoveTag(ref tagToRemove);
         loader.SaveTags(tags);
         loader.SaveTasks(tagTasks.GetTasks());
         Console.WriteLine("Tag {0} deleted", arguments.GetParameter(1));
     }
     else
         Console.WriteLine("No tag with that name available");
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:15,代码来源:DeleteCommand.cs

示例8: Execute

 public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
 {
     FileIO loader = new FileIO();
     if (tasklist.MarkAsDone(arguments.GetParameter(1)))
     loader.SaveTasks(tasklist.GetTasks());
         else
             Console.WriteLine("No task with that id found to mark as done");
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:8,代码来源:DoneCommand.cs

示例9: CheckDueDate

        private static Task CheckDueDate(ArgumentList arguments, Task task)
        {
            if (arguments.GetLength() == 3)
            {
                task.DueDate = Convert.ToDateTime(arguments.GetParameter(2));
                if (task.DueDate < DateTime.Today)
                    Console.WriteLine("Warning, the due date is in the past");
            }

            return task;
        }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:11,代码来源:AddCommand.cs

示例10: Execute

 public void Execute(ArgumentList arguments, TaskList tasks, TagList tags, TagFolder folder)
 {
     FileIO loader = new FileIO();
     TaskTagger tagTasks = new TaskTagger(tasks.GetTasks());
     if (arguments.GetLength() == 2)
     {
         Tag tag = new Tag(arguments.GetParameter(1));
         tags.AddTag(ref tag);
         loader.SaveTags(tags);
     }
     else
     {
         if (tagTasks.AssignTag(arguments.GetParameter(1), arguments.GetParameter(2)))
         {
             loader.SaveTasks(tagTasks.GetTasks());
             Tag tag = new Tag(arguments.GetParameter(2));
             tags.AddTag(ref tag);
             loader.SaveTags(tags);
         }
         else
             Console.WriteLine("No task with that id found to tag");
     }
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:23,代码来源:TagCommand.cs

示例11: Execute

 public void Execute(ArgumentList arguments, TaskList tasks, TagList tags, TagFolder folder)
 {
     FileIO loader = new FileIO();
     if (arguments.GetLength() == 2)
     {
         folder.FolderName = arguments.GetParameter(1);
         loader.SaveFolder(folder);
     }
     else if (arguments.GetLength() == 3 && arguments.GetParameter(1) == "tag")
     {
         Tag toAdd = new Tag(arguments.GetParameter(2));
         folder.AddTag(ref toAdd);
         loader.SaveFolder(folder);
     }
     else if (arguments.GetLength() == 3 && arguments.GetParameter(1) == "subfolder")
     {
         TagFolder toAdd = new TagFolder(arguments.GetParameter(2));
         folder.AddSubfolder(toAdd);
         loader.SaveFolder(folder);
     }
     else if (arguments.GetLength() == 5 && arguments.GetParameter(1) == "subfolder" && arguments.GetParameter(3) == "tag")
     {
         Tag toAdd = new Tag(arguments.GetParameter(4));
         TagFolder copy = folder.GetSubfolder(arguments.GetParameter(2));
         copy.AddTag(ref toAdd);
         folder.ReplaceSubFolder(folder.GetSubfolder(arguments.GetParameter(2)), copy);
         loader.SaveFolder(folder);
     }
     else if (arguments.GetLength() == 5 && arguments.GetParameter(1) == "subfolder" && arguments.GetParameter(3) == "subfolder")
     {
         TagFolder toAdd = new TagFolder(arguments.GetParameter(4));
         TagFolder copy = folder.GetSubfolder(arguments.GetParameter(2));
         copy.AddSubfolder(toAdd);
         folder.ReplaceSubFolder(folder.GetSubfolder(arguments.GetParameter(2)), copy);
         loader.SaveFolder(folder);
     }
 }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:37,代码来源:FolderCommand.cs

示例12: Execute

        public void Execute(ArgumentList arguments, TaskList tasklist, TagList tags, TagFolder folder)
        {
            FileIO loader = new FileIO();
            switch (arguments.GetTypeOfChange())
            {
                case 0:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 0))
                        Console.WriteLine("Task {0} changed to {1}", arguments.GetParameter(1), arguments.GetParameter(3));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                case 1:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 1))
                        Console.WriteLine("Task {0} due date changed to {1}", arguments.GetParameter(1), arguments.GetParameter(3));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                case 2:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 0) && tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(5), 1))
                        Console.WriteLine("Task {0} changed to {1}, due date changed to {2}", arguments.GetParameter(1), arguments.GetParameter(3), arguments.GetParameter(5));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                case 3:
                    if (tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(3), 1) && tasklist.ChangeTask(arguments.GetParameter(1), arguments.GetParameter(5), 0))
                        Console.WriteLine("Task {0} changed to {1}, due date changed to {2}", arguments.GetParameter(1), arguments.GetParameter(5), arguments.GetParameter(3));
                    else
                        Console.WriteLine("No task with that id found to change");
                    break;
                default:
                    Console.WriteLine("Wrong arguments for change command");
                    break;
            }

            loader.SaveTasks(tasklist.GetTasks());
        }
开发者ID:bogdanuifalean,项目名称:JuniorMind,代码行数:36,代码来源:ChangeCommand.cs


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