コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Brick"/> class.
        /// </summary>
        /// <param name="communicationFactory">Object implementing the <see cref="ICommunicationFactory"/> interface.</param>
        /// <param name="fileProvider">Object implementing the <see cref="IFileProvider"/> interface.</param>
        /// <param name="alwaysSendEvents">Send events when data changes, or at every poll</param>
        public Brick(ICommunicationFactory communicationFactory, IFileProvider fileProvider, bool alwaysSendEvents = false)
        {
            DirectCommandFactory = new DirectCommandFactory(this);
            SystemCommandFactory = new SystemCommandFactory(this, fileProvider);
            BatchCommandFactory  = new BatchCommandFactory(this);

            Buttons = new BrickButtons();

            _communicationFactory = communicationFactory;
            _alwaysSendEvents     = alwaysSendEvents;

            int index = 0;

            Ports = new Dictionary <InputPort, Port>();

            foreach (InputPort i in Enum.GetValues(typeof(InputPort)))
            {
                Ports[i] = new Port
                {
                    InputPort = i,
                    Index     = index++,
                    Name      = i.ToString(),
                };
            }
        }
コード例 #2
0
ファイル: ChannelBase.cs プロジェクト: porter1130/WP8-DEMO
        /// <summary>
        /// Initializes a new instance of the <see cref="ChannelBase"/> class using the given communication factory implementation.
        /// </summary>
        /// <param name="communicationFactory">The communication factory that is used to create the actual communication objects.</param>
        protected ChannelBase(ICommunicationFactory communicationFactory)
        {
            if (communicationFactory == null)
            {
                throw new ArgumentNullException("communicationFactory");
            }

            CommunicationFactory = communicationFactory;
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PhoneControllerClient"/> class.
        /// </summary>
        /// <param name="dataSource">The data source used to acquire data.</param>
        /// <param name="communicationFactory">The communication factory used to create the actual communication objects.</param>
        public PhoneControllerClient(IDataSource dataSource, ICommunicationFactory communicationFactory)
        {
            if (communicationFactory == null)
            {
                throw new ArgumentNullException("communicationFactory");
            }

            _communicationFactory = communicationFactory;

            CreatePhoneControllerClient(dataSource);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PhoneControllerServer"/> class using the given communication factory.
        /// </summary>
        /// <param name="communicationFactory">The communication factory used to create the interal communication objects.</param>
        public PhoneControllerServer(ICommunicationFactory communicationFactory)
        {
            if (communicationFactory == null)
            {
                throw new ArgumentNullException("communicationFactory");
            }

            _communicationFactory = communicationFactory;

            CreatePhoneControllerServer();
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PhoneControllerClient"/> class using the given data source.
        /// </summary>
        /// <param name="dataSource">The data source used to acquire data.</param>
        public PhoneControllerClient(IDataSource dataSource)
        {
            _communicationFactory = new DefaultCommunicationFactory();

            CreatePhoneControllerClient(dataSource);
        }
コード例 #6
0
ファイル: ControlChannel.cs プロジェクト: porter1130/WP8-DEMO
 /// <summary>
 /// Initializes a new instance of the <see cref="ControlChannel"/> class using the given communication factory.
 /// </summary>
 /// <param name="communicationFactory">The communication factory used to create the actual communication objects.</param>
 public ControlChannel(ICommunicationFactory communicationFactory)
     : base(communicationFactory)
 {
 }
コード例 #7
0
ファイル: DataChannel.cs プロジェクト: porter1130/WP8-DEMO
 /// <summary>
 /// Initializes a new instance of the <see cref="DataChannel"/> class using the given communication factory.
 /// </summary>
 /// <param name="communicationFactory">The communication factory that is used to create the actual communication objects.</param>
 public DataChannel(ICommunicationFactory communicationFactory)
     : base(communicationFactory)
 {
 }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PhoneControllerServer"/> class.
        /// </summary>
        public PhoneControllerServer()
        {
            _communicationFactory = new DefaultCommunicationFactory();

            CreatePhoneControllerServer();
        }