コード例 #1
0
        public static bool AddNewTask(string description, DateTime requiredBy)
        {
            IList <TryItOut.Domain.Models.ToDoTask> toDoTasks = new List <TryItOut.Domain.Models.ToDoTask>();
            bool         status = false;
            XMLReadWrite wrtr   = new XMLReadWrite();

            try
            {
                /* controller helper should not do any working just calls and mappings */

                /* ********************************************************* */

                /* read existing XML file and add new task to existing tasks
                 * write new task list to XML file                           */
                /* ********************************************************* */
                toDoTasks = wrtr.Read();

                toDoTasks.Add(new TryItOut.Domain.Models.ToDoTask()
                {
                    Identifier  = toDoTasks.Max(i => i.Identifier) + 1,
                    Description = description,
                    RequiredBy  = requiredBy
                });

                wrtr.Write(toDoTasks);

                var tasks = wrtr.Read();
            }
            catch
            {
            }

            return(status);
        }
コード例 #2
0
    public void Start()
    {
        Instance = this;

        DontDestroyOnLoad(this);
    }
コード例 #3
0
ファイル: XMLReadWrite.cs プロジェクト: auycro/Impulse
    public void Start()
    {
        Instance = this;

        DontDestroyOnLoad (this);
    }