Exemplo n.º 1
0
        private Log(string logClass, hsapplication homeSeerApp)
        {
            if (homeSeerApp != null)
            this.HomeSeerApp = homeSeerApp;

              Init(logClass);
        }
Exemplo n.º 2
0
        public static Log GetInstance(string name, hsapplication homeSeerApp)
        {
            if (classes.ContainsKey(name)) return (Log)classes[name];

              Log log = new Log(name, homeSeerApp);
              classes.Add(name, log);
              return log;
        }
Exemplo n.º 3
0
        public const int MISC_ZWAVE = 0x1000; // zwave device

        #endregion Fields

        #region Methods

        public static string GetBodyContent(hsapplication homeSeerApp)
        {
            string body = "";

              try
              {
            body = homeSeerApp.GetPageHeader(App.PLUGIN_NAME, "", "", false, false, false, true, false);
              }
              catch (Exception)
              {

              }
              return body;
        }
Exemplo n.º 4
0
        public static string GetFooterContent(hsapplication homeSeerApp)
        {
            string footer = "";

              try
              {
            footer = homeSeerApp.GetPageFooter(false);
              }
              catch (Exception)
              {

              }
              footer = footer.Replace("</body>", "");
              footer = footer.Replace("</html>", "");
              return footer;
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
              {
            homeSeerApp = (hsapplication)Context.Items["Content"];

            // Used for debugging in VS
            if (homeSeerApp == null)
              homeSeerApp = Global.homeSeerApp;

            if (homeSeerApp == null)
              throw new Exception("Error loading HomeSeer application object");

            log = Log.GetInstance("HSPI_JJLATITUDE.Web.Distances", homeSeerApp);

            plugin = (HSPI)homeSeerApp.Plugin(App.PLUGIN_NAME);

            if (plugin == null)
              throw new Exception("Error getting a reference to the plug-in.  Is it loaded and enabled?");
              }
              catch (Exception ex)
              {
            Response.Write(ex.Message + ex.StackTrace);
              }
              log.Debug("Loading Distances web page");

              // Inject HomeSeer HTML
              litHSHeader.Text = HomeSeer.GetHeadContent(homeSeerApp);
              litHSBody.Text = HomeSeer.GetBodyContent(homeSeerApp);
              litHSFooter.Text = HomeSeer.GetFooterContent(homeSeerApp);

              dsPeople.DataFile = Db.DbPath;
              dsPlaces.DataFile = Db.DbPath;
              dsDistances.DataFile = Db.DbPath;

              if (!IsPostBack)
              {

              }
        }
Exemplo n.º 6
0
        public static string GetHeadContent(hsapplication homeSeerApp)
        {
            string header = "";

              try
              {
            header = homeSeerApp.GetPageHeader(App.PLUGIN_NAME, "", "", false, false, true, false, false);
              }
              catch (Exception)
              {

              }
              return header;
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
              homeSeerApp = (hsapplication)Context.Items["Content"];

              // Used for debugging in VS
              if (homeSeerApp == null)
            homeSeerApp = Global.homeSeerApp;

              if (homeSeerApp == null)
            throw new Exception("Error loading HomeSeer application object");

              plugin = (HSPI)homeSeerApp.Plugin(App.PLUGIN_NAME);

              if (plugin == null)
            throw new Exception("Error getting a reference to the plug-in.  Is it loaded and enabled?");
            }
            catch (Exception ex)
            {
              Response.Write(ex.Message + ex.StackTrace);
            }
            log = Log.GetInstance("HSPI_JJLATITUDE.Web.Config", homeSeerApp);

              if (!IsPostBack)
            {

            log.Debug("Loading Config page");

            // Inject HomeSeer HTML
            litHSHeader.Text = HomeSeer.GetHeadContent(homeSeerApp);
            litHSBody.Text = HomeSeer.GetBodyContent(homeSeerApp);
            litHSFooter.Text = HomeSeer.GetFooterContent(homeSeerApp);

            try
            {
              lstLogLevel.SelectedValue = AppConfig.Read("Main", "LogLevel");
            }
            catch (Exception)
            {
              log.Error("Error reading config value: LogLevel");
            }

            try
            {
              lstUpdateFreq.SelectedValue = AppConfig.Read("Main", "UpdateFrequency");
            }
            catch (Exception)
            {
              log.Error("Error reading config value: UpdateFrequency");
            }

            try
            {
              chkLogFile.Checked = Convert.ToBoolean(AppConfig.Read("Main", "LogToFile"));
            }
            catch (Exception)
            {
              log.Error("Error reading config value: LogToFile");
            }

            try
            {
              chkLogHomeSeer.Checked = Convert.ToBoolean(AppConfig.Read("Main", "LogToHomeSeer"));
            }
            catch (Exception)
            {
              log.Error("Error reading config value: LogToHomeSeer");
            }

              }  // (!IsPostBack)
        }