/// <summary> /// Event wird aufgerufen bei TouchUp auf SafeSelect. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Eventparameter</param> private void OptionTouchUp(object sender, TouchEventArgs e) { // If this contact is the one that was remembered if (e.TouchDevice == OptionControlTouchDevice) { // Forget about this contact. OptionControlTouchDevice = null; SurfaceButton pressedButton = (SurfaceButton)sender; var bc = new BrushConverter(); RemovingText.Foreground = new SolidColorBrush(Colors.White); AddingText.Foreground = new SolidColorBrush(Colors.White); ConfirmAddRectangle.Fill = (Brush)bc.ConvertFrom("#FFE2E2E2"); ConfirmRemoveRectangle.Fill = (Brush)bc.ConvertFrom("#FFE2E2E2"); if (pressedButton.Margin.Left <= 146 || pressedButton.Margin.Left >= 306) { // pass event to SurfaceWindow1.xaml.cs RoutedEventArgs eventargs = new RoutedEventArgs(ModelOverviewControl.AddOrRemoveSelectedEvent); RaiseEvent(eventargs); } _chosenPanel = ChosenPanel.None; // Reset Button ResetButton(pressedButton); } }
/// <summary> /// Event wird aufgerufen bei TouchMove auf SafeSelect. /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Eventparameter</param> private void OptionTouchMove(object sender, TouchEventArgs e) { // If this contact is the one that was remembered if (e.TouchDevice == OptionControlTouchDevice) { double touchPointXOnGrid = OptionControlTouchDevice.GetTouchPoint(this.AddOrRemoveGrid).Position.X; touchPointXOnGrid = touchPointXOnGrid - TouchPointXOnButton; if (touchPointXOnGrid < 136) { touchPointXOnGrid = 136; } else if (touchPointXOnGrid > 316) { touchPointXOnGrid = 316; } ((SurfaceButton)sender).Margin = new Thickness(touchPointXOnGrid, ((SurfaceButton)sender).Margin.Top, ((SurfaceButton)sender).Margin.Right, ((SurfaceButton)sender).Margin.Bottom); // Console.WriteLine(touchPointXOnGrid); RemovingText.Foreground = new SolidColorBrush(Colors.White); AddingText.Foreground = new SolidColorBrush(Colors.White); ConfirmAddRectangle.Fill = new SolidColorBrush(Colors.White); ConfirmRemoveRectangle.Fill = new SolidColorBrush(Colors.White); _chosenPanel = ChosenPanel.None; if (touchPointXOnGrid < 231 && touchPointXOnGrid > 221) { PlusMinusImage.Source = new BitmapImage(new Uri("../Images/plusminus.png", UriKind.Relative)); } else if (touchPointXOnGrid < 146) { AddingText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen")); ConfirmAddRectangle.Fill = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen")); PlusMinusImage.Source = new BitmapImage(new Uri("../Images/plusminusplus.png", UriKind.Relative)); _chosenPanel = ChosenPanel.Add; } else if (touchPointXOnGrid > 306) { RemovingText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen")); ConfirmRemoveRectangle.Fill = new SolidColorBrush((Color)FindResource("TouchLineColor_Chosen")); PlusMinusImage.Source = new BitmapImage(new Uri("../Images/plusminusminus.png", UriKind.Relative)); _chosenPanel = ChosenPanel.Remove; } else if (touchPointXOnGrid <= 221) { AddingText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Base")); ConfirmAddRectangle.Fill = new SolidColorBrush((Color)FindResource("TouchLineColor_Base")); PlusMinusImage.Source = new BitmapImage(new Uri("../Images/plusminusplus.png", UriKind.Relative)); _chosenPanel = ChosenPanel.Remove; } else if (touchPointXOnGrid >= 231) { RemovingText.Foreground = new SolidColorBrush((Color)FindResource("TouchLineColor_Base")); ConfirmRemoveRectangle.Fill = new SolidColorBrush((Color)FindResource("TouchLineColor_Base")); PlusMinusImage.Source = new BitmapImage(new Uri("../Images/plusminusminus.png", UriKind.Relative)); _chosenPanel = ChosenPanel.Remove; } } }