Beispiel #1
0
        /// <summary>
        /// InitializeSystem - this method gets called after the constructor
        /// has finished.
        ///
        /// Use InitializeSystem to:
        /// * Start threads
        /// * Configure ports, such as serial and verisports
        /// * Start and initialize socket connections
        /// Send initial device configurations
        ///
        /// Please be aware that InitializeSystem needs to exit quickly also;
        /// if it doesn't exit in time, the SIMPL#Pro program will exit.
        /// </summary>
        public override void InitializeSystem()
        {
            try
            {
                if (PinAuthenticationProvider.Initialize() == PinAuthenticationProvider.InitializationSuccessFailureReason.ConfigFileNotFound)
                {
                    PinAuthenticationProvider.CreateNewConfig();
                }
                pinAuthProvider = PinAuthenticationProvider.GetInstance();

                SmartObjectDynamicButtonIconListHelper smartObjectDynamicButtonIconListHelper = new SmartObjectDynamicButtonIconListHelper(xPanel.SmartObjects[smartObjectDynamicListHelperParameters.Id], smartObjectDynamicListHelperParameters);
                smartObjectDynamicButtonIconListHelper.NumberOfItems = (ushort)ActionsManager.GetActions().Length;
                uint actionId = 0;
                foreach (string actionName in ActionsManager.GetActions())
                {
                    actionId++;
                    string actionNameFix = actionName;
                    smartObjectDynamicButtonIconListHelper.Items[actionId].Enable        = true;
                    smartObjectDynamicButtonIconListHelper.Items[actionId].Visible       = true;
                    smartObjectDynamicButtonIconListHelper.Items[actionId].Text          = actionNameFix;
                    smartObjectDynamicButtonIconListHelper.Items[actionId].PressedAction = new Action <bool>(x => { if (!x)
                                                                                                                    {
                                                                                                                        ActionsManager.InvokeAction(actionNameFix);
                                                                                                                    }
                                                                                                             });
                }
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
            }
        }
Beispiel #2
0
        private void Action1(string actionParameters)
        {
            CrestronConsole.PrintLine("Action1: {0}", String.IsNullOrEmpty(actionParameters) ? "no params" : actionParameters);

            SmartObjectDynamicButtonIconListHelper smartObjectDynamicButtonIconListHelper = new SmartObjectDynamicButtonIconListHelper(xPanel.SmartObjects[smartObjectDynamicListHelperParameters.Id], smartObjectDynamicListHelperParameters);

            smartObjectDynamicButtonIconListHelper.NumberOfItems = (ushort)_actions.Count;

            CrestronConsole.PrintLine("Action1: Item[1] was {0}", smartObjectDynamicButtonIconListHelper.Items[1].Selected);
            smartObjectDynamicButtonIconListHelper.Items[1].Selected = !smartObjectDynamicButtonIconListHelper.Items[1].Selected;
        }