protected override void OnTouchUp(Microsoft.SPOT.Input.TouchEventArgs e) { if (ClickUp != null) { ClickUp(this, e); } }
protected override void OnTouchUp(TouchEventArgs e) { base.OnTouchUp(e); this.Background = StateNormal; this.Invalidate(); this.UpdateLayout(); }
protected override void OnTouchUp(TouchEventArgs e) { base.OnTouchUp(e); int x, y; e.GetPosition(this, 0, out x, out y); CalibrationManager.CalibrationPoints.TouchX[idx] = (short)x; CalibrationManager.CalibrationPoints.TouchY[idx] = (short)y; idx++; if (idx == CalibrationManager.CalibrationPoints.Count) { // The last point has been reached. CalibrationManager.ApplyCalibrationPoints(); CalibrationManager.SaveCalibrationPoints(); Close(); if (CalibrationComplete != null) CalibrationComplete(this, EventArgs.Empty); } Invalidate(); }
protected override void OnTouchDown(TouchEventArgs e) { base.OnTouchDown(e); pushed = true; Invalidate(); }
protected override void OnTouchDown(TouchEventArgs e) { base.OnTouchDown(e); parent_.SelectedItem = this; StateNormal = (SolidColorBrush)Background; this.Background = StatePressed; }
void window_TouchDown(object sender, Microsoft.SPOT.Input.TouchEventArgs e) { int x; int y; // Use the out parameters to get the position of touch. e.GetPosition(window, 0, out x, out y); displayTE35.SimpleGraphics.DisplayEllipse(GT.Color.Red, 5, GT.Color.Yellow, x, y, 50, 30, 0); }
protected override void OnTouchUp(TouchEventArgs e) { base.OnTouchUp(e); pushed = false; if (Click != null) { Click(this, new EventArgs()); } Invalidate(); }
protected override void OnTouchDown(TouchEventArgs e) { int x, y, w, h; GetLayoutOffset(out x, out y); GetRenderSize(out w, out h); x += _left; y += _top; TouchCapture.Capture(this); Microsoft.SPOT.Touch.Ink.SetInkRegion(0, x, y, x + w, y + h, _borderWidth, (int)_defaultDrawingAttributes.Color, 1, _bitmap); }
private void PostProcessInput(object sender, ProcessInputEventArgs e) { if (!e.StagingItem.Input.Handled) { RoutedEvent routedEvent = e.StagingItem.Input.RoutedEvent; if (routedEvent == InputManager.InputReportEvent) { InputReportEventArgs input = e.StagingItem.Input as InputReportEventArgs; if (input != null) { RawTouchInputReport report = input.Report as RawTouchInputReport; if (report != null) { TouchEventArgs args = new TouchEventArgs( this, report.Timestamp, report.Touches); UIElement target = report.Target; if (report.EventMessage == (byte)TouchMessages.Down) { args.RoutedEvent = TouchEvents.TouchDownEvent; } else if (report.EventMessage == (byte)TouchMessages.Up) { args.RoutedEvent = TouchEvents.TouchUpEvent; } else if (report.EventMessage == (byte)TouchMessages.Move) { args.RoutedEvent = TouchEvents.TouchMoveEvent; } else throw new Exception("Unknown touch event."); args.Source = (target == null ? _focus : target); e.PushInput(args, e.StagingItem); } } } } }
protected override void OnTouchDown(TouchEventArgs e) { base.OnTouchDown(e); int x; int y; e.GetPosition((UIElement)this, 0, out x, out y); #endif // Start at the beginning of the array and set the flag to draw // a circle. pointIndex = 0; drawCircle = true; cx = x; cy = y; r = 10; Invalidate(); }
public void SetpointChangeButtons_UpButtonTouchDown(object sender, TouchEventArgs e) { theModel.DesiredTemperature++; SetpointChangeButtons.ButtonValue = theModel.DesiredTemperature + theModel.TemperatureDegreeSymbol; }
void UnitsChangeButtons_ButtonTouchDown(object sender, TouchEventArgs e) { theModel.ToggleUnits(); UnitsChangeButtons.ButtonValue = theModel.TemperatureDegreeSymbol; SetpointChangeButtons.ButtonValue = theModel.DesiredTemperature + theModel.TemperatureDegreeSymbol; }
void ModeChangeButtons_UpButtonTouchDown(object sender, TouchEventArgs e) { theModel.ChangeOperatingMode(Model.Direction.directionUp); ModeChangeButtons.ButtonValue = theModel.ControllerModeString; }
protected override void OnTouchDown(TouchEventArgs e) { base.OnTouchDown(e); TouchCapture.Capture(this); #endif int x; int y; // Get the position of the event. #if MF_FRAMEWORK_VERSION_V3_0 e.GetPosition(this, out x, out y); #else e.GetPosition(this, 0, out x, out y); #endif int r = 0; int c = 0; // Calculate the row and column. r = y / _itemHeight; c = x / _itemWidth; // Validate the row and column. if ((r >= 0) && (r < _row) && (c >= 0) && (c < _column)) { // Set the item pressed value. _pressedItem = c + r * _column; } else { // Reset the item pressed value. _pressedItem = -1; } Invalidate(); }
protected override void OnTouchUp(TouchEventArgs e) #endif { // Flag for the drawing state. _pressed = false; // Capture the touch. #if MF_FRAMEWORK_VERSION_V3_0 Stylus.Capture(this, CaptureMode.None); #else TouchCapture.Capture(this, CaptureMode.None); #endif // Trigger a redraw. Invalidate(); // Fire a click event. EventArgs args = new EventArgs(); OnClick(args); }
protected override void OnTouchDown(TouchEventArgs e) { base.OnTouchDown(e); #endif // Start at the beginning of the array and set the flag to draw // a circle. pointIndex = 0; drawCircle = true; int x; int y; #if MF_FRAMEWORK_VERSION_V3_0 e.GetPosition((UIElement)this, out x, out y); #else e.GetPosition((UIElement)this, 0, out x, out y); #endif cx = x; cy = y; // Add the first point to the array. AddPoint(x, y); r = 10; // Change the text to show touch down and location. text.TextContent = "TouchDown (" + x.ToString() + "," + y.ToString() + ")"; // Clear the entire screen because we've erased the previous // line (if any). Invalidate(); e.Handled = true; }
protected override void OnTouchMove(TouchEventArgs e) { base.OnTouchMove(e); int x = 0; int y = 0; for (int i = 0; i < e.Touches.Length; i++) { e.GetPosition((UIElement)this, i, out x, out y); // Add this point to the array. AddPoint(x, y); } text.TextContent = "TouchMove (" + x.ToString() + "," + y.ToString() + ")"; }
void arrowDwnImage_TouchDown(object sender, TouchEventArgs e) { DownButton_TouchDown(e); }
protected override void OnTouchUp(TouchEventArgs e) { if (IsEnabled) IsChecked = !IsChecked; }
protected override void OnTouchUp(TouchEventArgs e) #endif { // Reset the slider flags. _moveVerticalSlider = false; _moveHorizontalSlider = false; }
protected override void OnTouchMove(TouchEventArgs e) #endif { int x = 0; int y = 0; #if MF_FRAMEWORK_VERSION_V3_0 x = e.X; y = e.Y; #else e.GetPosition(this, 0, out x, out y); #endif // If a slider was tapped... if (_moveVerticalSlider) { // The vertical slider was clicked. // Calculate the difference between the old position and the // new position. int diff = y - _verticalSliderMoveY; // Calculate the view difference. int realDiff = (diff * _totalViewHeight) / _verticalScrollViewHeight; // Set the new position of the slider. _verticalSliderMoveY = y; // Validate the new position and bound-align it. if (_verticalSliderMoveY < _verticalSliderY + _columnHeaderHeight) _verticalSliderMoveY = _verticalSliderY + _columnHeaderHeight; // Update the view scroll position. ScrollVertical(realDiff); } else if (_moveHorizontalSlider) { // The horizontal slider was clicked. // Calculate the difference between the old position and the // new position. int diff = x - _horizontalSliderMoveX; // Validate and bound-align the difference. if (x >= _horizontalSliderMoveX && _horizontalSliderX + _horizontalSliderWidth + diff >= _width + _scrollbarDimension) { diff -= (_width + _scrollbarDimension) - (_horizontalSliderX + _horizontalSliderWidth + diff); } // Validate the new position. if (_horizontalSliderX + _horizontalSliderWidth + diff < _width + _scrollbarDimension || x < _horizontalSliderMoveX) { // Calculate the view difference. int realDiff = (diff * _totalViewWidth) / _horizontalScrollViewWidth; // Set the new position of the slider. _horizontalSliderMoveX = x; // Update the view scroll position. ScrollHorizontal(realDiff); } } }
protected override void OnTouchDown(TouchEventArgs e) #endif { int x = 0; int y = 0; #if MF_FRAMEWORK_VERSION_V3_0 x = e.X; y = e.Y; #else e.GetPosition(this, 0, out x, out y); #endif try { // Figure out which section of the screen was clicked. if (y <= cy1) { // The button area was clicked. if (x <= cx1) { // The New File button was clicked. if (Directory.GetCurrentDirectory() == "\\") { Debug.Print("Cannot create a file at \\"); return; } // Get the next file name, by looping until the file // doesn't exist. int index = 0; string name = "File_0.txt"; while (File.Exists(name)) name = "File_" + (++index).ToString() + ".txt"; // Create the file using the standard .NET FileStream. FileStream file = new FileStream(name, FileMode.Create); // Write some dummy data to the file. for (int i = 0; i < (index + 5) * 2; i++) file.WriteByte((byte)i); // Close the file. file.Close(); // Refresh the list and invalidate. myApplication.mainWindow.RefreshList(); Invalidate(); } else if (x <= cx2) { // The New Directory button was clicked. if (Directory.GetCurrentDirectory() == "\\") { Debug.Print("Cannot create a directory at \\"); return; } // Get the next directory name, by looping until the // directory doesn't exist. int index = 0; string name = "Directory_0"; while (Directory.Exists(name)) name = "Directory_" + (++index).ToString(); // Create the directory. Directory.CreateDirectory(name); // Refresh the list, then re-draw the list. myApplication.mainWindow.RefreshList(); Invalidate(); } else if (x <= cx3) { // The Move button was clicked. if (Directory.GetCurrentDirectory() == "\\") { Debug.Print("Cannot move to or from \\"); return; } // If an item is selected, "move" it. if (_selectedItem != null) { // Get the sub-item that has the name. ListViewSubItem subItem = (ListViewSubItem)_selectedItem.SubItems[0]; if (subItem != null) { // If the name starts with [ and ends with ] // then it is a directory. This is only because // we put the [ and ] on our directory names. // There is nothing in the file system that // requires the [ and ]. if (subItem.Text[0] == '[' && subItem.Text[subItem.Text.Length - 1] == ']') { // Remove the [ and ] characters. string name = subItem.Text.Substring(1, subItem.Text.Length - 2); // Make sure the directory exists. if (Directory.Exists(name)) { // Move the directory to the same name + // .moved. Directory.Move(name, name + ".moved"); // Update the local name variable. name += ".moved"; // Update the name text. ((ListViewSubItem)_selectedItem.SubItems[0]).Text = '[' + name + ']'; // Get the index in Items of the // selected list view item. int index = Items.IndexOf(_selectedItem); // Remove the item, and then add the // item back in. Items.Remove(_selectedItem); Items.Insert(index, _selectedItem); // Re-draw the list. Invalidate(); } } else if (File.Exists(subItem.Text)) { // Without the [ and ] it is a file. // Move the file to the same name + .moved. File.Move(subItem.Text, subItem.Text + ".moved"); // Update the subitem text. subItem.Text += ".moved"; // Get the index in Items of the selected // list view item. int index = Items.IndexOf(_selectedItem); // Remove the item, then add the item back // in. Items.Remove(_selectedItem); Items.Insert(index, _selectedItem); // Re-draw the list. Invalidate(); } } } } else if (x <= cx4) { // The Delete button was clicked. if (Directory.GetCurrentDirectory() == "\\") { Debug.Print("Cannot delete from \\"); return; } // If an item is selected, delete the item. if (_selectedItem != null) { // Get the sub-item that has the name. ListViewSubItem subItem = (ListViewSubItem)_selectedItem.SubItems[0]; if (subItem != null) { // If the name starts with [ and ends with ], // then it is a directory. This is only because // we put the [ and ] on our directory names. // There is nothing in the file system that // requires the [ and ]. if (subItem.Text[0] == '[' && subItem.Text[subItem.Text.Length - 1] == ']') { // Remove the [ and ]. string name = subItem.Text.Substring(1, subItem.Text.Length - 2); // Make sure the directory exists. if (Directory.Exists(name)) { // Delete the directory. Directory.Delete(name); // Remove it from the list view. Items.Remove(_selectedItem); // Reset the selected item member. _selectedItem = null; } } else if (File.Exists(subItem.Text)) { // Without the [ and ], it is a file. // Delete the file. File.Delete(subItem.Text); // Remove it from the list view. Items.Remove(_selectedItem); // Reset the selected item member. _selectedItem = null; } // Re-draw the list view. Invalidate(); } } } else if (x <= cx5) { // The Format button was clicked. // Always go back to the root directory before // formatting. Directory.SetCurrentDirectory("\\"); // Format the volume and call it ROOT. Microsoft.SPOT.IO.VolumeInfo volInfo = new VolumeInfo("ROOT"); volInfo.Format(0); // Refresh the list, then re-draw the list. myApplication.mainWindow.RefreshList(); Invalidate(); } } else if (y <= cy2) { // Column. } else if (y >= cy3) { // The horizontal scrollbar was clicked. OnHorizontalScrollStylusDown(x); } else { if (x >= cx5) { // Vertical Scroll OnVerticalScrollStylusDown(y); } else { // Main section. // Calculate which item was clicked. int itemNumber = ((y - _columnHeaderHeight) + _sy) / _itemHeight; // If an item was clicked... if (itemNumber >= 0 && itemNumber < Items.Count) { // See if this item is already selected. if (_selectedItem == (ListViewItem)Items[itemNumber]) { // See if this is a directory. if (_selectedItem.SubItems.Count > 0) { string directoryName = ((ListViewSubItem)_selectedItem.SubItems[0]).Text; directoryName = directoryName.Substring(1, directoryName.Length - 2); // Check for special ".." name if (directoryName == "..") { directoryName = Directory.GetCurrentDirectory(); directoryName = Path.GetDirectoryName(directoryName); // directoryName.Substring(0, directoryName.LastIndexOf('\\')); } // If the directory exists... if (Directory.Exists(directoryName)) { // Set the current directory. Directory.SetCurrentDirectory( directoryName); // Refresh the list. myApplication.mainWindow.RefreshList(); } } } else // No item is selected, so select this one. _selectedItem = (ListViewItem)Items[itemNumber]; } else // No item is selected and we didn't click on one // either. _selectedItem = null; // Refresh the list view Invalidate(); } } } catch (IOException ex) { Debug.Print(ex.ToString()); } }
protected virtual void UpButton_TouchDown(TouchEventArgs e) { TouchEventHandler handler = UpButtonTouchDown; if (handler != null) { handler(this, e); } }
protected override void OnTouchUp(TouchEventArgs e) { base.OnTouchUp(e); int x; int y; e.GetPosition((UIElement)this, 0, out x, out y); #endif // Set the flag to draw a circle. drawCircle = true; cx = x; cy = y; r = 6; Invalidate(); }
void arrowUpImage_TouchDown(object sender, TouchEventArgs e) { UpButton_TouchDown(e); }
protected virtual void OnTouchDown(TouchEventArgs e) { if (TouchDown != null) { TouchDown(this, e); } }
protected override void OnTouchUp(TouchEventArgs e) { base.OnTouchUp(e); #endif // Set the flag to draw a circle. drawCircle = true; int x; int y; #if MF_FRAMEWORK_VERSION_V3_0 e.GetPosition((UIElement)this, out x, out y); #else e.GetPosition((UIElement)this, 0, out x, out y); #endif cx = x; cy = y; // Add the last point to the array. AddPoint(x, y); r = 6; // Change the text to show touch up and location. text.TextContent = "TouchUp (" + x.ToString() + "," + y.ToString() + ")"; #if MF_FRAMEWORK_VERSION_V3_0 Invalidate(); #else InvalidateRect(cx - r, cy - r, 2 * r, 2 * r); #endif }
protected virtual void OnTouchUp(TouchEventArgs e) { if (TouchUp != null) { TouchUp(this, e); } }
protected override void OnTouchDown(TouchEventArgs e) #endif { // Flag for drawing state. _pressed = true; // Capture the touch. #if MF_FRAMEWORK_VERSION_V3_0 Stylus.Capture(this); #else TouchCapture.Capture(this); #endif // Trigger a redraw. Invalidate(); }
protected virtual void OnTouchMove(TouchEventArgs e) { if (TouchMove != null) { TouchMove(this, e); } }
protected override void OnTouchMove(TouchEventArgs e) #endif { }
protected override void OnTouchUp(TouchEventArgs e) { base.OnTouchUp(e); TouchCapture.Capture(this, CaptureMode.None); #endif int x; int y; // Get the position of the event. #if MF_FRAMEWORK_VERSION_V3_0 e.GetPosition(this, out x, out y); #else e.GetPosition(this, 0, out x, out y); #endif int r = 0; int c = 0; // Calculate the row and column. r = y / _itemHeight; c = x / _itemWidth; // Validate the row and column. if ((r >= 0) && (r < _row) && (c >= 0) && (c < _column)) { // Calculate the item. int item = c + r * _column; // Make sure the item is the same one that the touch down // event occurred on. if (item == _pressedItem) { // Trigger a palette event. PaletteEventArg arg = new PaletteEventArg(item); OnItemClick(arg); } } }