Пример #1
0
        /// <remarks> This ctor should not add this instance to the database because the <see cref="StudyTask.TimeSpans.CollectionChanged"/> is responsible for that. </remarks>
        public TaskTimeSpan(IStudyTasksService service, StudyTask task, DateTime start)
        {
            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            this.service = service;
            this.timeSpanMessageObject = new TaskTimeSpanService()
            {
                Start = start, TaskId = task.Id
            };
            this.Task  = task;
            this.Start = start;

            this.PropertyChanged += OnPropertyChanged;
        }
Пример #2
0
        /// <summary> Creates a <see cref="TaskTimeSpan"/> from database. </summary>
        /// <param name="messageObject"> The autogenerated message object representing a time span in the database. </param>
        public TaskTimeSpan(IStudyTasksService service, TaskTimeSpanService messageObject, StudyTask task)
        {
            if (messageObject == null)
            {
                throw new ArgumentNullException(nameof(messageObject));
            }
            if (task == null)
            {
                throw new ArgumentNullException(nameof(task));
            }
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (messageObject.Id == 0)
            {
                throw new ArgumentException();
            }

            this.service = service;
            this.timeSpanMessageObject = messageObject;
            this.Task  = task;
            this.Start = messageObject.Start;
            this.End   = messageObject.End;

            this.PropertyChanged += OnPropertyChanged;
        }