コード例 #1
0
 public override void Save(SaveVisitor visitor)
 {
     visitor.Visit(this);
     visitor.Spaces += "   ";
     foreach (ShapeComponent shape in Shapes)
     {
         shape.Save(visitor);
     }
     visitor.Spaces = visitor.Spaces.Substring(0, visitor.Spaces.Length - 3);
 }
コード例 #2
0
        public override void Execute(InternalCanvas canvas)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter = "Text file (*.txt)|*.txt|C# file (*.cs)|*.cs";
            if (saveFileDialog.ShowDialog() == true)
            {
                SaveVisitor save = new SaveVisitor();
                foreach (ShapeComponent shape in canvas.Shapes)
                {
                    shape.Save(save);
                }
                File.WriteAllText(saveFileDialog.FileName, save.stringBuilder.ToString());
            }
            IsCompleted = true;
        }
コード例 #3
0
 //public abstract void Add(ShapeComponent component);
 //public abstract void Remove(ShapeComponent component);
 //public abstract bool Contains(ShapeComponent component);
 public abstract void Save(SaveVisitor visitor);
コード例 #4
0
 public override void Save(SaveVisitor visitor)
 {
     visitor.Visit(this);
     ShapeComponent.Save(visitor);
 }
コード例 #5
0
        //public Point Location { get; set; }

        //public MousePositionType GetMousePositionType(Point point)
        //{
        //    double left = Location.X;
        //    double top = Location.Y;
        //    double right = left + ActualWidth;
        //    double bottom = top + ActualHeight;
        //    if (point.X < left || point.X > right || point.Y < top || point.Y > bottom ) return MousePositionType.None;

        //    const double GAP = 10;
        //    if (point.X - left < GAP)
        //    {
        //        // Left edge.
        //        if (point.Y - top < GAP) return MousePositionType.UL;
        //        if (bottom - point.Y < GAP) return MousePositionType.DL;
        //        return MousePositionType.L;
        //    }
        //    else if (right - point.X < GAP)
        //    {
        //        // Right edge.
        //        if (point.Y - top < GAP) return MousePositionType.UR;
        //        if (bottom - point.Y < GAP) return MousePositionType.DR;
        //        return MousePositionType.R;
        //    }
        //    if (point.Y - top < GAP) return MousePositionType.T;
        //    if (bottom - point.Y < GAP) return MousePositionType.B;
        //    return MousePositionType.Body;
        //}

        public override void Save(SaveVisitor visitor)
        {
            visitor.Visit(this);
        }