public void StartTimer(TimerLabel label) { if (!Timers.ContainsKey(label)) Timers.Add(label, new Stopwatch()); Timers[label].Start(); OnTimerStarted(label); }
public Stopwatch GetTimer(TimerLabel label) { if (!Timers.ContainsKey(label)) return null; return Timers[label]; }
public TimeSpan GetElapsedTime(TimerLabel label) { if (!Timers.ContainsKey(label)) return TimeSpan.Zero; return Timers[label].Elapsed; }
public void StopTimer(TimerLabel label) { if (Timers.ContainsKey(label)) { Timers[label].Stop(); OnTimerStopped(label); } }
public void InitialiseTimerBinding() { Binding binding = new Binding(); binding.Source = time; binding.Mode = BindingMode.OneWay; binding.Path = new PropertyPath("CurrentTime"); TimerLabel.SetBinding(TextBlock.TextProperty, binding); }
public void StartTimer(TimerLabel label) { if (!Timers.ContainsKey(label)) { Timers.Add(label, new Stopwatch()); } Timers[label].Start(); OnTimerStarted(label); }
public Stopwatch GetTimer(TimerLabel label) { if (!Timers.ContainsKey(label)) { return(null); } return(Timers[label]); }
public TimeSpan GetElapsedTime(TimerLabel label) { if (!Timers.ContainsKey(label)) { return(TimeSpan.Zero); } return(Timers[label].Elapsed); }
private void Update_LabelTimer(string Elapsed) { if (TimerLabel.InvokeRequired) { TimerLabel.Invoke(new UpdateUIHandler(Update_LabelTimer), Elapsed); } else { TimerLabel.Text = Elapsed; } }
private void StartStopBtn(object parm) { /************************************************************************************************************** * -> Method : StartStopBtn * -> Param : object parm * -> Event : This method is triggered when the Start/Stop Button is clicked * -> Description: This method starts a timer and alerts the user with a messsage box when the timer is done. **************************************************************************************************************/ if (StartStopEnabled) { try { _time = new TimeSpan((Int32.Parse(HrLabel)), (Int32.Parse(MinLabel)), Int32.Parse(SecLabel)); } catch (Exception) { MessageBox.Show(Application.Current.MainWindow, "Please Enter a Valid Number", "PYAC Exception", MessageBoxButton.OK, MessageBoxImage.Warning); return; } _timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate { TimerLabel = _time.ToString("c"); if (_time == TimeSpan.Zero) { _timer.Stop(); } _time = _time.Add(TimeSpan.FromSeconds(-1)); if (TimerLabel.Equals("00:00:00")) { MessageBox.Show(Application.Current.MainWindow, "Timer Done"); } }, Application.Current.Dispatcher); _timer.Start(); StartStopEnabled = false; StartStopLabel = "Stop"; } else { try { _timer.Stop(); } catch (Exception) { MessageBox.Show(Application.Current.MainWindow, "Timer Not Started", "PYAC Exception", MessageBoxButton.OK, MessageBoxImage.Warning); } StartStopEnabled = true; StartStopLabel = "Start"; } }
private void Timer_Label_MouseRightButtonDown(object sender, MouseEventArgs e) { if (editMode == false) { return; } TimerLabel tmrLbl = (TimerLabel)sender; AddControl addControl = new AddControl(); AddControlTimerLabel cmi = new AddControlTimerLabel(gCurrentScreen, tmrLbl.screenObject.Name); addControl.Content = cmi; addControl.Width = cmi.Width + 80; addControl.Height = cmi.Height + 80; addControl.Owner = this; addControl.ShowDialog(); Load_Screen(gCurrentScreen); }
void TimerView_SizeChanged(object sender, EventArgs e) { if (Width == 0 || Height == 0) { return; } if (TrackBar == null || ProgressBar == null) { return; } if (Children.Count == 0) { //ensure track-bar gets full width and height as parent AddTrackBar(); //ensure progress-bar gets full height, but width can be changed AddProgressBar(); //if timer-label available, ensure it gets full width and height if (TimerLabel != null) { AddTimerLabel(); TimerLabel.SetBinding(BindingContextProperty, new Binding(nameof(RemainingTime), source: this)); } if (AutoStart) { StartTimerCommand.Execute(Time); } } else { if (IsTimerRunning) { //if timer runnnig already - restart animation ProgressBar.CancelWidthToAnimation(); StartTimerCommand.Execute(null); //Use remaining time } else { SetProgressBarWidth(); } } }
private void StartStopBtn(object parm) { if (StartStopEnabled) { try { _time = new TimeSpan((Int32.Parse(HrLabel)), (Int32.Parse(MinLabel)), Int32.Parse(SecLabel)); } catch (Exception) { MessageBox.Show(Application.Current.MainWindow, "Please Enter a Valid Number", "PYAC Exception", MessageBoxButton.OK, MessageBoxImage.Warning); return; } _timer = new DispatcherTimer(new TimeSpan(0, 0, 1), DispatcherPriority.Normal, delegate { TimerLabel = _time.ToString("c"); if (_time == TimeSpan.Zero) { _timer.Stop(); } _time = _time.Add(TimeSpan.FromSeconds(-1)); if (TimerLabel.Equals("00:00:00")) { MessageBox.Show(Application.Current.MainWindow, "Timer Done"); } }, Application.Current.Dispatcher); _timer.Start(); StartStopEnabled = false; StartStopLabel = "Stop"; } else { try { _timer.Stop(); } catch (Exception) { MessageBox.Show(Application.Current.MainWindow, "Timer Not Started", "PYAC Exception", MessageBoxButton.OK, MessageBoxImage.Warning); } StartStopEnabled = true; StartStopLabel = "Start"; } }
public MainWindow() { InitializeComponent(); //TimerSlider.DataContext = mMediaPlayer.Position; SoundSlider.DataContext = mMediaPlayer; MuteCheckBox.DataContext = mMediaPlayer; TimerSliderLabel timerSliderLabel = new TimerSliderLabel(); Binding myBindingTimerLabel = new Binding("LabelString"); myBindingTimerLabel.Source = timerSliderLabel; TimerLabel.SetBinding(Label.ContentProperty, myBindingTimerLabel); Binding myBindingTimerSlider = new Binding("SliderDouble"); myBindingTimerSlider.Source = timerSliderLabel; TimerSlider.SetBinding(Slider.ValueProperty, myBindingTimerSlider); ImageBrush imageBrush = new ImageBrush(); imageBrush.ImageSource = new BitmapImage(new Uri("example.jpg", UriKind.Relative)); CoverImage.Fill = imageBrush; transform = new RotateTransform() { CenterX = 0.5, CenterY = 0.5, Angle = 0, }; CoverImage.RenderTransform = transform; animation = new DoubleAnimation() { From = 0, To = 360, Duration = TimeSpan.FromSeconds(10), RepeatBehavior = RepeatBehavior.Forever }; }
private void GameManagerOnIsCountingDownChanged(object sender, EventArgs eventArgs) { TimerLabel.Invoke((MethodInvoker) delegate { TimerLabel.BackColor = _gameManager.GetIsCountingDown() ? Color.FromArgb(200, 0, 0) : Color.FromArgb(0, 200, 0); }); }
void ReleaseDesignerOutlets() { if (ChangeMapTypeButton != null) { ChangeMapTypeButton.Dispose(); ChangeMapTypeButton = null; } if (FocusOnSeekiosButton != null) { FocusOnSeekiosButton.Dispose(); FocusOnSeekiosButton = null; } if (FocusOnZoneButton != null) { FocusOnZoneButton.Dispose(); FocusOnZoneButton = null; } if (MapViewControl != null) { MapViewControl.Dispose(); MapViewControl = null; } if (MapZoomInButton != null) { MapZoomInButton.Dispose(); MapZoomInButton = null; } if (MapZoomOutButton != null) { MapZoomOutButton.Dispose(); MapZoomOutButton = null; } if (NextButton != null) { NextButton.Dispose(); NextButton = null; } if (NumberOfPointsLabel != null) { NumberOfPointsLabel.Dispose(); NumberOfPointsLabel = null; } if (RefreshInProgressButton != null) { RefreshInProgressButton.Dispose(); RefreshInProgressButton = null; } if (SurfaceLabel != null) { SurfaceLabel.Dispose(); SurfaceLabel = null; } if (TimerLabel != null) { TimerLabel.Dispose(); TimerLabel = null; } if (UndoButton != null) { UndoButton.Dispose(); UndoButton = null; } }
protected override void OnTimerStarted(TimerLabel label) { _data.AppendLine("[Recast] Timer started: " + label); }
protected override void OnTimerStopped(TimerLabel label) { _data.AppendLine("[Recast] Timer stopped: " + label + " (Accumulated: " + GetElapsedTime(label) + ")"); }
protected override void OnTimerStarted(TimerLabel label) { Console.WriteLine("[Recast] Timer started: " + label); }
protected override void OnTimerStopped(TimerLabel label) { Console.WriteLine("[Recast] Timer stopped: " + label + " (Elapsed: " + GetElapsedTime(label) + ")"); }
protected override async void OnAppearing() { base.OnAppearing(); //Set up panel state await Task.Delay(1000); TooEarlyPanel.Opacity = 0; TooEarlyPanel.IsVisible = true; await TooEarlyPanel.FadeTo(1, 500); // Undo possible navigation to next page await Task.WhenAll(GiftTop.TranslateTo(0, 0, 500), GiftTop.FadeTo(1, 500)); if (DateTime.Now < ChristmasDate && !SkipCountdown) { //Set up countdown timer Device.StartTimer( TimeSpan.FromSeconds(1), () => { TimeSpan timeTillChristmas = ChristmasDate - DateTime.Now; if (timeTillChristmas > TimeSpan.Zero) { Device.BeginInvokeOnMainThread( () => TimerLabel.Text = $"{timeTillChristmas.Days}d {timeTillChristmas.Hours}h {timeTillChristmas.Minutes}m {timeTillChristmas.Seconds}s" ); return(true); } else { Device.BeginInvokeOnMainThread(() => { TimerLabel.Text = "0d 0h 0m 0s"; NextButton.IsVisible = true; NextButton.InputTransparent = false; Task.WhenAll( TooEarlyLabel1.FadeTo(0, 2000), TooEarlyLabel2.FadeTo(0, 2000), TimerLabel.TranslateTo(0, 50, 4000), TimerLabel.ScaleTo(2, 4000), NextButton.FadeTo(1, 4000) ); }); return(false); } } ); } else { NextButton.Opacity = 1; NextButton.InputTransparent = false; } //Set up gift box hints string?response = await _networkService.GetGiftHints(); if (String.IsNullOrWhiteSpace(response)) { return; } // Update local cache Settings.GiftHintsV2 = response; InitHints(Settings.GiftHintsV2); await _pinkieService.UpdateEventsFromRemote(); Accelerometer.ShakeDetected += Accelerometer_ShakeDetected; try { if (!Accelerometer.IsMonitoring) { Accelerometer.Start(_sensorSpeed); } } catch (Exception ex) { Debug.WriteLine($"Unable to start listening to Accelerometer: {ex}"); } }
protected abstract void OnTimerStarted(TimerLabel label);
private void GameManagerOnTimeStringChanged(object sender, EventArgs eventArgs) { TimerLabel.Invoke((MethodInvoker) delegate { TimerLabel.Text = _gameManager.GetTimeString(); }); }