Browse Source

Delay renamed to Interval. InitialDelay renamed to Delay.

pull/1439/head
dzhelnin 9 years ago
parent
commit
e468760c96
  1. 28
      src/Avalonia.Controls/RepeatButton.cs

28
src/Avalonia.Controls/RepeatButton.cs

@ -7,35 +7,35 @@ namespace Avalonia.Controls
public class RepeatButton : Button public class RepeatButton : Button
{ {
/// <summary> /// <summary>
/// Defines the <see cref="Delay"/> property. /// Defines the <see cref="Interval"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<int> DelayProperty = public static readonly StyledProperty<int> IntervalProperty =
AvaloniaProperty.Register<Button, int>(nameof(Delay), 100); AvaloniaProperty.Register<Button, int>(nameof(Interval), 100);
/// <summary> /// <summary>
/// Defines the <see cref="InitialDelay"/> property. /// Defines the <see cref="Delay"/> property.
/// </summary> /// </summary>
public static readonly StyledProperty<int> InitialDelayProperty = public static readonly StyledProperty<int> DelayProperty =
AvaloniaProperty.Register<Button, int>(nameof(InitialDelay), 300); AvaloniaProperty.Register<Button, int>(nameof(Delay), 300);
private DispatcherTimer _repeatTimer; private DispatcherTimer _repeatTimer;
/// <summary> /// <summary>
/// Gets or sets the amount of time, in milliseconds, of repeating clicks. /// Gets or sets the amount of time, in milliseconds, of repeating clicks.
/// </summary> /// </summary>
public int Delay public int Interval
{ {
get { return GetValue(DelayProperty); } get { return GetValue(IntervalProperty); }
set { SetValue(DelayProperty, value); } set { SetValue(IntervalProperty, value); }
} }
/// <summary> /// <summary>
/// Gets or sets the amount of time, in milliseconds, to wait before repeating begins. /// Gets or sets the amount of time, in milliseconds, to wait before repeating begins.
/// </summary> /// </summary>
public int InitialDelay public int Delay
{ {
get { return GetValue(InitialDelayProperty); } get { return GetValue(DelayProperty); }
set { SetValue(InitialDelayProperty, value); } set { SetValue(DelayProperty, value); }
} }
private void StartTimer() private void StartTimer()
@ -48,13 +48,13 @@ namespace Avalonia.Controls
if (_repeatTimer.IsEnabled) return; if (_repeatTimer.IsEnabled) return;
_repeatTimer.Interval = TimeSpan.FromMilliseconds(InitialDelay); _repeatTimer.Interval = TimeSpan.FromMilliseconds(Delay);
_repeatTimer.Start(); _repeatTimer.Start();
} }
private void RepeatTimerOnTick(object sender, EventArgs e) private void RepeatTimerOnTick(object sender, EventArgs e)
{ {
var interval = TimeSpan.FromMilliseconds(Delay); var interval = TimeSpan.FromMilliseconds(Interval);
if (_repeatTimer.Interval != interval) if (_repeatTimer.Interval != interval)
{ {
_repeatTimer.Interval = interval; _repeatTimer.Interval = interval;

Loading…
Cancel
Save