Exemplo n.º 1
0
        public void ChangeDateTime(int nYear, int nMonth, int nDay, int nHour, int nMin, int nSec)
        {
            DataContext = nDay.ToString();

            Storyboard sb = (Storyboard)PodClock.FindResource("sb");

            sb.Begin(PodClock, HandoffBehavior.SnapshotAndReplace, true);
            DateTime dtChange = new DateTime(nYear, nMonth, nDay, nHour, nMin, nSec);

            sb.Seek(PodClock, dtChange.TimeOfDay, TimeSeekOrigin.BeginTime);
        }
Exemplo n.º 2
0
        void Clock_Loaded(object sender, RoutedEventArgs e)
        {
            // set the datacontext to be today's date
            DateTime now = DateTime.Now;

            DataContext = now.Day.ToString();

            // then set up a timer to fire at the start of tomorrow, so that we can update
            // the datacontext
            _dayTimer          = new DispatcherTimer();
            _dayTimer.Interval = new TimeSpan(1, 0, 0, 0) - now.TimeOfDay;
            _dayTimer.Tick    += new EventHandler(OnDayChange);
            _dayTimer.Start();

            // finally, seek the timeline, which assumes a beginning at midnight, to the appropriate
            // offset
            Storyboard sb = (Storyboard)PodClock.FindResource("sb");

            sb.Begin(PodClock, HandoffBehavior.SnapshotAndReplace, true);
            sb.Seek(PodClock, now.TimeOfDay, TimeSeekOrigin.BeginTime);
        }
Exemplo n.º 3
0
        private void ButtonTest_Loaded(object sender, RoutedEventArgs e)
        {
            var sb = (Storyboard)PodClock.FindResource("sb");

            sb.Begin(PodClock, HandoffBehavior.SnapshotAndReplace, true);
        }