Exemplo n.º 1
0
 public void Undo(Pablo.Network.ReceiveCommandArgs args)
 {
     if (args.IsServer)
     {
         // server will send an undo to all clients
         var server = args.Network as Network.Server;
         args.Invoke(delegate {
             var item = PopUndo();
             if (item != null)
             {
                 server.SendCommand(item, null, null, args.User);
             }
         });
     }
     else
     {
         // client is receiving an undo item!
         var type = (UndoType)Enum.ToObject(typeof(UndoType), args.Message.PeekInt32());
         var item = CreateUndoItem(type);
         if (item != null)
         {
             item.Receive(args);
             args.Invoke(delegate {
                 item.Apply(this.Handler);
             });
         }
     }
 }
Exemplo n.º 2
0
        public override void Receive(Pablo.Network.ReceiveCommandArgs args)
        {
            base.Receive(args);
            var handler = this.Handler as CharacterHandler;
            var canvas  = handler.CurrentPage.Canvas;
            var x       = args.Message.ReadVariableInt32();

            args.Invoke(delegate {
                handler.Undo.Save(new UndoDeleteColumn(handler, x)
                {
                    CursorLocation = handler.CursorPosition
                });
                canvas.DeleteColumn(x);
                handler.InvalidateCharacterRegion(new Rectangle(x, 0, canvas.Width - x, canvas.Height), true);
            });
        }
Exemplo n.º 3
0
 public override void Receive(Pablo.Network.ReceiveCommandArgs args)
 {
     base.Receive(args);
     args.Invoke(delegate {
         if (args.IsServer)
         {
             // server will send an undo to all clients
             var server = args.Network as Network.Server;
             server.SendCommand(this, null, null, args.User);
         }
         else
         {
             Do();
         }
     });
 }
Exemplo n.º 4
0
 public override void Receive(Pablo.Network.ReceiveCommandArgs args)
 {
     base.Receive(args);
     args.Invoke(delegate {
         if (args.IsServer)
         {
             // server will send an undo to all clients
             var server     = args.Network as Network.Server;
             commandsToSend = RedoCommands().ToList();
             server.SendCommand(this, null, null, args.User);
         }
         else
         {
             Do(args.Message.ReadCommands(handler.RipDocument));
         }
     });
 }