public RegisterStudyUnitViewModel() { try { int Time = ST.TimeCloseRegisterUnit().ToList()[0].Value; //_hour =Time/(3600*24) ; _hour = Time / 3600; _minute = (Time % 3600) / 60; _second = Time - (_hour * 3600 + _minute * 60); } catch { } _timer = new DispatcherTimer(DispatcherPriority.Normal); _timer.Interval = TimeSpan.FromSeconds(1); _timer.Tick += Timer_Tick; _timer.Start(); }