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


C# TaskList.Add方法代码示例

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


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

示例1: Add_Multiple

		public void Add_Multiple()
		{
			var tl = new TaskList(_testDataPath);
			int c = tl.Count();

			var task = new Task("Add_Multiple task one");
			tl.Add(task);

			var task2 = new Task("Add_Multiple task two");
			tl.Add(task2);

			Assert.AreEqual(c + 2, tl.Count());
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:13,代码来源:TaskListTests.cs

示例2: Add_ToCollection

		public void Add_ToCollection()
		{
			var task = new Task("(B) Add_ToCollection +test @task");

			var tl = new TaskList(_testDataPath);

			List<Task> tasks = tl.ToList();
			tasks.Add(task);

			tl.Add(task);

			List<Task> newTasks = tl.ToList();

			Assert.AreEqual(tasks.Count, newTasks.Count);

			for (int i = 0; i < tasks.Count; i++)
				Assert.AreEqual(tasks[i].ToString(), newTasks[i].ToString());
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:18,代码来源:TaskListTests.cs

示例3: GetRunningTasks

        TaskList GetRunningTasks()
        {
            var tl = new TaskList();
            var processlist = Process.GetProcesses();

            foreach (Process p in processlist)
            {
                var t = new Task();
                t.Name = p.ProcessName;
                t.ProcessId = p.Id;
                t.PrivateMemory = p.PrivateMemorySize64;
                t.WorkingSet = p.WorkingSet64;
                //t.ProcessorTime = p.TotalProcessorTime; // access denied
                tl.Add(t);
            }

            return tl;
        }
开发者ID:hagaygo,项目名称:WindowsWebAdmin,代码行数:18,代码来源:TaskManagerController.cs

示例4: Add_ToFile

		public void Add_ToFile()
		{
			// Create a copy of test data so we can leave the original alone
			string tempTaskFile = CreateTempTasksFile();

			List<string> fileContents = File.ReadAllLines(tempTaskFile).ToList();
			fileContents.Add("(B) Add_ToFile +test @task");

			var task = new Task(fileContents.Last());
			var tl = new TaskList(tempTaskFile);
			tl.Add(task);
			tl.SaveTasks(tempTaskFile);

			string[] newFileContents = File.ReadAllLines(tempTaskFile);
			CollectionAssert.AreEquivalent(fileContents, newFileContents);

			// Clean up
			File.Delete(tempTaskFile);
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:19,代码来源:TaskListTests.cs

示例5: gatTaskList

 internal static TaskList gatTaskList(HttpResponseMessage responce)
 {
     var taskList = new TaskList();
     var jsonObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(responce.Content.ReadAsStringAsync().Result);
     if (jsonObj.ContainsKey("task"))
     {
         var tasksArray = JsonConvert.DeserializeObject<List<object>>(jsonObj["task"].ToString());
         foreach(var taskObj in tasksArray)
         {
             var task = new ProjectTask();
             task = JsonConvert.DeserializeObject<ProjectTask>(taskObj.ToString());
             taskList.Add(task);
         }
     }
     if (jsonObj.ContainsKey("page_context"))
     {
         var pageContext = new PageContext();
         pageContext = JsonConvert.DeserializeObject<PageContext>(jsonObj["page_context"].ToString());
         taskList.page_context = pageContext;
     }
     return taskList;
 }
开发者ID:jbondhus,项目名称:books-dotnet-wrappers,代码行数:22,代码来源:ProjectParser.cs

示例6: Add_To_Empty_File

		public void Add_To_Empty_File()
		{
			// v0.3 and earlier contained a bug where a blank task was added
			string tempTaskFile = CreateTempTasksFile();
			File.WriteAllLines(tempTaskFile, new string[] {}); // empties the file

			var tl = new TaskList(tempTaskFile);
			tl.Add(new Task("A task"));

			Assert.AreEqual(1, tl.Count());

			// Clean up
			File.Delete(tempTaskFile);
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:14,代码来源:TaskListTests.cs

示例7: Update_InCollection

		public void Update_InCollection()
		{
			var task = new Task("(B) Update_InCollection +test @task");

			var tl = new TaskList(_testDataPath);
			tl.Add(task);

			var task2 = new Task(task.Raw);
			task2.ToggleCompleted();

			tl.Update(task, task2);

			Task newTask = tl.Last();
			Assert.IsTrue(newTask.Completed);
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:15,代码来源:TaskListTests.cs

示例8: ToggleComplete_On_InCollection

		public void ToggleComplete_On_InCollection()
		{
			var task = new Task("(B ToggleComplete_On_InCollection +test @task");
			var tl = new TaskList(_testDataPath);
			tl.Add(task);

			task = tl.Last();

			task.ToggleCompleted();

			task = tl.Last();

			Assert.IsTrue(task.Completed);
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:14,代码来源:TaskListTests.cs

示例9: ToggleComplete_Off_InCollection

		public void ToggleComplete_Off_InCollection()
		{
			// Not complete - doesn't include completed date
			var task = new Task("X (B) ToggleComplete_Off_InCollection +test @task");
			var tl = new TaskList(_testDataPath);
			tl.Add(task);

			task = tl.Last();

			task.ToggleCompleted();

			task = tl.Last();

			Assert.IsTrue(task.Completed);

			var task2 = new Task("X 2011-02-25 ToggleComplete_Off_InCollection +test @task");

			tl.Add(task2);

			task = tl.Last();

			task.ToggleCompleted();

			task = tl.Last();

			Assert.IsFalse(task.Completed);
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:27,代码来源:TaskListTests.cs

示例10: Save_To_Stream

		public void Save_To_Stream()
		{
			string tempTaskFile = CreateTempTasksFile();

			var tl = new TaskList();

			using (FileStream fs = File.OpenRead(tempTaskFile))
			{
				tl.LoadTasks(fs);
			}

			tl.Add(new Task("This task should end up in both lists"));

			string tempTaskFileCopy = CreateTempTasksFile();

			using (FileStream fs = File.OpenWrite(tempTaskFileCopy))
			{
				tl.SaveTasks(fs);
			}

			var tl2 = new TaskList(tempTaskFileCopy);

			Assert.AreEqual(tl.Count, tl2.Count);
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:24,代码来源:TaskListTests.cs

示例11: ObservableChanges

		public void ObservableChanges()
		{
			var tl = new TaskList();

			bool fired = false;

			tl.CollectionChanged += (sender, e) => { fired = true; };

			tl.LoadTasks(_testDataPath);

			Assert.True(fired);
			fired = false;

			tl.Add(new Task("T", null, null, "Test task for observablecollection event firing"));

			Assert.True(fired);
			fired = false;

			tl[0].PropertyChanged += (sender, e) => { fired = true; };

			tl[0].Append("Test append for propertychanged event firing");

			Assert.True(fired);
		}
开发者ID:losmuertos,项目名称:todotxtlib.net,代码行数:24,代码来源:TaskListTests.cs

示例12: GetScheduleQueue

 public static TaskList<ScheduleHistory> GetScheduleQueue()
 {
     var c = new TaskList<ScheduleHistory>();
     try
     {
         using (ScheduleQueue.GetReadLock(LockTimeout))
         {
             foreach (ScheduleHistory item in ScheduleQueue)
             {
                 c.Add(item);
             }
         }
         return c;
     }
     catch (ApplicationException ex)
     {
         Interlocked.Increment(ref _readerTimeouts);
         ErrorLogger.SchedulerProcessException(ex);
     }
     return c;
 }
开发者ID:RexSystemsbd,项目名称:SageFrameV2.1Source,代码行数:21,代码来源:Scheduler.cs

示例13: MainViewModel

		/// <summary>
		/// Initializes a new instance of the MainViewModel class.
		/// </summary>
		public MainViewModel(PrimaryTaskFileService taskFileService, ArchiveTaskFileService archiveFileService, ApplicationSettings applicationSettings)
		{
		    _applicationSettings = applicationSettings;

		    if (IsInDesignMode)
		    {
		        // Code runs in Blend --> create design time data.
		        TaskList = new TaskList
		        {
		            new Task("A", null, null,
		                "This is a designer task that might be really long the quick brown fox jumped over the lazy dogs"),
		            new Task("", null, null, "This is a designer task2"),
		            new Task("", null, null,
		                "This is a designer task3 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
		        };

		        var b = new Task("B", null, null, "This is a designer task4", DateTime.Now.AddDays(-1), null, false, null);
		        b.ToggleCompleted();
		        TaskList.Add(b);
		        TaskList.Add(new Task("C", null, null, "This is a designer task5"));

		        TaskList.Add(new Task("This task has two contexts @home @work"));
		        TaskList.Add(new Task("This task has two projects +planvacation +fixstove"));
		        TaskList.Add(new Task("This task has one of each @home +fixstove"));
		        TaskList.Add(new Task("")); // Blank task line

		        SelectedTask = TaskList[3];
		        ViewTask();
		    }
			else
			{
				// Code runs "for real"
				WireupTaskFileServices(taskFileService, archiveFileService);

				Messenger.Default.Register<DrillDownMessage>(this, Filter);
			    Messenger.Default.Register<ApplicationStartedMessage>(this, message =>
			        {
                        LocalHasChanges = _taskFileService.LocalHasChanges;

			            if(StartupSyncCommand.CanExecute(null))
			            {
			                StartupSyncCommand.Execute(null);
			            }
			        });

				WireUpCommands();
			}
		}
开发者ID:hartez,项目名称:TodotxtTouch.WindowsPhone,代码行数:51,代码来源:MainViewModel.cs


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