Skip to content

Commit

Permalink
Move debug lines under a const value to prevent spamming other applic…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
mitchcapper committed Oct 15, 2015
1 parent 26b3313 commit 0ceb129
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 @@ -553,8 +555,9 @@ private void gridRating_PointerMoved(object sender, PointerRoutedEventArgs e)
{
if (IsEditable && 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 @@ -569,7 +572,8 @@ void RatingControl_ManipulationDelta(object sender, System.Windows.Input.Manipul
if (IsEditable && 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 @@ -584,7 +588,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 0ceb129

Please sign in to comment.