private void CreateSectorShape(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); SectorShape shape = new SectorShape(new RectangleF2D(new PointF(0, 30), new SizeF(80, 10)), 40, 270); shape.Appearance.ContentBrush = new SolidBrushObject(Color.Red); shape.Name = "sectorShape"; needleShape.Add(shape); }
private void CreateBoxNeedle(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); BoxShape shape = new BoxShape(new RectangleF2D(new PointF(-10, 0), new SizeF(100, 10))); shape.Appearance.ContentBrush = new SolidBrushObject(Color.Gray); shape.Name = "boxNeedle"; needleShape.Add(shape); }
private void CreateArcNeedle(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); ArcShape shape = new ArcShape(new RectangleF2D(new PointF(-10, 0), new SizeF(20, 10)), 180, -60); shape.Appearance.ContentBrush = new SolidBrushObject(Color.White); shape.Name = "arcNeedle"; needleShape.Add(shape); }
/// <summary>Resets to prepare for the next operation.</summary> public void Reset() { // Reset/update state for the next use/await of this instance. Version++; _result = null; _capturedContext = null; _continuation = null; _continuationState = null; #if TARGETS_NET || TARGETS_NETCORE || GREATERTHAN_NETSTANDARD13 _executionContext = null; #endif }
public Needle(T target) { if (target == null) { _target = null; _hashCode = base.GetHashCode(); } else { _target = new StructNeedle <T>(target); _hashCode = target.GetHashCode(); } }
public Needle(T target) { if (ReferenceEquals(target, null)) { _target = null; _hashCode = base.GetHashCode(); } else { _target = new StructNeedle <T>(target); _hashCode = target.GetHashCode(); } }
private void CreateTextShape(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); TextShape shape = new TextShape(); shape.Box = new RectangleF2D(new PointF(-10, 0), new SizeF(100, 10)); shape.Text = " > > > > > "; shape.AppearanceText.TextBrush = new SolidBrushObject(Color.Salmon); needleShape.Add(shape); }
private void CreateEllipseNeedle(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); EllipseShape shape = new EllipseShape(new RectangleF2D(new PointF(-10, 0), new SizeF(100, 10))); LinearGradientBrushObject brush = new LinearGradientBrushObject(new PointF2D(2, 0), new PointF2D(0, 2)); brush.StartColor = Color.Yellow; brush.EndColor = Color.Magenta; shape.Appearance.ContentBrush = brush; shape.Name = "ellipseNeedle"; needleShape.Add(shape); }
public Needle(T target) { if (target == null) { _target = null; _hashCode = base.GetHashCode(); } else { _target = new StructNeedle <T>(target); _hashCode = target.GetHashCode(); } _onCompleted = new StrongDelegateCollection(true); }
protected void SetTargetValue(T value) { if (_target is StructNeedle <T> ) { // This may throw NotSupportedException if SetTargetError has just executed try { _target.Value = value; return; } catch (NotSupportedException) { // preventing return } } _target = new StructNeedle <T>(value); }
private void CreatePolylineNeedle(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); PolylineShape shape = new PolylineShape(); shape.Points = new PointF[] { new PointF(0, 20), new PointF(-40, 25), new PointF(20, 5), new PointF(100, 0), new PointF(20, -5), new PointF(-40, -25), new PointF(0, -20) }; shape.Appearance.ContentBrush = new SolidBrushObject(Color.Yellow); shape.Name = "polylineNeedle"; needleShape.Add(shape); }
private void CreatePolygonNeedle(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); PolygonShape shape = new PolygonShape(); shape.Points = new PointF[] { new PointF(0, 10), new PointF(75, 10), new PointF(70, -5), new PointF(100, 0), new PointF(65, -10), new PointF(70, 5), new PointF(0, -10) }; shape.Appearance.ContentBrush = new SolidBrushObject(Color.AliceBlue); shape.Name = "polygonNeedle"; needleShape.Add(shape); }
private void CreatePathNeedle(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); PathShape shape = new PathShape(); shape.Points = new ShapePoint[] { new ShapePoint(new PointF(0, 20), PathPointType.Start), new ShapePoint(new PointF(50, 0), PathPointType.Line), new ShapePoint(new PointF(0, -20), PathPointType.Line), new ShapePoint(new PointF(100, 0), PathPointType.Line), new ShapePoint(new PointF(0, 20), PathPointType.CloseSubpath | PathPointType.Line) }; SolidBrushObject brush = new SolidBrushObject(Color.Red); shape.Appearance.ContentBrush = brush; shape.Name = "pathNeedle"; needleShape.Add(shape); }
private void CreateComplexNeedle(INeedle needle) { ComplexShape needleShape = (ComplexShape)needle.Shape; needleShape.Collection.Clear(); PolylineShape basic = new PolylineShape(new PointF[] { new PointF(25, 20), new PointF(100, 0), new PointF(25, -20), new PointF(95, 0), new PointF(25, 20) }); basic.Appearance.ContentBrush = new SolidBrushObject(Color.Azure); basic.Name = "basic"; PolylineShape cap = new PolylineShape(new PointF[] { new PointF(100, 0), new PointF(105, 5), new PointF(110, 0), new PointF(105, -5) }); cap.Appearance.ContentBrush = new SolidBrushObject(Color.BurlyWood); cap.Name = "cap"; needleShape.AddRange(new BaseShape[] { basic, cap }); }
/// <summary>Completes with an error.</summary> /// <param name="error">The exception.</param> public void SetException(Exception error) { _result = new ExceptionStructNeedle <TResult>(error); SignalCompletion(); }
protected void SetTargetError(Exception error) { _target = new ExceptionStructNeedle <T>(error); }
/// <summary>Completes with a successful result.</summary> /// <param name="result">The result.</param> public void SetResult(TResult result) { _result = new StructNeedle <TResult>(result); SignalCompletion(); }
public ReadOnlyNeedle(T target) { _target = new StructNeedle <T>(target); }
public ReadOnlyNeedle(INeedle <T> target) { _target = target; }
public ReadOnlyNeedle() { _target = null; }
public virtual void Free() { _target = null; }
protected void SetTargetError(Exception error) { _target = new ExceptionStructNeedle <T>(error); Thread.MemoryBarrier(); }
private INeedle <T> _target; // Can be null - set in SetTargetValue and SetTargetError public Needle() { _target = null; _hashCode = base.GetHashCode(); }
public static TNeedle Create(INeedle <T> target) { return(_create.Invoke(target)); }
public static TNeedle CreateNestedNeedle <T, TNeedle>(INeedle <T> target) where TNeedle : INeedle <T> { return(NestedNeedleCreator <T, TNeedle> .Create(target)); }
private INeedle <T> _target; // Can be null - set in SetTargetValue and SetTargetError public Needle() { _target = null; _hashCode = base.GetHashCode(); _onCompleted = new StrongDelegateCollection(true); }