/// <summary>
 /// Initialize for a specific module
 /// </summary>
 internal void Initialize(AsyncLocoBuffer lb, LocoNetAddress address)
 {
     this.lb         = lb;
     this.programmer = new Programmer(address);
     configurationControl.Initialize(lb, programmer);
     Text += string.Format(" [{0}]", address);
 }
예제 #2
0
 /// <summary>
 /// Default ctor
 /// </summary>
 internal ServoProgrammer(AsyncLocoBuffer lb)
 {
     this.lb         = lb;
     this.programmer = new Devices.MgvServo.ServoProgrammer();
     InitializeComponent();
     step1.Initialize(lb, programmer);
 }
예제 #3
0
        /// <summary>
        /// Close any active locobuffer connection
        /// </summary>
        private void CloseLocoBuffer()
        {
            if (locoNet == null)
            {
                return;
            }

            var lb = ConfiguredLocoBuffer;

            if (lb != null)
            {
                lb.SendMessage    -= LbForwardSendMessage;
                lb.PreviewMessage -= LbForwardPreviewMessage;
            }

            if (asyncLb != null)
            {
                asyncLb.Dispose();
                asyncLb = null;
            }

            var lnState = locoNet.State;

            if (lnState != null)
            {
                lnState.StateChanged -= LnStateStateChanged;
                lnState.LocoIOQuery  -= LnStateLocoIoQuery;
                lnState.LocoIOFound  -= LnStateLocoIoFound;
                lnState.Idle         -= LnStateIdle;
            }

            locoNet.Dispose();
            locoNet = null;
        }
예제 #4
0
 /// <summary>
 /// Initialize for a specific module
 /// </summary>
 internal void Initialize(AsyncLocoBuffer lb, LocoNetAddress currentAddress)
 {
     this.lb            = lb;
     programmer         = new Programmer(new LocoNetAddress(0, 0));
     Text               = string.Format("Change address of {0}/{1}", currentAddress.Address, currentAddress.SubAddress);
     upAddress.Value    = currentAddress.Address;
     upSubAddress.Value = currentAddress.SubAddress;
 }
예제 #5
0
        /// <summary>
        /// Pass the given locobuffer on to all components.
        /// </summary>
        internal void Setup(LocoBuffer lb, LocoNetConfiguration configuration)
        {
            // Allow for null arguments
            lb            = lb ?? ConfiguredLocoBuffer;
            configuration = configuration ?? Configuration;

            if ((ConfiguredLocoBuffer != lb) || (Configuration != configuration))
            {
                CloseLocoBuffer();
                locoNet = new LocoNet(lb, configuration);
                asyncLb = new AsyncLocoBuffer(ui, lb);

                lb.SendMessage    += LbForwardSendMessage;
                lb.PreviewMessage += LbForwardPreviewMessage;

                var lnState = locoNet.State;
                lnState.StateChanged += LnStateStateChanged;
                lnState.LocoIOQuery  += LnStateLocoIoQuery;
                lnState.LocoIOFound  += LnStateLocoIoFound;
                lnState.Idle         += LnStateIdle;

                LocoNetChanged.Fire(this);
            }
        }
예제 #6
0
 /// <summary>
 /// Default ctor
 /// </summary>
 internal void Initialize(AsyncLocoBuffer lb, Devices.MgvServo.ServoProgrammer programmer)
 {
     this.lb         = lb;
     this.programmer = programmer;
     address_AddressChanged(null, null);
 }
예제 #7
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public ServoTester(AsyncLocoBuffer lb, ILocoNetState lnState)
 {
     this.lb      = lb;
     this.lnState = lnState;
     InitializeComponent();
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 internal void Initialize(AsyncLocoBuffer lb, Devices.MgvServo.ServoProgrammer programmer)
 {
     this.lb            = lb;
     this.programmer    = programmer;
     programmer.Turnout = turnoutSelection.Turnout;
 }
 /// <summary>
 /// Initialize for a specific module
 /// </summary>
 internal void Initialize(AsyncLocoBuffer lb, Programmer programmer)
 {
     this.lb         = lb;
     this.programmer = programmer;
 }
예제 #10
0
 /// <summary>
 /// Default ctor
 /// </summary>
 internal void Initialize(AsyncLocoBuffer lb, Devices.MgvServo.ServoProgrammer programmer)
 {
     this.lb         = lb;
     this.programmer = programmer;
 }