Ejemplo n.º 1
0
        public BlockSymbolUndoable(BlockSymbol blockSymbol)
        {
            Id       = blockSymbol.Id;
            Position = new AplayPoint(blockSymbol.PositionX, blockSymbol.PositionY);

            SheetId = blockSymbol.Sheet.Id;

            Connectors = blockSymbol.Connectors.Select(ic => ic.CreateUndoable()).ToList();
        }
Ejemplo n.º 2
0
        public override void onAdd(BlockSymbol blockSymbol, Client client)
        {
            APlay.Common.Logging.Logger.LogDesigned(2, "OnAdd(blockSymbol) Pos: " + blockSymbol.PositionX + "/" + blockSymbol.PositionY, "AplayTest.Server.Sheet");

            var undoObject = new BlockSymbolUndoable(blockSymbol);

            _undoService.AddInsert(Id, undoObject, BlockSymbols.Count, "Adding new Block", client.Id);

            BlockSymbols.Add(blockSymbol);
        }
Ejemplo n.º 3
0
        public override void onRemove(BlockSymbol blockSymbol, Client client)
        {
            //this.SyncedWithBlockSymbol(blockSymbol);

            APlay.Common.Logging.Logger.LogDesigned(2, "Sheet.onRemove called", "AplayTest.Server.Sheet");

            var toBeDeleted = BlockSymbols.First(t => t.Id == blockSymbol.Id);
            var index       = BlockSymbols.IndexOf(toBeDeleted);

            _undoService.StartTransaction(client.Id, "Removing Block [" + toBeDeleted.Id + "]");

            var undoableBlockSymbol = blockSymbol.CreateUndoable();

            blockSymbol.PrepareForRemove(client.Id);

            _undoService.AddRemove(Id, undoableBlockSymbol, index, "Removing Block [" + toBeDeleted.Id + "]", client.Id);

            BlockSymbols.RemoveAt(index);

            var connections = blockSymbol.onGetAttachedConnections().ToList();

            var connectionsindexList = new List <int>();

            foreach (var connection in connections)
            {
                index = Connections.IndexOf(connection);
                if (index >= 0)
                {
                    connectionsindexList.Add(index);
                }
            }

            connectionsindexList.Sort();

            for (int i = connectionsindexList.Count - 1; i >= 0; i--)
            {
                var connection = connections[connectionsindexList[i]];

                connection.PrepareForRemove(client.Id);

                var undoableConnection = connection.CreateUndoble();


                _undoService.AddRemove(Id, undoableConnection, connectionsindexList[i], "Removing connection [" + undoableConnection.Id + "]", client.Id);
                Connections.Remove(connection);
            }


            _undoService.EndTransaction(client.Id);
        }
Ejemplo n.º 4
0
 public override void onRemove(APlayTest.Server.BlockSymbol blockSymbol__, APlayTest.Server.Client client__)
 {
     // Autogenerated log message for call
     APlay.Common.Logging.Logger.LogDesigned(2, "Sheet.onRemove called", "APlayTest.Server.Sheet");
     /// TODO: add your code here
 }