Ejemplo n.º 1
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public LocoNet(LocoBuffer lb, LocoNetConfiguration configuration)
 {
     this.lb = lb;
     this.configuration = configuration;
     state = new LocoNetState(lb);
     unknownLocoIoDetector = new UnknownLocoIODetector(this);
 }
        /// <summary>
        /// Try to load an item from the given element into the given configuration.
        /// </summary>
        /// <returns>True on success, false otherwise. When false, subsequent loaders are called.</returns>
        public override bool TryLoad(XElement element, LocoNetConfiguration configuration)
        {
            if (element.Name.LocalName != ElementName)
                return false;
            var config = new LocoIOConfig(element);

            return true;
        }
 /// <summary>
 /// Load the given element using my loaders.
 /// </summary>
 internal static void Load(XElement element, LocoNetConfiguration configuration)
 {
     foreach (var loader in Loaders)
     {
         if (loader.TryLoad(element, configuration))
             return;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Load the given element using my loaders.
 /// </summary>
 internal static void Load(XElement element, LocoNetConfiguration configuration)
 {
     foreach (var loader in Loaders)
     {
         if (loader.TryLoad(element, configuration))
         {
             return;
         }
     }
 }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Try to load an item from the given element into the given configuration.
 /// </summary>
 /// <returns>True on success, false otherwise. When false, subsequent loaders are called.</returns>
 public abstract bool TryLoad(XElement element, LocoNetConfiguration configuration);
 /// <summary>
 /// Try to load an item from the given element into the given configuration.
 /// </summary>
 /// <returns>True on success, false otherwise. When false, subsequent loaders are called.</returns>
 public abstract bool TryLoad(XElement element, LocoNetConfiguration configuration);