Example #1
0
        /// <summary>
        /// Gets a task from the tasks list by name
        /// </summary>
        /// <param name="tasksList"></param>
        /// <param name="taskName"></param>
        /// <returns></returns>
        public static ISNTaskObj GetByName(this ISNTasksList tasksList, string taskName)
        {
            tasksList.Reset();

            while (!tasksList.EndOfList)
            {
                var task = tasksList.Current;

                if (task.Name.Equals(taskName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(task);
                }

                tasksList.MoveNext();
            }
            return(null);
        }
Example #2
0
        /// <summary>
        /// Removes a task from the tasks list by name
        /// </summary>
        /// <param name="tasksList"></param>
        /// <param name="taskName"></param>
        /// <returns></returns>
        public static bool RemoveByName(this ISNTasksList tasksList, string taskName)
        {
            tasksList.Reset();

            while (!tasksList.EndOfList)
            {
                var task = tasksList.Current;

                if (task.Name.Equals(taskName, StringComparison.InvariantCultureIgnoreCase))
                {
                    tasksList.Remove();
                    return(true);
                }

                tasksList.MoveNext();
            }
            return(false);
        }