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


C# NSSet.Cast方法代码示例

本文整理汇总了C#中NSSet.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# NSSet.Cast方法的具体用法?C# NSSet.Cast怎么用?C# NSSet.Cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NSSet的用法示例。


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

示例1: TouchesEnded

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

			if (visualizeAzimuth) {
				foreach (var touch in touches.Cast<UITouch> ()) {
					ReticleView.Hidden |= touch.Type == UITouchType.Stylus;
				}
			}
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:11,代码来源:MainViewController.cs

示例2: TouchesBegan

		public override void TouchesBegan (NSSet touches, UIEvent evt)
		{
			CanvasView.DrawTouches (touches, evt);

			if (visualizeAzimuth) {
				foreach (var touch in touches.Cast<UITouch> ()) {
					if (touch.Type != UITouchType.Stylus)
						continue;

					ReticleView.Hidden = false;
					UpdateReticleView (touch);
				}
			}
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:14,代码来源:MainViewController.cs

示例3: TouchesEnded

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

			var firstTouch = touches.Cast<UITouch> ().FirstOrDefault ();
			if (firstTouch == null)
				return;

			var pointOfTouch = firstTouch.LocationInView (this);
			pointOfTouch.Y += bottomMargin;

			if (graphLayer.Contains (pointOfTouch))
				editPoint = ProcessTouch (pointOfTouch);

			touchDown = false;
			UpdateFrequenciesAndResonance ();
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:17,代码来源:FilterView.cs

示例4: TouchesMoved

		public override void TouchesMoved (NSSet touches, UIEvent evt)
		{
			CanvasView.DrawTouches (touches, evt);

			if (visualizeAzimuth) {
				foreach (var touch in touches.Cast<UITouch> ()) {
					if (touch.Type != UITouchType.Stylus)
						continue;

					UpdateReticleView (touch);

					UITouch[] predictedTouches = evt?.GetPredictedTouches (touch);
					UITouch predictedTouch = predictedTouches?.LastOrDefault ();

					if (predictedTouch != null)
						UpdateReticleView (predictedTouch, true);
				}
			}
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:19,代码来源:MainViewController.cs

示例5: Touches

		HashSet<UITouch> Touches (NSSet touches)
		{
			return new HashSet<UITouch> (touches.Cast<UITouch> ());
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:4,代码来源:StrokeGestureRecognizer.cs

示例6: TouchesEstimatedPropertiesUpdated

		public override void TouchesEstimatedPropertiesUpdated (NSSet touches)
		{
			foreach (var touch in touches.Cast<UITouch> ()) {
				StrokeIndex val;
				if (outstandingUpdateIndexes.TryGetValue (touch.EstimationUpdateIndex.Int32Value, out val)) {
					var stroke = val.Stroke;
					var sampleIndex = val.Index;
					var sample = stroke.Samples [sampleIndex];

					var expectedUpdates = sample.EstimatedPropertiesExpectingUpdates;
					// Only force is reported this way as of iOS 10.0
					if (expectedUpdates.HasFlag (UITouchProperties.Force)) {
						sample.Force = touch.Force;

						// Only remove the estimate flag if the new value isn't estimated as well.
						if (!touch.EstimatedProperties.HasFlag (UITouchProperties.Force))
							sample.EstimatedProperties &= ~UITouchProperties.Force;
					}
					sample.EstimatedPropertiesExpectingUpdates = touch.EstimatedPropertiesExpectingUpdates;

					if (touch.EstimatedPropertiesExpectingUpdates == 0)
						outstandingUpdateIndexes.Remove (sampleIndex);
					stroke.Update (sample, sampleIndex);
				}
			}
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:26,代码来源:StrokeGestureRecognizer.cs

示例7: TouchesCancelled

		public override void TouchesCancelled (NSSet touches, UIEvent evt)
		{
			if (touches == null)
				return;

			CanvasView.EndTouches (touches, true);
			if (visualizeAzimuth) {
				foreach (var touch in touches.Cast<UITouch> ())
					ReticleView.Hidden |= touch.Type == UITouchType.Stylus;
			}
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:11,代码来源:MainViewController.cs

示例8: UpdateEstimatedPropertiesForTouches

		public void UpdateEstimatedPropertiesForTouches (NSSet touches)
		{
			foreach (var touch in touches.Cast<UITouch> ()) {
				bool isPending = false;

				// Look to retrieve a line from `activeLines`. If no line exists, look it up in `pendingLines`.
				Line possibleLine;
				if (!activeLines.TryGetValue (touch, out possibleLine))
					isPending = pendingLines.TryGetValue (touch, out possibleLine);

				// If no line is related to the touch, return as there is no additional work to do.
				if (possibleLine == null)
					return;

				CGRect rect;
				if (possibleLine.UpdateWithTouch (touch, out rect))
					SetNeedsDisplayInRect (rect);

				// If this update updated the last point requiring an update, move the line to the `frozenImage`.
				if (isPending && possibleLine.IsComplete) {
					FinishLine (possibleLine);
					pendingLines.Remove (touch);
				} else {
					CommitLine (possibleLine);
				}
			}
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:27,代码来源:CanvasView.cs

示例9: EndTouches

		public void EndTouches (NSSet touches, bool cancel)
		{
			var updateRect = CGRectNull ();

			foreach (var touch in touches.Cast<UITouch> ()) {
				// Skip over touches that do not correspond to an active line.
				Line line;
				if (!activeLines.TryGetValue (touch, out line))
					continue;

				// If this is a touch cancellation, cancel the associated line.
				if (cancel)
					updateRect = updateRect.UnionWith (line.Cancel ());

				// If the line is complete (no points needing updates) or updating isn't enabled, move the line to the frozenImage.
				if (line.IsComplete)
					FinishLine (line);
				else
					pendingLines.Add (touch, line);

				// This touch is ending, remove the line corresponding to it from `activeLines`.
				activeLines.Remove (touch);
			}

			SetNeedsDisplayInRect (updateRect);
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:26,代码来源:CanvasView.cs

示例10: DrawTouches

		public void DrawTouches (NSSet touches, UIEvent evt)
		{
			var updateRect = CGRectNull ();

			foreach (var touch in touches.Cast<UITouch> ()) {
				Line line;

				// Retrieve a line from activeLines. If no line exists, create one.
				if (!activeLines.TryGetValue (touch, out line))
					line = AddActiveLineForTouch (touch);

				// Remove prior predicted points and update the updateRect based on the removals. The touches
				// used to create these points are predictions provided to offer additional data. They are stale
				// by the time of the next event for this touch.
				updateRect = updateRect.UnionWith (line.RemovePointsWithType (PointType.Predicted));

				// Incorporate coalesced touch data. The data in the last touch in the returned array will match
				// the data of the touch supplied to GetCoalescedTouches
				var coalescedTouches = evt.GetCoalescedTouches (touch) ?? new UITouch[0];
				var coalescedRect = AddPointsOfType (PointType.Coalesced, coalescedTouches, line);
				updateRect = updateRect.UnionWith (coalescedRect);

				// Incorporate predicted touch data. This sample draws predicted touches differently; however, 
				// you may want to use them as inputs to smoothing algorithms rather than directly drawing them. 
				// Points derived from predicted touches should be removed from the line at the next event for this touch.
				if (isPredictionEnabled) {
					var predictedTouches = evt.GetPredictedTouches (touch) ?? new UITouch[0];
					var predictedRect = AddPointsOfType (PointType.Predicted, predictedTouches, line);
					updateRect = updateRect.UnionWith (predictedRect);
				}
			}
			SetNeedsDisplayInRect (updateRect);
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:33,代码来源:CanvasView.cs

示例11: EndTouches

		public void EndTouches (NSSet touches, bool cancel)
		{
			var updateRect = CGRect.Empty;

			foreach (var touch in touches.Cast<UITouch> ()) {
				// Skip over touches that do not correspond to an active line.
				Line line;
				if (!activeLines.TryGetValue (touch, out line))
					continue;

				if (cancel)
					updateRect = updateRect.UnionWith (line.Cancel ());

				if (line.IsComplete) {
					FinishLine (line);
				} else {
					pendingLines.Add (touch, line);
				}
			}

			SetNeedsDisplayInRect (updateRect);
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:22,代码来源:CanvasView.cs

示例12: DrawTouches

		public void DrawTouches (NSSet touches, UIEvent evt)
		{
			var updateRect = CGRect.Empty;

			foreach (var touch in touches.Cast<UITouch> ()) {
				Line line;

				// Retrieve a line from `activeLines`. If no line exists, create one.
				if (!activeLines.TryGetValue (touch, out line))
					line = AddActiveLineForTouch (touch);
				updateRect = updateRect.UnionWith (line.RemovePointsWithType (PointType.Predicted));

				var coalescedTouches = evt.GetCoalescedTouches (touch) ?? new UITouch[0];
				var coalescedRect = AddPointsOfType (PointType.Coalesced, coalescedTouches, line, updateRect);
				updateRect = updateRect.UnionWith (coalescedRect);

				if (isPredictionEnabled) {
					var predictedTouches = evt.GetPredictedTouches (touch) ?? new UITouch[0];
					var predictedRect = AddPointsOfType (PointType.Predicted, predictedTouches, line, updateRect);
					updateRect = updateRect.UnionWith (predictedRect);
				}
			}
			SetNeedsDisplay ();
//			SetNeedsDisplayInRect (updateRect);
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:25,代码来源:CanvasView.cs


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