Ejemplo n.º 1
0
 public TimerViewModel(TimerModel model)
 {
     model.StateObservable().Subscribe((TimerState state) => {
         if (state == TimerState.FINISHED)
         {
             Messenger.Raise(new WindowActionMessage(WindowAction.Close, "Close"));
         }
     });
     model.TimeObservable().Subscribe((int time) => {
         int h = time / (60 * 60);
         time -= h * (60 * 60);
         int m = time / 60;
         time -= m * 60;
         int s = time;
         Text  = String.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);
     });
     model.Start();
 }