/// <summary> /// Verwendete Ressourcen bereinigen. /// </summary> /// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } if (DisplayTimer != null && DisplayTimer.Enabled) { DisplayTimer.Stop(); } base.Dispose(disposing); }
internal void ResetTimer() { exerciseIndex = 0; setIndex = 0; currentWorkout = AppCore.CurrentWorkout;//AppCore.Workouts.First(); WorkoutName = currentWorkout.Name; setName = currentWorkout.Timers.First().Name; var ct = currentWorkout.Timers.First().Timers.First(); CurrentTimer = new DisplayTimer(ct); Duration = CurrentTimer.Duration.ToString(); CurrentTimerName = CurrentTimer.Name; manager = new TimerManager(); remainingWorkoutSpan = new TimeSpan(); remainingWorkoutSpan = currentWorkout.Duration; WorkoutDuration = remainingWorkoutSpan.ToString(); remainingSetSpan = new TimeSpan(); remainingSetSpan = currentWorkout.Timers.First().Duration;//manager.GetSetSpan(); SetDuration = remainingSetSpan.ToString(); //dummywerte weil zuerst ein finished event fliegt //allSets.Add(new TimerSet()); //allTimers.Add(new AtomicTimer()); foreach (var set in currentWorkout.Timers) { for (int i = 0; i < set.Repetitions; i++) { allSets.Add(set); foreach (var timer in set.Timers) { for (int j = 0; j < timer.Repetitions; j++) { allTimers.Add(timer); } } } } manager.ExerciseTimerElapsedEvent += manager_ExerciseTimerElapsedEvent; manager.ExerciseTimerFinishedEvent += Manager_ExerciseTimerFinishedEvent; manager.SetTimerElapsedEvent += Manager_SetTimerElapsedEvent; manager.SetTimerFinishedEvent += Manager_SetTimerFinishedEvent; manager.WorkoutTimerElapsedEvent += manager_WorkoutTimerElapsedEvent; manager.WorkoutTimerFinishedEvent += Manager_WorkoutTimerFinishedEvent; isRunning = false; //throw new NotImplementedException(); }
private void manager_WorkoutTimerElapsedEvent(object sender, ElapsedEventArgs e) { #if DEBUG Console.WriteLine("workout ticked "); #endif //modify currently displayed exercise timer CurrentTimer.Duration = CurrentTimer.Duration.Subtract(new TimeSpan(0, 0, 1)); if (CurrentTimer.Duration != new TimeSpan(0, 0, 0)) { Duration = CurrentTimer.Duration.ToString(); } else// (CurrentTimer.Duration == new TimeSpan(0,0,-1)) { exerciseIndex++; CurrentTimer = new DisplayTimer(allTimers[exerciseIndex]); Duration = CurrentTimer.Duration.ToString(); CurrentTimerName = CurrentTimer.Name; } //modify currently displayed set timer RemainingSetSpan = RemainingSetSpan.Subtract(new TimeSpan(0, 0, 1)); if (RemainingSetSpan == new TimeSpan(0, 0, 0)) { //} //else// (remainingSetSpan == new TimeSpan(0, 0, -1)) //{ setIndex++; RemainingSetSpan = allSets[setIndex].Duration;//.Add(new TimeSpan(0,0,1));//manager.GetSetSpan(allSets[setIndex]); SetName = allSets[setIndex].Name; //setIndex++; //RemainingSetSpan = allSets[setIndex].Duration;//manager.GetSetSpan(allSets[setIndex]); //SetName = allSets[setIndex].Name; } //modify currently displayed workout timer //if(RemainingWorkoutSpan != new TimeSpan(0)) { RemainingWorkoutSpan = RemainingWorkoutSpan.Subtract(new TimeSpan(0, 0, 1)); } }
public void Initialize() { GameObject ob = GameObject.Find("TIMER_PLACE"); if (ob != null) { DisplayTimer displaytimer = ob.transform.GetChild(0).GetComponent<DisplayTimer>(); Timer = Instantiate<DisplayTimer>(displaytimer); Timer.transform.parent = ob.gameObject.transform; Timer.name += "-" + gameObject.name; Timer.transform.localScale = new Vector3(1, 1, 1); RectTransform rect = Timer.GetComponent<RectTransform>(); RectTransform rectorgi = displaytimer.GetComponent<RectTransform>(); this.rect = rect; rect.offsetMin = new Vector2(rectorgi.offsetMin.x, rectorgi.offsetMin.y); rect.offsetMax = new Vector2(rectorgi.offsetMax.x, rectorgi.offsetMax.y); } else Debug.LogError("Cant Find TIMER_TEXT"); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody>(); timer = GameObject.Find("Time Text").GetComponent <DisplayTimer>(); }
public void setTimer(DisplayTimer Timer) { this.Timer = Timer; }
private void ErrorControl_Load(object sender, EventArgs e) { label1.Text = ErrorMessage; DisplayTimer.Interval = Convert.ToInt32(new AppSettings().MessageDuration); DisplayTimer.Start(); }