示例#1
0
 /// <summary>
 /// Returns a condition (function) that is true iff the shape's purpose is the purpose specified in the argument.
 /// </summary>
 public static Func <Shape, bool> WithPurpose(ShapePurpose purpose)
 {
     return(shape =>
     {
         var agendaShape = Decode(shape);
         if (agendaShape == null)
         {
             return false;
         }
         return agendaShape.ShapePurpose == purpose;
     });
 }
示例#2
0
 public static List <Shape> GetAllShapesWithPurpose(Shape beamShape, ShapePurpose purpose)
 {
     return(beamShape.GroupItems.Cast <Shape>().Where(AgendaShape.WithPurpose(purpose)).ToList());
 }
示例#3
0
 public static Shape GetShapeWithPurpose(Shape beamShape, ShapePurpose purpose)
 {
     return(beamShape.GroupItems.Cast <Shape>().FirstOrDefault(AgendaShape.WithPurpose(purpose)));
 }
 /// <summary>
 /// Universal Encode function used for all Agenda Shapes.
 /// Packs a set of agenda shape properties to a shape name. Paired with the Decode function.
 /// </summary>
 public static string Encode(ShapePurpose shapePurpose, AgendaSection section)
 {
     string[] parameters = { Prefix, shapePurpose.ToString(), section.Encode() };
     return(string.Join(Delim[0], parameters));
 }
 private AgendaShape(ShapePurpose shapePurpose, AgendaSection section)
 {
     ShapePurpose = shapePurpose;
     Section      = section;
 }
 /// <summary>
 /// Stores metadata in the shape by setting its name.
 /// </summary>
 public static void SetShapeName(Shape shape, ShapePurpose shapePurpose, AgendaSection section)
 {
     shape.Name = Encode(shapePurpose, section);
 }
示例#7
0
 /// <summary>
 /// Returns a condition (function) that is true iff the shape's purpose is the purpose specified in the argument.
 /// </summary>
 public static Func<Shape, bool> WithPurpose(ShapePurpose purpose)
 {
     return shape =>
     {
         var agendaShape = Decode(shape);
         if (agendaShape == null) return false;
         return agendaShape.ShapePurpose == purpose;
     };
 }
示例#8
0
 /// <summary>
 /// Universal Encode function used for all Agenda Shapes.
 /// Packs a set of agenda shape properties to a shape name. Paired with the Decode function.
 /// </summary>
 public static string Encode(ShapePurpose shapePurpose, AgendaSection section)
 {
     string[] parameters = { Prefix, shapePurpose.ToString(), section.Encode() };
     return string.Join(Delim[0], parameters);
 }
示例#9
0
 private AgendaShape(ShapePurpose shapePurpose, AgendaSection section)
 {
     ShapePurpose = shapePurpose;
     Section = section;
 }
示例#10
0
 /// <summary>
 /// Stores metadata in the shape by setting its name.
 /// </summary>
 public static void SetShapeName(Shape shape, ShapePurpose shapePurpose, AgendaSection section)
 {
     shape.Name = Encode(shapePurpose, section);
 }
示例#11
0
 public static List<Shape> GetAllShapesWithPurpose(Shape beamShape, ShapePurpose purpose)
 {
     return beamShape.GroupItems.Cast<Shape>().Where(AgendaShape.WithPurpose(purpose)).ToList();
 }
示例#12
0
 public static Shape GetShapeWithPurpose(Shape beamShape, ShapePurpose purpose)
 {
     return beamShape.GroupItems.Cast<Shape>().FirstOrDefault(AgendaShape.WithPurpose(purpose));
 }