﻿using System;
using Windows.UI.Xaml;
using PronamaTokeiWinrt.Common;

namespace PronamaTokeiWinrt.ViewModels
{
    public class MainViewModel : NotifierBase
    {
        private string _colorHex;

        public string ColorHex
        {
            get { return _colorHex; }
            set
            {
                SetProperty(ref _colorHex, value);
                OnPropertyChanged();
            }
        }

        public MainViewModel()
        {
            var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) };
            timer.Tick += UpdateTime;
            timer.Start();
        }

        void UpdateTime(object sender, object e)
        {
            var time = DateTime.Now;
            ColorHex = string.Format("#{0}{1}{2}", time.ToString("HH"), time.ToString("mm"), time.ToString("ss"));
        }
    }
}
