public void Register()
        {
            Scheduler.PageBuilderAndMenu.clsPageBuilder pageToRegister;

            _hs.RegisterPage(_pageName, Utility.PluginName, Utility.InstanceFriendlyName);

            var linkText = _pageName;

            linkText = linkText.Replace("MelCloud_", "").Replace("_", " ").Replace(Utility.PluginName, "");
            var pageTitle = linkText;

            var wpd = new WebPageDesc
            {
                link       = _pageName,
                plugInName = Utility.PluginName
            };

            _callback.RegisterConfigLink(wpd);

            var webPageDescription = new WebPageDesc
            {
                plugInName = Utility.PluginName,
                link       = _pageName,
                linktext   = pageTitle,
                page_title = pageTitle
            };

            _hs.RegisterPage(_pageName, Utility.PluginName, string.Empty);
            _callback.RegisterLink(webPageDescription);
        }
        private IConfigPage CreateConfigPage(string pageName)
        {
            Scheduler.PageBuilderAndMenu.clsPageBuilder pageToRegister;
            switch (pageName)
            {
            case MelcloudGeneralConfig:
                pageToRegister = new GeneralConfig(pageName, _hs, _callbackApi, _iniSettings, _log);
                break;

            case MelcloudAbout:
                pageToRegister = new AboutPage(pageName, _hs);
                break;

            default: throw new NotImplementedException($"Page {pageName} is not implemented");
            }

            _hs.RegisterPage(pageName, Utility.PluginName, Utility.InstanceFriendlyName);

            var linkText = pageName;

            linkText = linkText.Replace("RFLink_", "").Replace("_", " ").Replace(Utility.PluginName, "");
            var pageTitle = linkText;

            var webPageDescription = new WebPageDesc
            {
                plugInName = Utility.PluginName,
                link       = pageName + Utility.InstanceFriendlyName,
                linktext   = pageTitle,
                page_title = pageTitle + Utility.InstanceFriendlyName
            };

            _callbackApi.RegisterLink(webPageDescription);
            return((IConfigPage)pageToRegister);
        }
Beispiel #3
0
        public string InitIO(string port)
        {
            Console.WriteLine("InitIO called!");
            Thread.Sleep(5000);
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-US");

            mCore = new EnOceanManager(hsHost, hsHostCB, this);
            mCore.Initialize();
            hsHostCB.RegisterEventCB(Enums.HSEvent.CONFIG_CHANGE, Name, "");
            //hsHostCB.RegisterEventCB(Enums.HSEvent.LOG, Name, "");
            hsHostCB.RegisterEventCB(Enums.HSEvent.SETUP_CHANGE, Name, "");
            //hsHostCB.RegisterEventCB(Enums.HSEvent.STRING_CHANGE, Name, "");
            hsHostCB.RegisterEventCB(Enums.HSEvent.GENERIC, Name, "");

            this.mPageBuilder = new PageBuilder(hsHost, hsHostCB, this, mCore);

            hsHost.RegisterPage(Constants.PLUGIN_STRING_ID, Name, "");
            hsHost.RegisterPage(Constants.PLUGIN_STRING_ID + "_Interfaces", Name, "");

            WebPageDesc wpd = new WebPageDesc();

            wpd.link       = Constants.PLUGIN_STRING_ID;
            wpd.linktext   = "Configuration";
            wpd.page_title = "Configuration";
            wpd.plugInName = Name;
            hsHostCB.RegisterLink(wpd);
            hsHostCB.RegisterConfigLink(wpd);

            WebPageDesc wpi = new WebPageDesc();

            wpi.link       = Constants.PLUGIN_STRING_ID + "_Interfaces";
            wpi.linktext   = "Interfaces";
            wpi.page_title = "Interfaces";
            wpi.plugInName = Name;
            hsHostCB.RegisterLink(wpi);

            Console.WriteLine("INIT IO complete");
            return(""); // empty == OK
        }
Beispiel #4
0
        private IConfigPage CreateConfigPage(string pageName)
        {
            Scheduler.PageBuilderAndMenu.clsPageBuilder pageToRegister;
            var pageNameWithoutStart = pageName.Replace(Utility.PluginName, "");

            switch (pageNameWithoutStart)
            {
            case GeneralConfig:
                pageToRegister = new ConfigGeneral(pageName, _hs, _iniSettings, _logging, _mainPlugin);
                break;

            case AboutConfig:
                pageToRegister = new ConfigAbout(pageName, _hs, _iniSettings, _logging);
                break;

            default: throw new NotImplementedException($"Page {pageName} is not implemented");
            }

            _hs.RegisterPage(pageName, Utility.PluginName, Utility.InstanceFriendlyName);

            var linkText = pageName;

            linkText = linkText.Replace("GCalSeer_", "").Replace("_", " ").Replace(Utility.PluginName, "");
            var pageTitle = linkText;

            var webPageDescription = new WebPageDesc
            {
                plugInName = Utility.PluginName,
                link       = pageName + Utility.InstanceFriendlyName,
                linktext   = pageTitle,
                page_title = pageTitle + Utility.InstanceFriendlyName
            };

            _callback.RegisterLink(webPageDescription);
            return((IConfigPage)pageToRegister);
        }