当前位置: 首页>>代码示例>>C#>>正文


C# UIEvent类代码示例

本文整理汇总了C#中UIEvent的典型用法代码示例。如果您正苦于以下问题:C# UIEvent类的具体用法?C# UIEvent怎么用?C# UIEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UIEvent类属于命名空间,在下文中一共展示了UIEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HitTest

 public override UIView HitTest(CGPoint point, UIEvent uievent)
 {
     var hitView = base.HitTest(point, uievent);
     if (hitView == RootViewController.View)
         hitView = null;
     return hitView;
 }
开发者ID:NimaGhaedsharafi,项目名称:ToastsRTL.Forms.Plugin,代码行数:7,代码来源:MessageWindow.cs

示例2: TouchesEnded

		public override void TouchesEnded (NSSet touches, UIEvent evt)
		{
			CanvasView.DrawTouches (touches, evt);
			CanvasView.EndTouches (touches, false);

			ReticleView.Hidden = true;
		}
开发者ID:russellharvey,项目名称:monotouch-samples,代码行数:7,代码来源:MainViewController.cs

示例3: TouchesMoved

		/// <summary>
		///   Called when the fingers move
		/// </summary>
		public override void TouchesMoved (NSSet touches, UIEvent evt)
		{
			base.TouchesMoved (touches, evt);

			// if we haven't already failed
			if (base.State != UIGestureRecognizerState.Failed) {
				// get the current and previous touch point
				CGPoint newPoint = (touches.AnyObject as UITouch).LocationInView (View);
				CGPoint previousPoint = (touches.AnyObject as UITouch).PreviousLocationInView (View);

				// if we're not already on the upstroke
				if (!strokeUp) {
					// if we're moving down, just continue to set the midpoint at 
					// whatever point we're at. when we start to stroke up, it'll stick
					// as the last point before we upticked
					if (newPoint.X >= previousPoint.X && newPoint.Y >= previousPoint.Y) {
						midpoint = newPoint;
					}
                        // if we're stroking up (moving right x and up y [y axis is flipped])
                    else if (newPoint.X >= previousPoint.X && newPoint.Y <= previousPoint.Y) {
						strokeUp = true;
					}
                        // otherwise, we fail the recognizer
                    else {
						base.State = UIGestureRecognizerState.Failed;
					}
				}
			}

			Console.WriteLine (base.State.ToString ());
		}
开发者ID:ARMoir,项目名称:mobile-samples,代码行数:34,代码来源:CheckmarkGestureRecognizer.cs

示例4: Append

		bool Append (HashSet<UITouch> touches, UIEvent uievent)
		{
			var touchToAppend = trackedTouch;
			if (touchToAppend == null)
				return false;

			// Cancel the stroke recognition if we get a second touch during cancellation period.
			foreach (var touch in touches) {
				if (touch != touchToAppend && (touch.Timestamp - initialTimestamp < cancellationTimeInterval)) {
					State = (State == Possible) ? Failed : Cancelled;
					return false;
				}
			}

			// See if those touches contain our tracked touch. If not, ignore gracefully.
			if (!touches.Contains (touchToAppend))
				return false;

			var coalescedTouches = uievent.GetCoalescedTouches (touchToAppend);
			var lastIndex = coalescedTouches.Length - 1;
			for (var index = 0; index <= lastIndex; index++)
				Collect (Stroke, coalescedTouches [index], CoordinateSpaceView, (index != lastIndex), false);

			if (Stroke.State == StrokeState.Active) {
				var predictedTouches = uievent.GetPredictedTouches (touchToAppend);
				foreach (var touch in predictedTouches)
					Collect (Stroke, touch, CoordinateSpaceView, false, true);
			}
			return true;
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:30,代码来源:StrokeGestureRecognizer.cs

示例5: TouchesEnded

        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            try
            {
                bool allTouchesEnded = (touches.Count == evt.TouchesForView (this).Count);

                // first check for plain single/double tap, which is only possible if we haven't seen multiple touches
                if (!multipleTouches)
                {
                    var touch = (UITouch)touches.AnyObject;
                    // tapLocation = touch.LocationInView(this);
                    if (touch.TapCount == 1)
                    {
                        if (Tapped != null)
                            Tapped (this);
                    }
                    else if (touch.TapCount == 2)
                    {
                        if (DoubleTapped != null)
                            DoubleTapped (this);
                    }
                }
            }
            catch
            {
            }
            base.TouchesEnded (touches, evt);
        }
开发者ID:Clancey,项目名称:ClanceyLib,代码行数:28,代码来源:TapableView.cs

示例6: TouchesBegan

		public override void TouchesBegan (NSSet touches, UIEvent evt)
		{
			this.ExclusiveTouch = true;
			IndexCount++;

			var path = new UIBezierPath
			{
				LineWidth = PenWidth
			}  ;

			var touch = (UITouch)touches.AnyObject;
			PreviousPoint = (PointF)touch.PreviousLocationInView (this);

			var newPoint = touch.LocationInView (this);
			path.MoveTo (newPoint);

			InvokeOnMainThread (SetNeedsDisplay);

			CurrentPath = path;


			var line = new VESLine
			{
				Path = CurrentPath, 
				Color = UIColor.Black,
				Index = IndexCount 
			}  ;

			Lines.Add (line);

		}
开发者ID:kimuraeiji214,项目名称:Keys,代码行数:31,代码来源:WritingView.cs

示例7: TouchesBegan

        //TODO: Step 2 - Subscribe to touches began events
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            // we can get the number of fingers from the touch count, but Multitouch must be enabled
            lblNumberOfFingers.Text = string.Format("Number of Fingers: {0}", touches.Count);

            // get the touch
            var touch = touches.AnyObject as UITouch;

            if (touch == null) return;

            Console.WriteLine("screen touched");

            //TODO: Step 3 - Check if touch was on a particular view
            if (imgTouchMe.Frame.Contains(touch.LocationInView(View)))
                lblTouchStatus.Text = "Touch Status: Touches Began";

            //TODO: Step 4 - Detect multiple taps
            if (touch.TapCount == 2 && imgTapMe.Frame.Contains(touch.LocationInView(View)))
            {
                imgTapMe.Image = UIImage.FromBundle(
                    imageHighlighted
                        ? "Images/DoubleTapMe.png"
                        : "Images/DoubleTapMe_Highlighted.png");

                imageHighlighted = !imageHighlighted;
            }

            //TODO: Step 5 - Start recording a drag event
            if (imgDragMe.Frame.Contains(touch.LocationInView(View)))
                touchStartedInside = true;

        }
开发者ID:flolovebit,项目名称:xamarin-evolve-2014,代码行数:35,代码来源:SimpleTouch.cs

示例8: TouchesBegan

        public override void TouchesBegan(NSSet touchesSet, UIEvent evt)
        {
            var touches = touchesSet.ToArray<UITouch> ();
            touchPhaseLabel.Text = "Phase:Touches began";
            touchInfoLabel.Text = "";

            var numTaps = touches.Sum (t => t.TapCount);
            if (numTaps >= 2){
                touchInfoLabel.Text = string.Format ("{0} taps", numTaps);
                if (numTaps == 2 && piecesOnTop) {
                    // recieved double tap -> align the three pieces diagonal.
                    firstImage.Center = new PointF (padding + firstImage.Frame.Width / 2f,
                        touchInfoLabel.Frame.Bottom + padding + firstImage.Frame.Height / 2f);
                    secondImage.Center = new PointF (View.Bounds.Width / 2f, View.Bounds.Height / 2f);
                    thirdImage.Center = new PointF (View.Bounds.Width - thirdImage.Frame.Width / 2f - padding,
                        touchInstructionLabel.Frame.Top - thirdImage.Frame.Height);
                    touchInstructionLabel.Text = "";
                }

            } else {
                touchTrackingLabel.Text = "";
            }
            foreach (var touch in touches) {
                // Send to the dispatch method, which will make sure the appropriate subview is acted upon
                DispatchTouchAtPoint (touch.LocationInView (View));
            }
        }
开发者ID:BoogieMAN2K,项目名称:monotouch-samples,代码行数:27,代码来源:Touches_ClassicViewController.cs

示例9: TouchesBegan

		public override void TouchesBegan (NSSet touches, UIEvent evt)
		{
			 // hide keyboard
			name.ResignFirstResponder();
			email.ResignFirstResponder();
			comments.ResignFirstResponder();
		}
开发者ID:hawkstalion,项目名称:Tog-Mobile,代码行数:7,代码来源:ContactView.cs

示例10: TouchesMoved

		public override void TouchesMoved (Foundation.NSSet touches, UIEvent evt)
		{

			swiped = true;
			UITouch touch = touches.AnyObject as UITouch;

			CGPoint currentPoint= touch.LocationInView (this);

			UIGraphics.BeginImageContext(Frame.Size);
			tempDrawImage.Image.Draw(new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height));

			using (var context = UIGraphics.GetCurrentContext ())
			{

				context.MoveTo(lastPoint.X, lastPoint.Y);
				context.AddLineToPoint(currentPoint.X,currentPoint.Y);
				context.SetLineCap (CGLineCap.Round);
				context.SetLineWidth (brush);
				context.SetStrokeColor (PaintColor.CGColor);
				context.SetBlendMode (CGBlendMode.Normal);
				context.StrokePath ();


			}
			tempDrawImage.Image = UIGraphics.GetImageFromCurrentImageContext ();
			tempDrawImage.Alpha = opacity;
			UIGraphics.EndImageContext ();
			lastPoint = currentPoint;
		}
开发者ID:CrossGeeks,项目名称:Xamarin.Samples,代码行数:29,代码来源:NativeDrawView.cs

示例11: TouchesEnded

		public override void TouchesEnded (Foundation.NSSet touches, UIEvent evt)
		{

			if(!swiped) {

				UIGraphics.BeginImageContext(Frame.Size);
				tempDrawImage.Image.Draw (new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height));

				using (var context = UIGraphics.GetCurrentContext ())
				{


					context.SetLineCap (CGLineCap.Round);
					context.SetLineWidth (brush);
					context.SetStrokeColor(PaintColor.CGColor);
					context.MoveTo(lastPoint.X, lastPoint.Y);
					context.AddLineToPoint(lastPoint.X, lastPoint.Y);
					context.StrokePath ();
					context.Flush ();
					tempDrawImage.Image = UIGraphics.GetImageFromCurrentImageContext ();
					UIGraphics.EndImageContext();

				}
			}


			UIGraphics.BeginImageContext(mainImage.Frame.Size);
			mainImage.Image.Draw(new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height), CGBlendMode.Normal, 1.0f);
			tempDrawImage.Image.Draw (new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height), CGBlendMode.Normal, opacity);
			mainImage.Image = UIGraphics.GetImageFromCurrentImageContext ();
			//tempDrawImage.Image = CreateImageFromColor ();
			UIGraphics.EndImageContext();

		}
开发者ID:CrossGeeks,项目名称:Xamarin.Samples,代码行数:34,代码来源:NativeDrawView.cs

示例12: OnRelayEvent

 public override void OnRelayEvent(UIEvent aEvent, UIEventListener aListener)
 {
     if(aListener == null)
     {
         return;
     }
     switch(aEvent)
     {
         case UIEvent.MOUSE_CLICK:
         case UIEvent.MOUSE_DOUBLE_CLICK:
             if(aListener == m_Singleplayer)
             {
                 SinglePlayerClicked();
             }
             else if(aListener == m_Online)
             {
                 OnlineClicked();
             }
             else if(aListener == m_Options)
             {
                 OptionsClicked();
             }
             else if(aListener == m_Quit)
             {
                 QuitClicked();
             }
             else if(aListener == m_Back)
             {
                 BackClicked();
             }
             break;
     }
 }
开发者ID:NathanSaidas,项目名称:OnLooker_Unity,代码行数:33,代码来源:MenuEventListener.cs

示例13: OnEvent

 public void OnEvent(UIEvent aEvent)
 {
     switch(aEvent)
     {
         case UIEvent.MOUSE_CLICK:
             OnMouseClickEvent();
             break;
         case UIEvent.MOUSE_DOUBLE_CLICK:
             OnMouseDoubleClickedEvent();
             break;
         case UIEvent.MOUSE_DOWN:
             OnMouseDownEvent();
             break;
         case UIEvent.MOUSE_ENTER:
             OnMouseEnterEvent();
             break;
         case UIEvent.MOUSE_EXIT:
             OnMouseExitEvent();
             break;
         case UIEvent.MOUSE_HOVER:
             OnMouseHoverEvent();
             break;
         case UIEvent.ON_ACTION:
             OnActionEvent();
             break;
         case UIEvent.SELECTED:
             OnSelectedEvent();
             break;
         case UIEvent.UNSELECTED:
             OnUnselectedEvent();
             break;
     }
 }
开发者ID:NathanSaidas,项目名称:OnLooker_Unity,代码行数:33,代码来源:UIEventListener.cs

示例14: TouchesEnded

 public override void TouchesEnded( NSSet touches, UIEvent evt )
 {
     if( Interceptor != null )
     {
         Interceptor.TouchesEnded( touches, evt );
     }
 }
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:7,代码来源:NotesViewController.cs

示例15: TouchesBegan

 public override void TouchesBegan(NSSet touches, UIEvent evt)
 {
     foreach (UITouch touch in touches.ToArray<UITouch>())
     {
         Console.WriteLine(touch);
     }
 }
开发者ID:pedroccrl,项目名称:Xamarin.Plugins-1,代码行数:7,代码来源:GestureMonitor.cs


注:本文中的UIEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。