Ejemplo n.º 1
0
		Storyboard GetAnimationForTimer(PinTimer timer)
		{
			var item = TimersListBox.ItemContainerGenerator.ContainerFromItem(timer) as ListBoxItem;			
			return item.Tag != null ? item.Tag as Storyboard : null;
		}
Ejemplo n.º 2
0
 public TimerSettingsSetup(PinTimer timer)
     : this()
 {
     Timer = timer ?? new PinTimer(TimeSpan.Zero) { AudioSource = AudioItemData.ListOfPossible[0]};
     DataContext = Timer;
 }
Ejemplo n.º 3
0
		void DisplaySetupTimerDialog(PinTimer timer = null)
		{
			_timerSetupControl = new TimerSettingsSetup(timer);
			NavigationService.Navigate(new Uri("/CustomDialogPage.xaml", UriKind.Relative));
		}
Ejemplo n.º 4
0
		private void HandleTimerTap(PinTimer timer)
		{
			if (!timer.IsActive)
			{
				timer.StartTimer();
				PreloadSoundForNextExpireTimer();
			}
			else
			{
				timer.StopTimer();
				timer.ResetTime();
			}
			ConfigIdleDetectionMode();
		}
Ejemplo n.º 5
0
		private void HandleSoundAndAnimation(PinTimer obj, bool inBackground)
		{
			ListBoxItem item = TimersListBox.ItemContainerGenerator.ContainerFromItem(obj) as ListBoxItem;
			ConfigIdleDetectionMode();
			if (item == null)
				_listNeedAmimationFor.Add(obj);
			else
			{
				StartCompleteAnimation(item);
				if (!String.IsNullOrEmpty(obj.ContentMessage))
					ShowPopup(obj.ContentMessage, 5000);
			}
			if (!inBackground)
			{
				if (media.Source == null || System.IO.Path.GetFullPath(media.Source.OriginalString) != System.IO.Path.GetFullPath(obj.AudioSource.Path.OriginalString) ||
					media.CurrentState == MediaElementState.AcquiringLicense || media.CurrentState == MediaElementState.Opening || media.CurrentState == MediaElementState.Individualizing)
				{
					// if sound goes through one of opening state subscribe for play it later
					media.MediaOpened += media_MediaOpened;
					media.Source = obj.AudioSource.Path;
				}
				else
					media.Play(); // if sound loaded and opened successful then play
			}
		}
Ejemplo n.º 6
0
		void OnTimerCompleted(PinTimer obj, bool inBackground)
		{
			if (Dispatcher.CheckAccess())
				HandleSoundAndAnimation(obj, inBackground);
			else
				Dispatcher.BeginInvoke(() =>
				{
					HandleSoundAndAnimation(obj, inBackground);
				});
		}	
Ejemplo n.º 7
0
		private void ShiftTimeForActiveTimers(PinTimer excepHandleTimer = null)
		{
			if (TimersListBox.Items.Count == 0) return;
			var activeTimers = TimersListBox.Items.Cast<PinTimer>().Where(w => w.IsActive && !w.IsPaused && w != excepHandleTimer).ToList();
			if (activeTimers.Count() == 0) return;			
			TimeSpan lastTime = GetLastActiveTime();			
			TimeSpan shiftTime = TimeSpan.FromSeconds(Math.Floor(DateTime.Now.TimeOfDay.TotalSeconds - lastTime.TotalSeconds));			
			activeTimers.ForEach(fe => fe.ElapsedTime -= shiftTime);						
		}