Skip to content

Commit

Permalink
Merge pull request #2 from mitchcapper/RemoveDebugLine
Browse files Browse the repository at this point in the history
Move debug lines under a const value to prevent spamming others
  • Loading branch information
BratchedDev committed Oct 15, 2015
2 parents 2f6181c + 0ceb129 commit 11a9c7c
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Src/Bratched.Tools/RatingControl/RatingControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum DefinitionCycles { Repeat, Linear }

public partial class RatingControl : UserControl
{
private const bool DEBUG_MODE = false;
public RatingControl()
{
EmptyItemsDefinition = new List<IRateItemDefinition>();
Expand Down Expand Up @@ -53,7 +54,7 @@ private void ChangeItemsValue(double x)
{
#if NETFX_CORE
Value = x / 100;
#endif
#endif
#if WINDOWS_PHONE
// Value = x / 100; return;

Expand All @@ -62,9 +63,10 @@ private void ChangeItemsValue(double x)
double marginX = (ActualWidth - realWidth) / 2;
if (rateItems.Children.Any() && realWidth > 0)
Value = (x - marginX) / (realWidth) * ItemsCount;
System.Diagnostics.Debug.WriteLine(String.Format("New Value {0}, ActualWidth {1}, realWidth {2}, margin {3}, X={4} ", Value, ActualWidth, realWidth, marginX, x));
if (DEBUG_MODE)
System.Diagnostics.Debug.WriteLine(String.Format("New Value {0}, ActualWidth {1}, realWidth {2}, margin {3}, X={4} ", Value, ActualWidth, realWidth, marginX, x));
#endif
}
}

#if NETFX_CORE
void RatingControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
Expand Down Expand Up @@ -560,8 +562,9 @@ private void gridRating_PointerMoved(object sender, PointerRoutedEventArgs e)
{
if (IsEditable && (AllowHover || e.Pointer.IsInContact) && IsEnabled && Visibility==Visibility.Visible && rateItems != null && rateItems.Children.Any())
{
e.Handled = true;
System.Diagnostics.Debug.WriteLine("PointerMoved {0}", DateTime.Now);
e.Handled = true;
if (DEBUG_MODE)
System.Diagnostics.Debug.WriteLine("PointerMoved {0}", DateTime.Now);
PointerPoint p = e.GetCurrentPoint(rateItems.Children.First());
if (p != null && p.Position != null)
ChangeItemsValue(p.Position.X);
Expand All @@ -576,7 +579,8 @@ void RatingControl_ManipulationDelta(object sender, System.Windows.Input.Manipul
if (IsEditable && AllowHover && IsEnabled && Visibility == Visibility.Visible && e != null && e.ManipulationOrigin != null)
{
e.Handled = true;
System.Diagnostics.Debug.WriteLine("ManipulationDelta {0} - {1}", DateTime.Now, e.ManipulationOrigin.X);
if (DEBUG_MODE)
System.Diagnostics.Debug.WriteLine("ManipulationDelta {0} - {1}", DateTime.Now, e.ManipulationOrigin.X);
double x = e.ManipulationOrigin.X;
ChangeItemsValue(x);
}
Expand All @@ -591,7 +595,8 @@ void RatingControl_MouseLeftButtonDown(object sender, System.Windows.Input.Mouse
if (p != null)
{
ChangeItemsValue(p.X);
System.Diagnostics.Debug.WriteLine("PointerMoved {0} - {1}", DateTime.Now, p.X);
if (DEBUG_MODE)
System.Diagnostics.Debug.WriteLine("PointerMoved {0} - {1}", DateTime.Now, p.X);
}
}
}
Expand Down

0 comments on commit 11a9c7c

Please sign in to comment.