void absoluteLayout_Tapped(object sender, EventArgs evt) { MR.Gestures.TapEventArgs tappedArgs = evt as MR.Gestures.TapEventArgs; if (null != tappedArgs) { Point tapPointAbsolute = tappedArgs.Touches[0]; // make sure that the tap is within the bounds of the view float range = boxSize / 2.0f; bool isInBounds = tapPointAbsolute.X - range >= 0 && tapPointAbsolute.Y - range >= 0 && tapPointAbsolute.X + range <= tapPointsLayout.Width && tapPointAbsolute.Y + range <= tapPointsLayout.Height; Point tapPointProportional = new Point( tapPointAbsolute.X / tapPointsLayout.Width, tapPointAbsolute.Y / tapPointsLayout.Height); Debug.WriteLine("Tap point: " + tapPointProportional.X + ", " + tapPointProportional.Y); if (isInBounds) { AddLabelPoint(tapPointProportional); } } }
void RightFrameDoubleTapped(object sender, MR.Gestures.TapEventArgs e) { rightScore--; rightScoreText.Opacity = 0.5; rightScoreText.Text = string.Format("{0}", rightScore); rightScoreText.FadeTo(1); }
private void PoolType_OnTapped(object sender, MR.Gestures.TapEventArgs e) { poolTypePicker.Focus(); poolTypePicker.SelectedIndexChanged += PoolTypePicker_SelectedIndexChanged; poolTypePicker.Unfocused -= PoolTypePicker_Unfocused; poolTypePicker.Unfocused += PoolTypePicker_Unfocused; }
void LeftFrameDoubleTapped(object sender, MR.Gestures.TapEventArgs e) { leftScore--; leftScoreText.Opacity = 0.5; leftScoreText.Text = string.Format("{0}", leftScore); leftScoreText.FadeTo(1); }
private void ImageTapped(object sender, MR.Gestures.TapEventArgs e) { Image theImage = (Image)sender; popupImageView.IsVisible = true; imgPopup.Source = theImage.Source; }
void TappedLabel(object sender, MR.Gestures.TapEventArgs e) { Label lblMessage = (Label)sender; bool isUri = IsUrlValid(lblMessage.Text.Trim()); if (isUri) { Device.OpenUri(new Uri(lblMessage.Text.Trim())); } }
protected override void OnTapped(MR.Gestures.TapEventArgs e) { base.OnTapped(e); var sc = e.Sender as MR.Gestures.SwitchCell; if (sc != null) { SwitchValue = !SwitchValue; } }
protected override void OnTapped(MR.Gestures.TapEventArgs e) { base.OnTapped(e); if (progress > 300) { progress = 0; AddText("Starting ProgressBars again."); Xamarin.Forms.Device.StartTimer(TimeSpan.FromMilliseconds(200), onTimer); } }
private async void OnListViewItemSelected(object sender, MR.Gestures.TapEventArgs e) { var item = (ConversationForList)((ViewCell)sender).BindingContext; if (!(item is ConversationForList selectedConversation)) { return; } _viewModel.Item = item; await Navigation.PushAsync(new ChatPage(selectedConversation.TripId, selectedConversation.UserId, selectedConversation.Id, selectedConversation.UserName)); }
private void ClickField_Clicked(object sender, MR.Gestures.TapEventArgs e) { var fingerCount = e.NumberOfTouches; var label = this.FindByName <Label>("ClickMeLabel"); label.Text = $"{fingerCount} finger tap"; var adjustedClickCount = AdjustedSumValue(fingerCount) - AdjustedSumValue(fingerCount - 1); foreach (var i in Enumerable.Range(0, adjustedClickCount)) { _viewModel.Click(); } }
public void Add(MR.Gestures.TapEventArgs args) { var item = (string)((BindableObject)args.Sender).BindingContext; var i = Items.IndexOf(item) + 1; var newitem = ListOfStringsViewModel.Numbers[nextNumber++]; if (nextNumber >= ListOfStringsViewModel.Numbers.Length) { nextNumber = 0; } //AddText($"Adding {newitem} at position {i}"); Items.Insert(i, newitem); }
protected override void OnTapping(MR.Gestures.TapEventArgs e) { base.OnTapping(e); if (e.Touches == null) { return; } if (signsOnBoard == 9) { InitBoard(); return; } if (e.Touches == null || e.Touches.Length == 0) { AddText("Touch coordinates are missing."); return; } int x = (int)(e.Touches[0].X * 3 / e.ViewPosition.Width); int y = (int)(e.Touches[0].Y * 3 / e.ViewPosition.Height); if (Device.RuntimePlatform == Device.macOS) // stupid Mac has 0/0 in the LOWER left corner { y = 2 - y; // so I need to have a reference to XF and platform specific code in the VM } if (board[y][x] != ' ') { AddText("Field {0}/{1} is already filled.", x, y); return; } board[y][x] = next; NotifyPropertyChanged("ImageCell" + y + x); next = next == 'X' ? 'O' : 'X'; signsOnBoard++; checkGameOver(); }
protected override void OnTapping(MR.Gestures.TapEventArgs e) { base.OnTapping(e); if (e.Touches == null) { return; } if (signsOnBoard == 9) { InitBoard(); return; } if (e.Touches == null || e.Touches.Length == 0) { AddText("Touch coordinates are missing."); return; } int x = (int)(e.Touches[0].X * 3 / e.ViewPosition.Width); int y = (int)(e.Touches[0].Y * 3 / e.ViewPosition.Height); if (board[y][x] != ' ') { AddText("Field {0}/{1} is already filled.", x, y); return; } board[y][x] = next; NotifyPropertyChanged("ImageCell" + y + x); next = next == 'X' ? 'O' : 'X'; signsOnBoard++; checkGameOver(); }
private void TappedGesture(object sender, MR.Gestures.TapEventArgs e) { ArticleViewModel articleViewModel = (ArticleViewModel)BindingContext; CellGestures.TappedGesture(_stateController, articleViewModel); }
void Cell_DoubleTapped(object sender, MR.Gestures.TapEventArgs e) { ((TextOnlyViewModel)BindingContext).AddText("Cell_DoubleTapped method called " + e.NumberOfTaps + " times"); }
private void Page_Tapped(object sender, MR.Gestures.TapEventArgs e) { ((TextOnlyViewModel)BindingContext).AddText("Page_Tapped method called."); }