// *************************************************************************************************
        // The thread callback function.  Sit and wait for work.  release thread on program stopping
        // by placing a null string at the end of the queue (happens in program event handler)
        // *************************************************************************************************

        #region Event Handlers
        void myKeypad_ButtonStateChange(GenericBase device, ButtonEventArgs args)
        {
            var btn = args.Button;
            var uo  = btn.UserObject;

            // CrestronConsole.PrintLine("Event sig: {0}, Type: {1}, State: {2}", btn.Number, btn.GetType(), btn.State);

            #region UserObject Action<> invocation
            // I have a big issue to contend with in these methods - what do you pass as arguments to the methods
            // I want to keep things decoupled but how do you get access to devices created, resgitered in control system
            // class when you in in classes that are outside the scope  e.g. Versiports, IRPorts etc.
            // Need to fix this section so the action is not fired more than once on button press - for now it does.
            // for some reason
            if (uo is System.Action <Button> )            //if this userObject has been defined and is correct type
            {
                (uo as System.Action <Button>)(btn);
            }
            else if (uo is System.Action)
            {
                (uo as System.Action)();
            }

            ButtonInterfaceController myBIC = new ButtonInterfaceController();
            #endregion
        } // Event Handler
        // *************************************************************************************************
        // InititalizeSystem - get in and out quickly - system startup stuff
        // *************************************************************************************************
        public override void InitializeSystem()
        {
            myComPortController.Initialize();

            // This statement defines the userobject for this signal as a delegate to run the class method
            // So, when this particular signal is invoked the delegate function invokes the class method
            // I have demonstrated 3 different ways to assign the action with and without parms as well
            // as lambda notation vs simplified - need to test to see whagt does and does not work
            myKPController = new ButtonInterfaceController(myKeypad);
        }
Exemple #3
0
        static public void DnRelease(string s)
        {
            ButtonInterfaceController bic = new ButtonInterfaceController();

            bic.PressDn_Released(Convert.ToUInt32(s));
        }
Exemple #4
0
        static public void UpPress(string s)
        {
            ButtonInterfaceController bic = new ButtonInterfaceController();

            bic.PressUp_Pressed(Convert.ToUInt32(s));
        }