Ejemplo n.º 1
0
        public Connector Create(int id, ExternalChangeSet changeSet, Sheet sheet)
        {
            var connector = Create(id, sheet);

            //Todo: Shouldn't there onyl one change? Check this..
            foreach (ExternalChange change in changeSet.Where(c => c.OwnerId == id))
            {
                //Todo: Do we need change direction in this case? Direction should be part of the changeset in future.
                if (change.ChangeReason == ChangeReason.Update)
                {
                    var undoable = (ConnectorUndoable)change.Undoable;

                    foreach (var connection in undoable.Connections)
                    {
                        connector.Connections.Add(_connectionFactory.Create(connection, changeSet));
                    }

                    //foreach (var connectionId in undoable.ConnectionIds)
                    //{
                    //    connector.Connections.Add(_connectionFactory.Create(connectionId, changeSet, sheet));
                    //}
                }
            }


            return(connector);
        }
Ejemplo n.º 2
0
        public Task(int id, ExternalChangeSet changeSet, IUndoService undoService)
        {
            _undoService = undoService;
            _undoService.ActiveStateChanged += _undoService_ActiveStateChanged;

            Id = id;

            foreach (var change in changeSet.Where(c => c.ItemId == id))
            {
                IsDone      = ((UndoObject)change.Undoable).IsDone;
                Description = ((UndoObject)change.Undoable).Description;
            }
        }
Ejemplo n.º 3
0
        public Connector Create(ConnectorUndoable undoable, ExternalChangeSet changeSet)
        {
            if (_cache.ContainsKey(undoable.Id))
            {
                //throw new InvalidOperationException("Id already exists in cache. This state is not correct. Id: " +
                //                                    undoable.Id);
                var x = 10;
            }
            var connector = Create(undoable.Id, SheetFactory.Create(undoable.SheetId));

            connector.PositionX = undoable.Position.X;
            connector.PositionY = undoable.Position.Y;

            return(connector);
        }
Ejemplo n.º 4
0
        public Connection Create(int id, ExternalChangeSet changeSet, Sheet sheet)
        {
            var connection = Create(id, sheet);

            //Todo: Shouldn't there be only one change? Check this..
            foreach (ExternalChange change in changeSet.Where(c => c.OwnerId == id))
            {
                if (change.ChangeReason == ChangeReason.Update)
                {
                    var undoable = (ConnectionUndoable)change.Undoable;
                    //connection.Color = undoable.Color Todo
                    connection.FromPosition = undoable.FromPosition;
                    connection.ToPosition   = undoable.ToPosition;
                }
            }

            return(connection);
        }
Ejemplo n.º 5
0
        public BlockSymbol Create(BlockSymbolUndoable undoable, ExternalChangeSet changeSet)
        {
            if (_cache.ContainsKey(undoable.Id))
            {
                throw new InvalidOperationException("Id already exists in cache. This state is not correct. Id: " +
                                                    undoable.Id);
            }

            var blockSymbol = Create(undoable.Id, SheetFactory.Create(undoable.SheetId));

            blockSymbol.PositionX = undoable.Position.X;
            blockSymbol.PositionY = undoable.Position.Y;
            //Todo:blockSymbol.Size = undoable.Size;

            blockSymbol.Connectors.Clear();

            foreach (var connectorUndoable in undoable.Connectors)
            {
                blockSymbol.Connectors.Add(_connectorFactory.Create(connectorUndoable, changeSet));
            }

            return(blockSymbol);
        }
Ejemplo n.º 6
0
        public Connection Create(ConnectionUndoable undoable, ExternalChangeSet changeSet)
        {
            if (_cache.ContainsKey(undoable.Id))
            {
                throw new InvalidOperationException("Id already exists in cache. This state is not correct. Id: " +
                                                    undoable.Id); //todo: still correct?
            }
            if (ConnectorFactory == null)
            {
                throw new InvalidOperationException("IConnectorFactory not injected.");
            }

            var sheet      = SheetFactory.Create(undoable.SheetId);
            var connection = Create(undoable.Id, sheet);

            connection.FromPosition = undoable.FromPosition;
            connection.ToPosition   = undoable.ToPosition;

            connection.From = _connectorFactory.Create(undoable.FromId, sheet);
            connection.To   = _connectorFactory.Create(undoable.ToId, sheet);

            return(connection);
        }
Ejemplo n.º 7
0
        public Sheet Create(SheetUndoable undoable, ExternalChangeSet changeSet)
        {
            if (_cache.ContainsKey(undoable.Id))
            {
                throw new InvalidOperationException("Id already exists in cache. This state is not correct. Id: " +
                                                    undoable.Id);
            }

            var sheet = Create(undoable.Id);

            sheet.Name = undoable.Name;

            foreach (var connectionId in undoable.ConnectionIds)
            {
                sheet.Connections.Add(_connectionFactory.Create(connectionId, changeSet, sheet));
            }

            foreach (var blockId in undoable.BlockIds)
            {
                sheet.BlockSymbols.Add(_blockSymbolFactory.Create(blockId, changeSet, sheet));
            }

            return(sheet);
        }
Ejemplo n.º 8
0
 public BlockSymbol Create(int id, ExternalChangeSet changeSet, Sheet sheet)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 9
0
 public Sheet Create(int id, ExternalChangeSet changeSet)
 {
     throw new NotImplementedException();
 }