Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SASave: Making time/weight controls actually work hopefully.
  • Loading branch information
MainMemory committed Jan 8, 2015
1 parent a1a7da3 commit 6da8cde
Show file tree
Hide file tree
Showing 6 changed files with 381 additions and 331 deletions.
204 changes: 104 additions & 100 deletions SASave/HourControl.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions SASave/HourControl.cs
Expand Up @@ -16,6 +16,7 @@ public HourControl()
InitializeComponent();
}

bool updating = false;
public event EventHandler ValueChanged = delegate { };

public int Hours { get { return (int)hours.Value; } set { hours.Value = value; ValueChanged(this, EventArgs.Empty); } }
Expand All @@ -32,10 +33,12 @@ public TimeSpan TimeSpan
}
set
{
updating = true;
Centiseconds = (int)Math.Round(value.Milliseconds / 10.0, MidpointRounding.AwayFromZero);
Seconds = value.Seconds;
Minutes = value.Minutes;
Hours = (int)value.TotalHours;
updating = false;
}
}

Expand Down Expand Up @@ -66,6 +69,11 @@ public uint Frames
TotalCentiseconds = (uint)Math.Round(value * Frame, MidpointRounding.AwayFromZero);
}
}

private void hours_ValueChanged(object sender, EventArgs e)
{
if (!updating) ValueChanged(this, EventArgs.Empty);
}
}

public class HourControlDesigner : ControlDesigner
Expand Down

0 comments on commit 6da8cde

Please sign in to comment.