Esempio n. 1
0
        public ToDoData Init(string content                     = null, Action saveAct = null
                             , Property <bool> finished         = null, Action <bool> finishedChangeAct = null
                             , DateTime?createTime              = null, DateTime?finishTime = null, DateTime?startTime = null
                             , Property <ToDoState> state       = null, Action <ToDoState> stateChangeAct = null
                             , Property <ToDoPriority> priority = null, ToDoCategory category             = null
                             , bool?isHide = null, string productVersionID = null)
        {
            //this.id = Guid.NewGuid().ToString();
            this.content  = content ?? string.Empty;
            this.finished = finished ?? new Property <bool>(false);
            if (finishedChangeAct != null)
            {
                this.finished.RegisterValueChanged(finishedChangeAct);
            }

            this.createTime       = createTime ?? DateTime.Now;
            this.finishTime       = finishTime ?? DateTime.Now;
            this.startTime        = startTime ?? DateTime.Now;
            this.state            = state ?? new Property <ToDoState>(ToDoState.NoStart);
            this.priority         = priority ?? new Property <ToDoPriority>(ToDoPriority.None);
            this.category         = category;     //?? new TodoCategory();
            this.isHide           = isHide ?? false;
            this.productVersionID = productVersionID;

            if (stateChangeAct != null)
            {
                this.state.RegisterValueChanged(stateChangeAct);
            }


            if (saveAct != null)
            {
                this.finished.RegisterValueChanged(_ => saveAct());
                this.state.RegisterValueChanged(_ => saveAct());
                this.priority.RegisterValueChanged(_ => saveAct());
                this.priority.RegisterValueChanged(_ => saveAct());
            }

            return(this);
        }
Esempio n. 2
0
 public ToDoData(string _content, bool _finished, Action _saveAct, ToDoCategory _category,
                 string _productVersionID)
 {
     Init(content: _content, saveAct: _saveAct, finished: new Property <bool>(_finished), category: _category,
          productVersionID: _productVersionID);
 }
 public static void RemoveToDoCategory(ToDoCategory category) => Data.RemoveToDoCategory(category);
 public static int ToDoCategoryIndexOf(ToDoCategory category) => Data.ToDoCategoryIndexOf(category);
 public static void AddToDoCategory(ToDoCategory category) => Data.AddToDoCategory(category);
 public static ToDoData AddToDoItem(string content, bool finished = false, ToDoCategory category = null,
                                    string productVersionID       = null) =>
 Data.AddToDoItem(content, finished, category, productVersionID);