private void ComputeChart(Func <threeDimensionalPointDTO, double> Mapping) { if (LeftLens.Equals(selected)) { NavigationService.Navigate(new ThreeDimensionalLensPage(model.LeftAnalyzeLensResponse.points, Mapping)); } else if (RightLens.Equals(selected)) { NavigationService.Navigate(new ThreeDimensionalLensPage(model.RightAnalyzeLensResponse.points, Mapping)); } }
private void Model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if ("RightAnalyzeLensResponse".Equals(e.PropertyName)) { RightLens.InvalidateVisual(); RightLens.MouseLeftButtonDown -= LensSelected; RightLens.MouseLeftButtonDown += LensSelected; RightLens.MouseMove += Tooltip_MouseMove; } else if ("LeftAnalyzeLensResponse".Equals(e.PropertyName)) { LeftLens.InvalidateVisual(); LeftLens.MouseLeftButtonDown -= LensSelected; LeftLens.MouseLeftButtonDown += LensSelected; LeftLens.MouseMove += Tooltip_MouseMove; } }
private void Tooltip_MouseMove(object sender, MouseEventArgs e) { double centerX = (sender as FrameworkElement).ActualWidth / 2.0; double centerY = (sender as FrameworkElement).ActualHeight / 2.0; double radius = Math.Min(centerX, centerY) * 5 / 6; Point currentPos = e.GetPosition(sender as IInputElement); double x = centerX - currentPos.X; double y = centerY - currentPos.Y; bool inside = IsInside( new twoDimensionalPointDTO() { x = x, y = y }, radius); if (!floatingTip.IsOpen.Equals(inside)) { floatingTip.IsOpen = inside; } if (inside) { floatingTip.PlacementTarget = sender as UIElement; floatingTip.HorizontalOffset = currentPos.X + 20; floatingTip.VerticalOffset = currentPos.Y; analyzedPointDTO[] points = LeftLens.Equals(sender) ? model.LeftAnalyzeLensResponse.points : model.RightAnalyzeLensResponse.points; int sqrt = Convert.ToInt32(Math.Sqrt(points.Count())); int side = (sqrt - 1) / 2; int xPoint = Convert.ToInt32(Math.Round(x * side / radius)); int yPoint = Convert.ToInt32(Math.Round(y * side / radius)); int index = (side + xPoint) * sqrt + side - yPoint; floatingTip.DataContext = points[index]; } }
private void Toolbar_Mask_Clicked(object sender, RoutedEventArgs e) { mask = !mask; RightLens.InvalidateVisual(); LeftLens.InvalidateVisual(); }
private void Toolbar_Compare_Clicked(object sender, RoutedEventArgs e) { compare = !compare; RightLens.InvalidateVisual(); LeftLens.InvalidateVisual(); }
private void Toolbar_PowerMap_Clicked(object sender, EventArgs e) { mapping = ToPowerMap; RightLens.InvalidateVisual(); LeftLens.InvalidateVisual(); }