Exemplo n.º 1
0
        protected Bus GetVerifyBus(CommandReference busReference)
        {
            Bus bus = System.GetBus(busReference.Index);

            LazyVerify(bus.InstanceId, busReference.InstanceId);
            return(bus);
        }
Exemplo n.º 2
0
        protected Signal GetVerifySignal(CommandReference signalReference)
        {
            Signal signal = System.GetSignal(signalReference.Index);

            LazyVerify(signal.InstanceId, signalReference.InstanceId);
            return(signal);
        }
        public void ForwardCanExecuteChangedEvent()
        {
            bool             canExecuteChangedCalled = false;
            TestCommand      testCommand             = new TestCommand();
            CommandReference commandReference        = new CommandReference {
                Command = testCommand
            };

            commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true);

            object canExecuteParameter = new object();
            bool   canExecute          = commandReference.CanExecute(canExecuteParameter);

            Assert.IsTrue(canExecute);
            Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter);

            testCommand.CanExecuteValue = false;
            testCommand.FireCanExecuteChanged();

            Assert.IsTrue(canExecuteChangedCalled);

            canExecuteParameter = new object();
            canExecute          = commandReference.CanExecute(canExecuteParameter);
            Assert.IsFalse(canExecute);
            Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter);

            commandReference.Command = null;
        }
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("PortSignalCommand", Context.YttriumNamespace);
     _portRef   = CommandReference.Deserialize("Port", reader);
     _signalRef = CommandReference.Deserialize("Signal", reader);
     reader.ReadEndElement();
 }
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("PortSignalCommand", Context.YttriumNamespace);
     _portRef = CommandReference.Deserialize("Port", reader);
     _signalRef = CommandReference.Deserialize("Signal", reader);
     reader.ReadEndElement();
 }
Exemplo n.º 6
0
 public void Execute()
 {
     if(!BeginExecute())
         return;
     _ref = Action();
     EndExecute();
 }
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("PortIndexCommand", Context.YttriumNamespace);
     _index   = int.Parse(reader.ReadElementString("Index"));
     _portRef = CommandReference.Deserialize("Port", reader);
     reader.ReadEndElement();
 }
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("PortIndexCommand", Context.YttriumNamespace);
     _index = int.Parse(reader.ReadElementString("Index"));
     _portRef = CommandReference.Deserialize("Port", reader);
     reader.ReadEndElement();
 }
Exemplo n.º 9
0
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("PortBusCommand", Config.YttriumNamespace);
     _portRef = CommandReference.Deserialize("Port", reader);
     _busRef  = CommandReference.Deserialize("Bus", reader);
     reader.ReadEndElement();
 }
Exemplo n.º 10
0
        public virtual void PostCommandRemoveBus(CommandReference reference)
        {
            RemoveBusCommand cmd = new RemoveBusCommand();

            cmd.BusReference = reference;
            PostCommand(cmd);
        }
Exemplo n.º 11
0
        protected Port GetVerifyPort(CommandReference portReference)
        {
            Port port = System.GetPort(portReference.Index);

            LazyVerify(port.InstanceId, portReference.InstanceId);
            return(port);
        }
Exemplo n.º 12
0
        public void CanExecuteShouldReturnFalseWhenEmpty()
        {
            CommandReference commandReference = new CommandReference();

            bool canExecute = commandReference.CanExecute(null);
            Assert.IsFalse(canExecute);
        }
Exemplo n.º 13
0
        public virtual void PostCommandRemovePort(CommandReference reference, bool isolate)
        {
            RemovePortCommand cmd = new RemovePortCommand();

            cmd.PortReference = reference;
            cmd.Isolate       = isolate;
            PostCommand(cmd);
        }
Exemplo n.º 14
0
        public void CanExecuteShouldReturnFalseWhenEmpty()
        {
            CommandReference commandReference = new CommandReference();

            bool canExecute = commandReference.CanExecute(null);

            Assert.IsFalse(canExecute);
        }
Exemplo n.º 15
0
        public virtual void PostCommandPortDrivesSignalNoLonger(CommandReference port, int index)
        {
            PortUndriveSignalCommand cmd = new PortUndriveSignalCommand();

            cmd.PortReference = port;
            cmd.Index         = index;
            PostCommand(cmd);
        }
Exemplo n.º 16
0
        public virtual void PostCommandSignalDrivesPortNoLonger(CommandReference port, int index)
        {
            SignalUndrivePortCommand cmd = new SignalUndrivePortCommand();

            cmd.PortReference = port;
            cmd.Index         = index;
            PostCommand(cmd);
        }
Exemplo n.º 17
0
        public virtual void PostCommandBusDetachedFromPort(CommandReference port, int index)
        {
            BusUndrivePortCommand cmd = new BusUndrivePortCommand();

            cmd.PortReference = port;
            cmd.Index         = index;
            PostCommand(cmd);
        }
Exemplo n.º 18
0
        public virtual void PostCommandRemoveSignal(CommandReference reference, bool isolate)
        {
            RemoveSignalCommand cmd = new RemoveSignalCommand();

            cmd.SignalReference = reference;
            cmd.Isolate         = isolate;
            PostCommand(cmd);
        }
Exemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:SimpleRectangle"/> class.
 /// </summary>
 public PortShape(CommandReference reference)
     : base()
 {
     this.sysRef = reference;
     cIn         = new List <Connector>();
     cOut        = new List <Connector>();
     cBus        = new List <Connector>();
     Initialize();
 }
Exemplo n.º 20
0
        public virtual void PostCommandSignalDrivesPort(CommandReference signal, CommandReference port, int index)
        {
            SignalDrivePortCommand cmd = new SignalDrivePortCommand();

            cmd.SignalReference = signal;
            cmd.PortReference   = port;
            cmd.Index           = index;
            PostCommand(cmd);
        }
Exemplo n.º 21
0
        public virtual void PostCommandPortDrivesSignal(CommandReference signal, CommandReference port, int index)
        {
            PortDriveSignalCommand cmd = new PortDriveSignalCommand();

            cmd.SignalReference = signal;
            cmd.PortReference   = port;
            cmd.Index           = index;
            PostCommand(cmd);
        }
Exemplo n.º 22
0
 public void Execute()
 {
     if (!BeginExecute())
     {
         return;
     }
     _ref = Action();
     EndExecute();
 }
Exemplo n.º 23
0
        public virtual void PostCommandBusAttachedToPort(CommandReference bus, CommandReference port, int index)
        {
            BusDrivePortCommand cmd = new BusDrivePortCommand();

            cmd.BusReference  = bus;
            cmd.PortReference = port;
            cmd.Index         = index;
            PostCommand(cmd);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:SimpleRectangle"/> class.
        /// </summary>
        public PortShape(IModel model, CommandReference reference, IFlyweightShape <PortShape> fly)
            : base(model)
        {
            this.sysRef = reference;

            cIn  = new List <YttriumConnector>();
            cOut = new List <YttriumConnector>();
            cBus = new List <YttriumConnector>();

            AssignFly(fly);
        }
Exemplo n.º 25
0
        public BusShape(IModel model, CommandReference reference, IFlyweightShape<BusShape> fly)
            : base(model)
        {
            this.sysRef = reference;

            busConnector = new YttriumConnector(Model, ConnectorType.BusConnector); //new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom),
            busConnector.Name = "Bus";
            busConnector.Parent = this;
            Connectors.Add(busConnector);

            AssignFly(fly);
        }
Exemplo n.º 26
0
        public BusShape(IModel model, CommandReference reference, IFlyweightShape <BusShape> fly)
            : base(model)
        {
            this.sysRef = reference;

            busConnector        = new YttriumConnector(Model, ConnectorType.BusConnector); //new Point((int)(Rectangle.Left + Rectangle.Width / 2), Rectangle.Bottom),
            busConnector.Name   = "Bus";
            busConnector.Parent = this;
            Connectors.Add(busConnector);

            AssignFly(fly);
        }
Exemplo n.º 27
0
    private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    {
        CommandReference commandReference = d as CommandReference;
        ICommand         oldCommand       = e.OldValue as ICommand;
        ICommand         newCommand       = e.NewValue as ICommand;

        if (oldCommand != null)
        {
            oldCommand.CanExecuteChanged -= commandReference.CanExecuteChanged;
        }
        if (newCommand != null)
        {
            newCommand.CanExecuteChanged += commandReference.CanExecuteChanged;
        }
    }
Exemplo n.º 28
0
        public SignalShape(IModel model, CommandReference reference, IFlyweightShape <SignalShape> fly)
            : base(model)
        {
            this.sysRef = reference;

            outConnector        = new YttriumConnector(Model, ConnectorType.SignalOutputConnector);
            outConnector.Name   = "Output";
            outConnector.Parent = this;
            Connectors.Add(outConnector);

            inConnector        = new YttriumConnector(Model, ConnectorType.SignalInputConnector);
            inConnector.Name   = "Input";
            inConnector.Parent = this;
            Connectors.Add(inConnector);

            AssignFly(fly);
        }
Exemplo n.º 29
0
        public SignalShape(IModel model, CommandReference reference, IFlyweightShape<SignalShape> fly)
            : base(model)
        {
            this.sysRef = reference;

            outConnector = new YttriumConnector(Model, ConnectorType.SignalOutputConnector);
            outConnector.Name = "Output";
            outConnector.Parent = this;
            Connectors.Add(outConnector);

            inConnector = new YttriumConnector(Model, ConnectorType.SignalInputConnector);
            inConnector.Name = "Input";
            inConnector.Parent = this;
            Connectors.Add(inConnector);

            AssignFly(fly);
        }
Exemplo n.º 30
0
        public void ShouldExecuteReferencedCommand()
        {
            bool canExecuteChangedCalled = false;
            TestCommand testCommand = new TestCommand();
            CommandReference commandReference = new CommandReference { Command = testCommand };
            commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true);

            object canExecuteParameter = new object();
            bool canExecute = commandReference.CanExecute(canExecuteParameter);
            Assert.IsTrue(canExecute);
            Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter);

            object executeParameter = new object();
            commandReference.Execute(executeParameter);
            Assert.AreSame(executeParameter, testCommand.ExecuteParameter);

            Assert.IsFalse(canExecuteChangedCalled);
        }
Exemplo n.º 31
0
        public void ShouldExecuteReferencedCommand()
        {
            bool             canExecuteChangedCalled = false;
            TestCommand      testCommand             = new TestCommand();
            CommandReference commandReference        = new CommandReference {
                Command = testCommand
            };

            commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true);

            object canExecuteParameter = new object();
            bool   canExecute          = commandReference.CanExecute(canExecuteParameter);

            Assert.IsTrue(canExecute);
            Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter);

            object executeParameter = new object();

            commandReference.Execute(executeParameter);
            Assert.AreSame(executeParameter, testCommand.ExecuteParameter);

            Assert.IsFalse(canExecuteChangedCalled);
        }
Exemplo n.º 32
0
        public void ForwardCanExecuteChangedEvent()
        {
            bool canExecuteChangedCalled = false;
            TestCommand testCommand = new TestCommand();
            CommandReference commandReference = new CommandReference { Command = testCommand };
            commandReference.CanExecuteChanged += ((sender, eventArgs) => canExecuteChangedCalled = true);

            object canExecuteParameter = new object();
            bool canExecute = commandReference.CanExecute(canExecuteParameter);
            Assert.IsTrue(canExecute);
            Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter);

            testCommand.CanExecuteValue = false;
            testCommand.FireCanExecuteChanged();

            Assert.IsTrue(canExecuteChangedCalled);

            canExecuteParameter = new object();
            canExecute = commandReference.CanExecute(canExecuteParameter);
            Assert.IsFalse(canExecute);
            Assert.AreSame(canExecuteParameter, testCommand.CanExecuteParameter);

            commandReference.Command = null;
        }
 protected PortBusIndexCommand(SerializationInfo info, StreamingContext context)
 {
     _index   = info.GetInt32("idx");
     _portRef = CommandReference.Deserialize("port", info);
     _busRef  = CommandReference.Deserialize("bus", info);
 }
 protected PortSignalCommand(SerializationInfo info, StreamingContext context)
 {
     _portRef = CommandReference.Deserialize("port", info);
     _signalRef = CommandReference.Deserialize("signal", info);
 }
 public CommandReferenceTypeDescriptor(ICustomTypeDescriptor parent, CommandReference commandReference)
     : base(parent)
 {
     this.parent = parent;
 }
Exemplo n.º 36
0
 public virtual void PostCommandSignalDrivesPort(CommandReference signal, CommandReference port, int index)
 {
     SignalDrivePortCommand cmd = new SignalDrivePortCommand();
     cmd.SignalReference = signal;
     cmd.PortReference = port;
     cmd.Index = index;
     PostCommand(cmd);
 }
 public CommandReferenceTypeDescriptor(ICustomTypeDescriptor parent, CommandReference commandReference)
     : base(parent)
 {
     this.parent = parent;
 }
Exemplo n.º 38
0
 protected AbstractPortCommand(SerializationInfo info, StreamingContext context)
 {
     _portRef = CommandReference.Deserialize("port", info);
 }
Exemplo n.º 39
0
 protected PortBusCommand(SerializationInfo info, StreamingContext context)
 {
     _portRef = CommandReference.Deserialize("port", info);
     _busRef  = CommandReference.Deserialize("bus", info);
 }
Exemplo n.º 40
0
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("NewCommand", Config.YttriumNamespace);
     _ref = CommandReference.Deserialize("New", reader);
     reader.ReadEndElement();
 }
Exemplo n.º 41
0
 public virtual void PostCommandPortDrivesSignalNoLonger(CommandReference port, int index)
 {
     PortUndriveSignalCommand cmd = new PortUndriveSignalCommand();
     cmd.PortReference = port;
     cmd.Index = index;
     PostCommand(cmd);
 }
Exemplo n.º 42
0
 protected NewCommand(SerializationInfo info, StreamingContext context)
 {
     _ref = CommandReference.Deserialize("new", info);
 }
Exemplo n.º 43
0
 public virtual void PostCommandRemoveBus(CommandReference reference)
 {
     RemoveBusCommand cmd = new RemoveBusCommand();
     cmd.BusReference = reference;
     PostCommand(cmd);
 }
Exemplo n.º 44
0
 public virtual void PostCommandRemovePort(CommandReference reference, bool isolate)
 {
     RemovePortCommand cmd = new RemovePortCommand();
     cmd.PortReference = reference;
     cmd.Isolate = isolate;
     PostCommand(cmd);
 }
Exemplo n.º 45
0
 public virtual void PostCommandRemoveSignal(CommandReference reference, bool isolate)
 {
     RemoveSignalCommand cmd = new RemoveSignalCommand();
     cmd.SignalReference = reference;
     cmd.Isolate = isolate;
     PostCommand(cmd);
 }
Exemplo n.º 46
0
 public virtual void PostCommandPortDrivesSignal(CommandReference signal, CommandReference port, int index)
 {
     PortDriveSignalCommand cmd = new PortDriveSignalCommand();
     cmd.SignalReference = signal;
     cmd.PortReference = port;
     cmd.Index = index;
     PostCommand(cmd);
 }
Exemplo n.º 47
0
 public virtual void PostCommandBusDetachedFromPort(CommandReference port, int index)
 {
     BusUndrivePortCommand cmd = new BusUndrivePortCommand();
     cmd.PortReference = port;
     cmd.Index = index;
     PostCommand(cmd);
 }
Exemplo n.º 48
0
 protected AbstractBusCommand(SerializationInfo info, StreamingContext context)
 {
     _busRef = CommandReference.Deserialize("bus", info);
 }
Exemplo n.º 49
0
 public virtual void PostCommandBusAttachedToPort(CommandReference bus, CommandReference port, int index)
 {
     BusDrivePortCommand cmd = new BusDrivePortCommand();
     cmd.BusReference = bus;
     cmd.PortReference = port;
     cmd.Index = index;
     PostCommand(cmd);
 }
 protected PortBusIndexCommand(SerializationInfo info, StreamingContext context)
 {
     _index = info.GetInt32("idx");
     _portRef = CommandReference.Deserialize("port", info);
     _busRef = CommandReference.Deserialize("bus", info);
 }
Exemplo n.º 51
0
 protected PortBusCommand(SerializationInfo info, StreamingContext context)
 {
     _portRef = CommandReference.Deserialize("port", info);
     _busRef = CommandReference.Deserialize("bus", info);
 }
Exemplo n.º 52
0
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("NewCommand", Config.YttriumNamespace);
     _ref = CommandReference.Deserialize("New", reader);
     reader.ReadEndElement();
 }
Exemplo n.º 53
0
 public virtual void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("BusCommand", Context.YttriumNamespace);
     _busRef = CommandReference.Deserialize("Bus", reader);
     reader.ReadEndElement();
 }
Exemplo n.º 54
0
 public virtual void PostCommandSignalDrivesPortNoLonger(CommandReference port, int index)
 {
     SignalUndrivePortCommand cmd = new SignalUndrivePortCommand();
     cmd.PortReference = port;
     cmd.Index = index;
     PostCommand(cmd);
 }
Exemplo n.º 55
0
 protected Signal GetVerifySignal(CommandReference signalReference)
 {
     Signal signal = System.GetSignal(signalReference.Index);
     LazyVerify(signal.InstanceId, signalReference.InstanceId);
     return signal;
 }
Exemplo n.º 56
0
 protected Bus GetVerifyBus(CommandReference busReference)
 {
     Bus bus = System.GetBus(busReference.Index);
     LazyVerify(bus.InstanceId, busReference.InstanceId);
     return bus;
 }
Exemplo n.º 57
0
 protected NewCommand(SerializationInfo info, StreamingContext context)
 {
     _ref = CommandReference.Deserialize("new", info);
 }
Exemplo n.º 58
0
 protected Port GetVerifyPort(CommandReference portReference)
 {
     Port port = System.GetPort(portReference.Index);
     LazyVerify(port.InstanceId, portReference.InstanceId);
     return port;
 }
 protected AbstractPortSignalIndexCommand(SerializationInfo info, StreamingContext context)
 {
     _index = info.GetInt32("idx");
     _portRef = CommandReference.Deserialize("port", info);
     _signalRef = CommandReference.Deserialize("signal", info);
 }
 protected AbstractSignalCommand(SerializationInfo info, StreamingContext context)
 {
     _signalRef = CommandReference.Deserialize("signal", info);
 }