using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DateTimeSettings.ViewModel
{
    public class MainViewModel : Common.BindableBase
    {
        public MainViewModel()
        {
            _myDate = DateTime.Now;
            _myTime = DateTime.Now.TimeOfDay;
        }

        public DateTime MyDateTime
        {
            get 
            { 
                return new DateTime(_myDate.Year, _myDate.Month, _myDate.Day, _myTime.Hours, _myTime.Minutes, _myTime.Seconds);
            }
            set 
            {
                this.MyDate = value;
                this.MyTime = value.TimeOfDay;
                OnPropertyChanged("MyDate");
                OnPropertyChanged("MyTime");
            }
        }

        private DateTime _myDate;
        public DateTime MyDate
        {
            get 
            { 
                return this._myDate; 
            }
            set 
            { 
                this.SetProperty(ref this._myDate, value);
                OnPropertyChanged("MyDateTime");
            }
        }

        private TimeSpan _myTime;
        public TimeSpan MyTime
        {
            get 
            { 
                return this._myTime; 
            }
            set 
            { 
                this.SetProperty(ref this._myTime, value);
                OnPropertyChanged("MyDateTime");
            }
        }

    }
}
