Ejemplo n.º 1
0
        private void UndoServiceOnActiveStateChanged(object sender, ActiveStateChangedEventArgs e)
        {
            foreach (var change in e.ChangeSet.Where(c => c.OwnerId == Id))
            {
                var storedObject = (BlockSymbolUndoable)change.Undoable;

                switch (change.ChangeReason)
                {
                case ChangeReason.InsertAt:
                    break;

                case ChangeReason.Update:
                    PositionX = storedObject.Position.X;
                    PositionY = storedObject.Position.Y;

                    APlay.Common.Logging.Logger.LogDesigned(2,
                                                            "BlockSymbol: ActiveStateChanged received and updated state. OwnerId: " + change.OwnerId,
                                                            "Undo.Server.Task");
                    break;

                case ChangeReason.RemoveAt:
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Ejemplo n.º 2
0
 private void _undoService_ActiveStateChanged(object sender, ActiveStateChangedEventArgs e)
 {
     if (e.ClientId != _clientId)
     {
         return;
     }
     UpdateStates(); //Todo Check this.
 }
Ejemplo n.º 3
0
        private void UndoServiceOnActiveStateChanged(object sender, ActiveStateChangedEventArgs e)
        {
            foreach (var change in e.ChangeSet.Where(c => c.OwnerId == Id))
            {
                APlay.Common.Logging.Logger.LogDesigned(2,
                                                        "ActiveStateChanged received and updated state. OwnerId: " + change.OwnerId,
                                                        "AplayTest.Server.Sheet");


                if (change.ChangeReason == ChangeReason.InsertAt)
                {
                    if (change.Undoable is BlockSymbolUndoable)
                    {
                        BlockSymbols.Insert(change.IndexAt,
                                            _blockSymbolFactory.Create((BlockSymbolUndoable)change.Undoable, e.ChangeSet));
                    }
                    else if (change.Undoable is ConnectionUndoable)
                    {
                        Connections.Insert(change.IndexAt,
                                           _connectionFactory.Create((ConnectionUndoable)change.Undoable, e.ChangeSet));
                    }
                }
                else if (change.ChangeReason == ChangeReason.RemoveAt)
                {
                    if (change.Undoable is BlockSymbolUndoable)
                    {
                        BlockSymbols.RemoveAt(change.IndexAt);
                        _blockSymbolFactory.Remove(change.Undoable.Id);
                    }
                    else if (change.Undoable is ConnectionUndoable)
                    {
                        Connections.RemoveAt(change.IndexAt);
                        _connectionFactory.Remove(change.Undoable.Id);
                    }
                }

                var storedObject = change.Undoable as SheetUndoable;

                if (storedObject != null)
                {
                    if (change.ChangeReason == ChangeReason.Update)
                    {
                        Name = storedObject.Name;
                    }
                }

                Dump();
            }
        }
Ejemplo n.º 4
0
 private void UndoServiceOnActiveStateChanged(object sender, ActiveStateChangedEventArgs e)
 {
     foreach (var change in e.ChangeSet.Where(c => c.OwnerId == Id))
     {
         if (change.ChangeReason == ChangeReason.Update)
         {
             Connections.Clear();
             var undoObject = (ConnectorUndoable)change.Undoable;
             foreach (var connectionUndoable in undoObject.Connections)
             {
                 Connections.Add(_connectionFactory.Create(connectionUndoable, e.ChangeSet));
             }
         }
     }
 }
Ejemplo n.º 5
0
        void _undoService_ActiveStateChanged(object sender, ActiveStateChangedEventArgs e)
        {
            foreach (var change in e.ChangeSet.Where(c => c.OwnerId == Id))
            {
                var storedObject = (UndoObject)change.Undoable;

                if (change.ChangeReason == ChangeReason.Update)
                {
                    IsDone      = storedObject.IsDone;
                    Description = storedObject.Description;

                    APlay.Common.Logging.Logger.LogDesigned(2,
                                                            "ActiveStateChanged received and updated state. OwnerId: " + change.OwnerId,
                                                            "Undo.Server.Task");
                }
            }
        }
Ejemplo n.º 6
0
        void _undoService_ActiveStateChanged(object sender, ActiveStateChangedEventArgs e)
        {
            foreach (var change in e.ChangeSet.Where(cs => cs.OwnerId == Id))
            {
                APlay.Common.Logging.Logger.LogDesigned(2,
                                                        "ActiveStateChanged received and updated state. OwnerId: " + change.OwnerId,
                                                        "Undo.Server.TaskManager");


                if (change.ChangeReason == ChangeReason.InsertAt)
                {
                    Tasks.RemoveAt(change.IndexAt);
                }
                else if (change.ChangeReason == ChangeReason.RemoveAt)
                {
                    Tasks.Insert(change.IndexAt,
                                 new Task(change.Undoable.Id, e.ChangeSet, _undoService));
                }
            }
        }
Ejemplo n.º 7
0
        private void UndoServiceOnActiveStateChanged(object sender, ActiveStateChangedEventArgs e)
        {
            foreach (var change in e.ChangeSet.Where(c => c.OwnerId == Id))
            {
                switch (change.ChangeReason)
                {
                case ChangeReason.InsertAt:
                    break;

                case ChangeReason.Update:
                    var undoable = (ConnectionUndoable)change.Undoable;
                    FromPosition = undoable.FromPosition;
                    ToPosition   = undoable.ToPosition;

                    break;

                case ChangeReason.RemoveAt:
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }