Using expression bodies in few properties

This commit is contained in:
Jaex 2016-08-09 01:24:17 +03:00
parent ecbd01a923
commit 2537316a33
2 changed files with 10 additions and 70 deletions

View file

@ -38,13 +38,7 @@ public abstract class BaseShape
public Rectangle Rectangle { get; set; }
protected AnnotationOptions AnnotationOptions
{
get
{
return Manager.Config.AnnotationOptions;
}
}
protected AnnotationOptions AnnotationOptions => Manager.Config.AnnotationOptions;
private Point startPosition;
@ -78,13 +72,7 @@ public Point EndPosition
}
}
public virtual bool IsValidShape
{
get
{
return !Rectangle.IsEmpty && Rectangle.Width >= MinimumSize && Rectangle.Height >= MinimumSize;
}
}
public virtual bool IsValidShape => !Rectangle.IsEmpty && Rectangle.Width >= MinimumSize && Rectangle.Height >= MinimumSize;
public virtual bool IsRegionShape { get; } = false;

View file

@ -104,55 +104,19 @@ public Rectangle CurrentRectangle
}
}
public bool IsCurrentShapeValid
{
get
{
return CurrentShape != null && CurrentShape.IsValidShape;
}
}
public bool IsCurrentShapeValid => CurrentShape != null && CurrentShape.IsValidShape;
public BaseShape[] Regions
{
get
{
return Shapes.OfType<BaseRegionShape>().ToArray();
}
}
public BaseShape[] Regions => Shapes.OfType<BaseRegionShape>().ToArray();
public BaseDrawingShape[] DrawingShapes
{
get
{
return Shapes.OfType<BaseDrawingShape>().ToArray();
}
}
public BaseShape[] ValidRegions => Regions.Where(x => x.IsValidShape).ToArray();
public BaseEffectShape[] EffectShapes
{
get
{
return Shapes.OfType<BaseEffectShape>().ToArray();
}
}
public BaseDrawingShape[] DrawingShapes => Shapes.OfType<BaseDrawingShape>().ToArray();
public BaseShape[] ValidRegions
{
get
{
return Regions.Where(x => x.IsValidShape).ToArray();
}
}
public BaseEffectShape[] EffectShapes => Shapes.OfType<BaseEffectShape>().ToArray();
public BaseShape CurrentHoverShape { get; private set; }
public bool IsCurrentHoverShapeValid
{
get
{
return CurrentHoverShape != null && CurrentHoverShape.IsValidShape;
}
}
public bool IsCurrentHoverShapeValid => CurrentHoverShape != null && CurrentHoverShape.IsValidShape;
public bool IsCurrentShapeTypeRegion
{
@ -185,13 +149,7 @@ public bool IsCurrentShapeTypeRegion
public RegionCaptureOptions Config { get; private set; }
public AnnotationOptions AnnotationOptions
{
get
{
return Config.AnnotationOptions;
}
}
public AnnotationOptions AnnotationOptions => Config.AnnotationOptions;
public NodeObject[] Nodes { get; private set; }
@ -227,13 +185,7 @@ public bool NodesVisible
}
}
public bool IsCursorOnNode
{
get
{
return NodesVisible && Nodes.Any(node => node.IsCursorHover);
}
}
public bool IsCursorOnNode => NodesVisible && Nodes.Any(node => node.IsCursorHover);
public event Action<BaseShape> CurrentShapeChanged;
public event Action<ShapeType> CurrentShapeTypeChanged;