protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName = screenObject.Property("Object Name").Value;
        OSAEObjectState os = OSAEObjectStateManager.GetObjectStateValue(ObjectName);

        CurrentState = os.Value;

        OffTimer    = Convert.ToUInt16(OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "OFF TIMER").Value);
        TimeInState = (int)os.TimeInState;

        string sBackColor = screenObject.Property("Back Color").Value;
        string sForeColor = screenObject.Property("Fore Color").Value;
        string sPrefix    = screenObject.Property("Prefix").Value;
        string sSuffix    = screenObject.Property("Suffix").Value;
        string iFontSize  = screenObject.Property("Font Size").Value;

        if (CurrentState == "OFF")
        {
            sValue = os.StateLabel;
        }
        else
        {
            span   = TimeSpan.FromSeconds(OffTimer - TimeInState); //Or TimeSpan.FromSeconds(seconds); (see Jakob C´s answer)
            sValue = span.ToString(@"mm\:ss");
        }

        TimerLabel.Text = sValue;
        TimerLabel.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");

        if (sBackColor != "")
        {
            try
            {
                TimerLabel.BackColor = Color.FromName(sBackColor);
            }
            catch (Exception)
            {
            }
        }
        if (sForeColor != "")
        {
            try
            {
                TimerLabel.ForeColor = Color.FromName(sForeColor);
            }
            catch (Exception)
            {
            }
        }
        if (iFontSize != "")
        {
            try
            {
                TimerLabel.Font.Size = new FontUnit(iFontSize);
            }
            catch (Exception)
            {
            }
        }
    }
    public void Update()
    {
        if (OSAEObjectStateManager.GetObjectStateValue(hdnObjName.Value).Value != hdnCurState.Value)
        {
            CurState        = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
            LastStateChange = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;

            foreach (OSAEObjectProperty p in screenObject.Properties)
            {
                if (p.Value.ToLower() == CurState.ToLower())
                {
                    StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
                }
            }

            string    imgName = screenObject.Property(StateMatch + " Image").Value;
            OSAEImage img     = imgMgr.GetImage(imgName);
            imgStateImage.ImageUrl = "~/ImageHandler.ashx?id=" + img.ID;
            imgStateImage.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property(StateMatch + " Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property(StateMatch + " X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
            imgStateImage.ToolTip = ObjectName + "\n" + CurState + " since: " + LastStateChange;
            if (CurState == "ON")
            {
                imgStateImage.Attributes.Add("onclick", "runMethod('" + ObjectName + "','OFF','','');");
            }
            else
            {
                imgStateImage.Attributes.Add("onclick", "runMethod('" + ObjectName + "','ON','','');");
            }
        }
    }
Exemple #3
0
        public OSAEObjectState GetObjectState(string name)
        {
            OSAEObjectState state = OSAEObjectStateManager.GetObjectStateValue(name);

            Log.Debug("Looking up object state:  " + name + ".  I Found " + state.StateLabel + ".");
            return(state);
        }
Exemple #4
0
        public void Update()
        {
            CurState = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;

            foreach (OSAEObjectProperty p in screenObject.Properties)
            {
                if (p.Value.ToLower() == CurState.ToLower())
                {
                    StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
                }
            }

            Location.X = Double.Parse(screenObject.Property(StateMatch + " X").Value);
            Location.Y = Double.Parse(screenObject.Property(StateMatch + " Y").Value);

            string    imgName = screenObject.Property(StateMatch + " Image").Value;
            OSAEImage img     = imgMgr.GetImage(imgName);

            if (img.Data != null)
            {
                var imageStream = new MemoryStream(img.Data);


                this.Dispatcher.Invoke((Action)(() =>
                {
                    var bitmapImage = new BitmapImage();
                    bitmapImage.BeginInit();
                    bitmapImage.StreamSource = imageStream;
                    bitmapImage.EndInit();
                    Image.Source = bitmapImage;
                }));
            }
        }
Exemple #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName   = screenObject.Property("Object Name").Value;
        PropertyName = screenObject.Property("Property Name").Value;

        string sPropertyValue;

        if (string.Equals(PropertyName, "STATE", StringComparison.CurrentCultureIgnoreCase))
        {
            sPropertyValue  = OSAEObjectStateManager.GetObjectStateValue(ObjectName).StateLabel;
            sPropertyValue += " (" + TimeSpan.FromSeconds(OSAEObjectStateManager.GetObjectStateValue(ObjectName).TimeInState) + ")";
        }
        else
        {
            sPropertyValue = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, PropertyName).Value;
        }
        string sBackColor = screenObject.Property("Back Color").Value;
        string sForeColor = screenObject.Property("Fore Color").Value;
        string sPrefix    = screenObject.Property("Prefix").Value;
        string sSuffix    = screenObject.Property("Suffix").Value;
        string iFontSize  = screenObject.Property("Font Size").Value;
        string sFontName  = screenObject.Property("Font Name").Value;

        PropertyLabel.Text = sPrefix + sPropertyValue + sSuffix;
        PropertyLabel.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 60).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");

        if (sFontName != "")
        {
            try
            { PropertyLabel.Font.Name = sFontName; }
            catch (Exception)
            { }
        }

        if (sBackColor != "")
        {
            try
            { PropertyLabel.BackColor = Color.FromName(sBackColor); }
            catch (Exception)
            { }
        }
        if (sForeColor != "")
        {
            try
            { PropertyLabel.ForeColor = Color.FromName(sForeColor); }
            catch (Exception)
            { }
        }
        if (iFontSize != "")
        {
            try
            { PropertyLabel.Font.Size = new FontUnit(iFontSize); }
            catch (Exception)
            { }
        }
    }
        public void Update()
        {
            OSAEObjectState stateCurrent = OSAEObjectStateManager.GetObjectStateValue(objName);

            LastStateChange = stateCurrent.LastStateChange;
            if (CurState != stateCurrent.Value)
            {
                CurState = stateCurrent.Value;
                Update_Button();
            }
        }
Exemple #7
0
 public void loadData(string objectName)
 {
     away                   = OSAEObjectStateManager.GetObjectStateValue(objectName).Value.ToLower();
     structure_id           = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Id").Value;
     name                   = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Name").Value;
     country_code           = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Country Code").Value;
     postal_code            = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Postal Code").Value;
     peak_period_start_time = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Peak Start Time").Value;
     peak_period_end_time   = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Peak End Time").Value;
     time_zone              = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Time Zone").Value;
 }
Exemple #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName       = screenObject.Property("Object Name").Value;
        hdnObjName.Value = ObjectName;
        CurState         = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
        OSAEObject curObj = OSAEObjectManager.GetObjectByName(ObjectName);

        hdnCurState.Value = CurState;
        LastStateChange   = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
        Table1.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
        Load_All_Weather();
    }
 public OSAEObjectState GetObjectState(string name, string authkey)
 {
     if (OSAESecurity.Authorize(authkey, name))
     {
         OSAEObjectState state = OSAEObjectStateManager.GetObjectStateValue(name);
         Log.Debug("Looking up object state:  " + name + ".  I Found " + state.StateLabel + ".");
         return(state);
     }
     else
     {
         return(null);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName        = screenObject.Property("Object Name").Value;
        hdnObjName.Value  = ObjectName;
        CurState          = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
        cObj              = OSAEObjectManager.GetObjectByName(ObjectName);
        hdnCurState.Value = CurState;
        LastStateChange   = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;

        foreach (OSAEObjectProperty p in screenObject.Properties)
        {
            if (p.Value.ToLower() == CurState.ToLower())
            {
                StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
            }
        }

        try { LightLevel = Convert.ToUInt16(OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "Light Level").Value); }
        catch { LightLevel = 100.00; }

        string    imgName = screenObject.Property(StateMatch + " Image").Value;
        OSAEImage img     = imgMgr.GetImage(imgName);

        if (img != null)
        {
            bool x = File.Exists(OSAE.Common.ApiPath + "/Plugins/Web Server/wwwroot/Images/" + img.Name + ".gif");
            if (x == false)
            {
                imgStateImage.ImageUrl = "~/ImageHandler.ashx?id=" + img.ID;
            }
            else
            {
                imgStateImage.ImageUrl = "~/Images/" + imgName + ".gif";
            }
            imgStateImage.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property(StateMatch + " Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property(StateMatch + " X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";opacity:" + LightLevel / 100.00 + ";");
            imgStateImage.Attributes.Add("Alt", "~/Images/" + imgName + ".gif");
            imgStateImage.ToolTip = ObjectName + "\n" + CurState + " since: " + LastStateChange;

            //REPLACE THIS with code block in screens to use state match and not on/off!
            if (CurState == "ON")
            {
                imgStateImage.Attributes.Add("onclick", "runMethod('" + ObjectName + "','OFF','','', " + cObj.MinTrustLevel + ");");
            }
            else
            {
                imgStateImage.Attributes.Add("onclick", "runMethod('" + ObjectName + "','ON','','', " + cObj.MinTrustLevel + ");");
            }
        }
    }
Exemple #11
0
        public void update()
        {
            OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("MediaCenter Device");

            String msg = "";

            //add any new objects created since pluggin started
            foreach (OSAEObject obj in objects)
            {
                MCDevice d = getMCDevice(obj.Name);
                if (d == null)
                {
                    log("Poll- device was null so we are creating it-" + obj.Name, false);
                    createdevice(obj);
                }
            }

            foreach (MCDevice d in mcdevices)
            {
                Boolean connected;
                connected = d.CheckConnections();

                if (connected)
                {
                    if (OSAEObjectStateManager.GetObjectStateValue(d.Name).Value == "Off")
                    {
                        OSAEObjectStateManager.ObjectStateSet(d.Name, "ON", pName);
                    }
                    if (!msg.Equals(""))
                    {
                        msg = msg + ", ";
                    }
                    msg = msg + d.Name + ":ON";
                }
                else
                {
                    if (OSAEObjectStateManager.GetObjectStateValue(d.Name).Value != "Off")
                    {
                        OSAEObjectStateManager.ObjectStateSet(d.Name, "OFF", pName);
                    }
                    if (!msg.Equals(""))
                    {
                        msg = msg + ", ";
                    }
                    msg = msg + d.Name + ":OFF";
                }
            }
            log("Poll to check which media center devices are online(" + msg + ")", false);
        }
        public void Update()
        {
            try
            {
                CurState        = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
                CurStateLabel   = OSAEObjectStateManager.GetObjectStateValue(ObjectName).StateLabel;
                LastStateChange = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
            }
            catch (Exception ex)
            {
            }

            foreach (OSAEObjectProperty p in screenObject.Properties)
            {
                if (p.Value.ToLower() == CurState.ToLower())
                {
                    StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
                }
            }

            try
            {
                //Location.X = Double.Parse(screenObject.Property(StateMatch + " X").Value);
                //Location.Y = Double.Parse(screenObject.Property(StateMatch + " Y").Value);
                Location.X = Double.Parse(OSAE.OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, StateMatch + " X").Value);
                Location.Y = Double.Parse(OSAE.OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, StateMatch + " Y").Value);

                string    imgName = screenObject.Property(StateMatch + " Image").Value;
                OSAEImage img     = imgMgr.GetImage(imgName);

                if (img.Data != null)
                {
                    var imageStream = new MemoryStream(img.Data);
                    this.Dispatcher.Invoke((Action)(() =>
                    {
                        var bitmapImage = new BitmapImage();
                        bitmapImage.BeginInit();
                        bitmapImage.StreamSource = imageStream;
                        bitmapImage.EndInit();
                        Image.Source = bitmapImage;
                        Image.ToolTip = ObjectName + "\n" + CurStateLabel + " since: " + LastStateChange;
                    }));
                }
            }
            catch (Exception ex)
            {
            }
        }
        public void Update(string type)
        {
            string sPropertyValue;

            if (type == "Full")
            {
                if (string.Equals(PropertyName, "STATE", StringComparison.CurrentCultureIgnoreCase))
                {
                    sPropertyValue  = OSAEObjectStateManager.GetObjectStateValue(ObjectName).StateLabel;
                    LastState       = sPropertyValue;
                    LastStateChange = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
                    TimeSpan newSpan = (DateTime.Now - LastStateChange);
                    sPropertyValue += " (" + newSpan.ToString(@"dd\ hh\:mm\:ss") + ")";
                    string sPrefix = screenObject.Property("Prefix").Value;
                    string sSuffix = screenObject.Property("Suffix").Value;
                    this.Dispatcher.Invoke((Action)(() =>
                    {
                        propLabel.Content = sPrefix + sPropertyValue + sSuffix;
                    }));
                }
                else
                {
                    sPropertyValue = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, PropertyName).Value;
                    string sPrefix = screenObject.Property("Prefix").Value;
                    string sSuffix = screenObject.Property("Suffix").Value;
                    this.Dispatcher.Invoke((Action)(() =>
                    {
                        propLabel.Content = sPrefix + sPropertyValue + sSuffix;
                    }));
                }
            }
            else if (type == "Refresh")
            {
                if (string.Equals(PropertyName, "STATE", StringComparison.CurrentCultureIgnoreCase))
                {
                    sPropertyValue = LastState;
                    TimeSpan newSpan = (DateTime.Now - LastStateChange);
                    sPropertyValue += " (" + newSpan.ToString(@"dd\ hh\:mm\:ss") + ")";
                    string sPrefix = screenObject.Property("Prefix").Value;
                    string sSuffix = screenObject.Property("Suffix").Value;
                    this.Dispatcher.Invoke((Action)(() =>
                    {
                        propLabel.Content = sPrefix + sPropertyValue + sSuffix;
                    }));
                }
            }
        }
        public StateImage(OSAEObject sObject)
        {
            InitializeComponent();

            screenObject = sObject;
            try
            {
                ObjectName      = screenObject.Property("Object Name").Value;
                CurState        = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
                LastStateChange = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
                Image.ToolTip   = ObjectName + "\n" + CurState + " since: " + LastStateChange;

                Image.Tag = ObjectName;
                Image.MouseLeftButtonUp += new MouseButtonEventHandler(State_Image_MouseLeftButtonUp);

                foreach (OSAEObjectProperty p in screenObject.Properties)
                {
                    if (p.Value.ToLower() == CurState.ToLower())
                    {
                        StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
                    }
                }

                string    imgName = screenObject.Property(StateMatch + " Image").Value;
                OSAEImage img     = imgMgr.GetImage(imgName);

                if (img.Data != null)
                {
                    var imageStream = new MemoryStream(img.Data);
                    var bitmapImage = new BitmapImage();

                    bitmapImage.BeginInit();
                    bitmapImage.StreamSource = imageStream;
                    bitmapImage.EndInit();
                    Image.Source     = bitmapImage;
                    Image.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    Image.Source     = null;
                    Image.Visibility = System.Windows.Visibility.Hidden;
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #15
0
        private void StateChange(string serial, Direction dir, uint n, int state)
        {
            string address = serial + ((dir == Direction.Input) ? "_I" : "_O") + n;
            //osae.AddToLog("state: " + address + " = " + state, true);
            OSAEObject obj = OSAEObjectManager.GetObjectByAddress(address);

            if (obj != null)
            {
                bool invert = OSAEObjectPropertyManager.GetObjectPropertyValue(obj.Name, "Invert").Value == "TRUE";
                bool on     = (state != 0) ^ invert;
                OSAEObjectStateManager.ObjectStateSet(obj.Name, on ? "ON" : "OFF", pName);
                logging.AddToLog("State change: " + obj.Name
                                 + " (" + address + ")"
                                 + " changed to " + OSAEObjectStateManager.GetObjectStateValue(obj.Name).Value,
                                 true); // false?
            }
        }
Exemple #16
0
        public void Update()
        {
            bool            stateChanged = false;
            OSAEObjectState stateCurrent = OSAEObjectStateManager.GetObjectStateValue(objName);

            if (this.CurState != stateCurrent.Value)
            {
                stateChanged = true;
            }
            this.CurState        = stateCurrent.Value;
            this.CurStateLabel   = stateCurrent.StateLabel;
            this.LastStateChange = stateCurrent.LastStateChange;
            if (stateChanged)
            {
                // add update code here!
            }
        }
Exemple #17
0
        // Add any additional properties needed here...

        #endregion

        #region Constructor
        // Code to Initialize your custom User Control
        public CustomUserControl(OSAEObject sObj, string ControlName, string appName, string user)
        {
            InitializeComponent();
            gAppName        = appName;
            currentUser     = user;
            _controlname    = ControlName;
            screenObject    = sObj;
            objName         = sObj.Property("Object Name").Value;
            CurState        = OSAEObjectStateManager.GetObjectStateValue(objName).Value;
            LastStateChange = OSAEObjectStateManager.GetObjectStateValue(objName).LastStateChange;

            // Retreive any other information needed from the database here....


            // Execute the refreshControl function. See below!
            refreshControl();
        }
 public void Update()
 {
     this.Dispatcher.Invoke((Action)(() =>
     {
         string sPropertyValue;
         if (string.Equals(PropertyName, "STATE", StringComparison.CurrentCultureIgnoreCase))
         {
             sPropertyValue = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
         }
         else
         {
             sPropertyValue = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, PropertyName).Value;
         }
         string sPrefix = screenObject.Property("Prefix").Value;
         string sSuffix = screenObject.Property("Suffix").Value;
         propLabel.Content = sPrefix + sPropertyValue + sSuffix;
     }));
 }
Exemple #19
0
        public void Update()
        {
            bool            stateChanged = false;
            OSAEObjectState stateCurrent = OSAEObjectStateManager.GetObjectStateValue(objName);

            if (this.CurState != stateCurrent.Value)
            {
                stateChanged = true;
            }
            this.CurState        = stateCurrent.Value;
            this.CurStateLabel   = stateCurrent.StateLabel;
            this.LastStateChange = stateCurrent.LastStateChange;
            if (stateChanged)
            {
                // Code that executes when the associated object has changed
                refreshControl();
            }
        }
Exemple #20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName        = screenObject.Property("Object Name").Value;
        hdnObjName.Value  = ObjectName;
        CurState          = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
        hdnCurState.Value = CurState;
        LastStateChange   = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;

        foreach (OSAEObjectProperty p in screenObject.Properties)
        {
            if (p.Value.ToLower() == CurState.ToLower())
            {
                StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
            }
        }

        try
        {
            LightLevel = Convert.ToUInt16(OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "Light Level").Value);
        }
        catch
        {
            LightLevel = 100.00;
        }


        string    imgName = screenObject.Property(StateMatch + " Image").Value;
        OSAEImage img     = imgMgr.GetImage(imgName);

        if (img != null)
        {
            imgStateImage.ImageUrl = "~/ImageHandler.ashx?id=" + img.ID;
            imgStateImage.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property(StateMatch + " Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property(StateMatch + " X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";opacity:" + LightLevel / 100.00 + ";");
            imgStateImage.ToolTip = ObjectName + "\n" + CurState + " since: " + LastStateChange;
            if (CurState == "ON")
            {
                imgStateImage.Attributes.Add("onclick", "runMethod('" + ObjectName + "','OFF','','');");
            }
            else
            {
                imgStateImage.Attributes.Add("onclick", "runMethod('" + ObjectName + "','ON','','');");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName       = screenObject.Property("Object Name").Value;
        hdnObjName.Value = ObjectName;
        CurState         = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
        OSAEObject curObj = OSAEObjectManager.GetObjectByName(ObjectName);

        hdnCurState.Value = CurState;
        LastStateChange   = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
        Button1.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
        Button1.Width   = (ObjectName.Length + 4) * 8;
        Button1.ToolTip = ObjectName + "\n" + CurState + " since: " + LastStateChange;
        if (CurState == "ON")
        {
            Button1.Text = ObjectName + " OFF";
        }
        else
        {
            Button1.Text = ObjectName + " ON";
        }
    }
Exemple #22
0
        public void Update()
        {
            Dispatcher.Invoke((Action)(() =>
            {
                string sValue;
                OSAEObjectState os = OSAEObjectStateManager.GetObjectStateValue(ObjectName);
                CurrentState = os.Value;

                TimeSpan ts = DateTime.Now - LastUpdated;
                TimeInState = (int)ts.TotalSeconds;
                if (os.Value == "OFF")
                {
                    sValue = os.StateLabel;
                    timerLabel.Content = sValue;
                }
                else
                {
                    span = TimeSpan.FromSeconds(OffTimer - TimeInState); //Or TimeSpan.FromSeconds(seconds); (see Jakob C´s answer)
                    sValue = span.ToString(@"mm\:ss");
                }
            }));
        }
Exemple #23
0
        public void Update()
        {
            OSAEImageManager imgMgr       = new OSAEImageManager();
            bool             stateChanged = false;

            try
            {
                OSAEObjectState stateCurrent = OSAEObjectStateManager.GetObjectStateValue(ObjectName);
                if (CurState != stateCurrent.Value)
                {
                    stateChanged = true;
                }

                CurState        = stateCurrent.Value;
                CurStateLabel   = stateCurrent.StateLabel;
                LastStateChange = stateCurrent.LastStateChange;
            }
            catch
            { }

            foreach (OSAEObjectProperty p in screenObject.Properties)
            {
                if (p.Value.ToLower() == CurState.ToLower())
                {
                    StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
                }
            }

            try
            {
                Location.X = Double.Parse(OSAE.OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, StateMatch + " X").Value);
                Location.Y = Double.Parse(OSAE.OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, StateMatch + " Y").Value);

                try
                {
                    string propertyCheck = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "Light Level").Value;
                    if (propertyCheck != "")
                    {
                        LightLevel = Convert.ToUInt16(propertyCheck);
                    }
                    else
                    {
                        LightLevel = 100;
                    }
                }
                catch { }

                if (sliderVisible && updatingSlider == false)
                {
                    try { CurLevel = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "Level").Value; }
                    catch { CurLevel = "0"; }
                    Dispatcher.Invoke((Action)(() =>
                    {
                        sldSlider.ToolTip = CurLevel + "%";
                        sldSlider.Value = Convert.ToUInt16(CurLevel);

                        if (CurLevel != "")
                        {
                            Image.ToolTip = ObjectName + "\n" + CurStateLabel + " (" + CurLevel + "%) since: " + LastStateChange;
                        }
                        else
                        {
                            Image.ToolTip = ObjectName + "\n" + CurStateLabel + " since: " + LastStateChange;
                        }
                    }));
                }

                if (stateChanged)
                {
                    timer.Stop();
                    string imgName  = screenObject.Property(StateMatch + " Image").Value;
                    string imgName2 = screenObject.Property(StateMatch + " Image 2").Value;
                    string imgName3 = screenObject.Property(StateMatch + " Image 3").Value;
                    string imgName4 = screenObject.Property(StateMatch + " Image 4").Value;
                    if (imgName != "")
                    {
                        OSAEImage img1 = imgMgr.GetImage(imgName);
                        if (img1 != null)
                        {
                            ms1          = new MemoryStream(img1.Data);
                            imageFrames  = 1;
                            currentFrame = 1;
                            Dispatcher.Invoke((Action)(() =>
                            {
                                BitmapImage bitmapImage = new BitmapImage();
                                bitmapImage.BeginInit();
                                bitmapImage.StreamSource = ms1;
                                bitmapImage.EndInit();
                                Image.Source = bitmapImage;
                                ImageWidth = bitmapImage.Width;
                                ImageHeight = bitmapImage.Height;
                            }));

                            // Primary Frame is loaded, load up additional frames for the time to display.
                            if (imgName2 != "")
                            {
                                OSAEImage img2 = imgMgr.GetImage(imgName2);
                                if (img2 != null)
                                {
                                    ms2         = new MemoryStream(img2.Data);
                                    imageFrames = 2;
                                    if (imgName3 != "")
                                    {
                                        OSAEImage img3 = imgMgr.GetImage(imgName3);
                                        if (img3 != null)
                                        {
                                            ms3         = new MemoryStream(img3.Data);
                                            imageFrames = 3;
                                            if (imgName4 != "")
                                            {
                                                OSAEImage img4 = imgMgr.GetImage(imgName4);
                                                if (img4 != null)
                                                {
                                                    ms4         = new MemoryStream(img4.Data);
                                                    imageFrames = 4;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Dispatcher.Invoke((Action)(() =>
                        {
                            Image.Source = null; // Image.Visibility = System.Windows.Visibility.Hidden;
                        }));
                    }

                    if (imageFrames > 1)
                    {
                        timer.Start();
                    }
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message, "StateImage Update"); }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName       = screenObject.Property("Object Name").Value;
        hdnObjName.Value = ObjectName;
        CurState         = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
        OSAEObject curObj = OSAEObjectManager.GetObjectByName(ObjectName);

        hdnCurState.Value = CurState;
        LastStateChange   = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
        btnState.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");

        DataSet ds = OSAEObjectStateManager.ObjectStateListGet(ObjectName);

        if (ds.Tables[0].Rows.Count > 0)
        {
            State1Name  = ds.Tables[0].Rows[0]["state_name"].ToString();
            State1Label = ds.Tables[0].Rows[0]["state_label"].ToString();
        }
        if (ds.Tables[0].Rows.Count > 1)
        {
            State2Name  = ds.Tables[0].Rows[1]["state_name"].ToString();
            State2Label = ds.Tables[0].Rows[1]["state_label"].ToString();
        }
        CurState        = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
        LastStateChange = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
        try
        {
            ControlWidth  = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, "Width").Value);
            ControlHeight = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, "Height").Value);
        }
        catch (Exception ex)
        { }
        btnState.Height = ControlHeight;
        btnState.Width  = ControlWidth; // (ObjectName.Length + 4) * 8;
        string sBackColor = screenObject.Property("Back Color").Value;
        string sForeColor = screenObject.Property("Fore Color").Value;
        int    iFontSize  = Convert.ToInt16(screenObject.Property("Font Size").Value) - 3;
        string sFontName  = screenObject.Property("Font Name").Value;

        if (sBackColor != "")
        {
            try
            { btnState.BackColor = System.Drawing.Color.FromName(sBackColor); }
            catch (Exception)
            { }
        }
        if (sForeColor != "")
        {
            try
            { btnState.ForeColor = System.Drawing.Color.FromName(sForeColor); }
            catch (Exception)
            { }
        }
        if (iFontSize != 0)
        {
            try
            { btnState.Font.Size = new FontUnit(iFontSize); }
            catch (Exception)
            { }
        }
        if (sFontName != "")
        {
            try
            { btnState.Font.Name = sFontName; }
            catch (Exception)
            { }
        }

        if (CurState == State1Name)
        {
            btnState.Text    = ObjectName + " " + State1Label;
            btnState.ToolTip = "Click to Set " + ObjectName + " to " + State2Label;
        }
        else
        {
            btnState.Text    = ObjectName + " " + State2Label;
            btnState.ToolTip = "Click to Set " + ObjectName + " to " + State1Label;
        }
    }
        public void loadData(string objectName)
        {
            hvac_mode = OSAEObjectStateManager.GetObjectStateValue(objectName).Value.ToLower();

            device_id         = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Id").Value;
            name              = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Name").Value;
            name_long         = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Name Long").Value;
            temperature_scale = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Temperature Scale").Value;
            locale            = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Locale").Value;
            software_version  = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Software Version").Value;
            structure_id      = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Structure ID").Value;
            fan_timer_timeout = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Fan Timer Timeout").Value;

            //convert _lastConnection to standard format for comparison
            DateTime _lastConnection;

            last_connection = OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Last Connection").Value;

            if (!DateTime.TryParse(last_connection, out _lastConnection))
            {
                last_connection = "";
            }
            else
            {
                last_connection = _lastConnection.ToString("G"); // 1/29/2015 8:43:16 PM
            }

            Boolean _has_leaf;
            Boolean _is_online;
            Boolean _can_cool;
            Boolean _can_heat;
            Boolean _has_fan;
            Boolean _is_using_emergency_heat;
            Boolean _fan_timer_active;

            Boolean.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Has Leaf").Value, out _has_leaf);
            has_leaf = _has_leaf;
            Boolean.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Is Online").Value, out _is_online);
            is_online = _is_online;
            Boolean.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Can Cool").Value, out _can_cool);
            can_cool = _can_cool;
            Boolean.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Can Heat").Value, out _can_heat);
            can_heat = _can_heat;
            Boolean.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Has Fan").Value, out _has_fan);
            has_fan = _has_fan;
            Boolean.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Using Emergency Heat").Value, out _is_using_emergency_heat);
            is_using_emergency_heat = _is_using_emergency_heat;
            Boolean.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Fan Timer Active").Value, out _fan_timer_active);
            fan_timer_active = _fan_timer_active;


            float _ambient_temperature;
            float _humidity;
            float _target_temperature;
            float _target_temperature_high;
            float _target_temperature_low;
            float _away_temperature_high;
            float _away_temperature_low;

            float.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Humidity").Value, out _humidity);
            humidity = _humidity;
            float.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Ambient Temperature").Value, out _ambient_temperature);
            ambient_temperature_f = _ambient_temperature;
            ambient_temperature_c = _ambient_temperature;
            float.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Target Temperature").Value, out _target_temperature);
            target_temperature_f = _target_temperature;
            target_temperature_c = _target_temperature;
            float.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Target Temperature High").Value, out _target_temperature_high);
            target_temperature_high_f = _target_temperature_high;
            target_temperature_high_c = _target_temperature_high;
            float.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Target Temperature Low").Value, out _target_temperature_low);
            target_temperature_low_f = _target_temperature_low;
            target_temperature_low_c = _target_temperature_low;
            float.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Away Temperature High").Value, out _away_temperature_high);
            away_temperature_high_f = _away_temperature_high;
            away_temperature_high_c = _away_temperature_high;
            float.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(objectName, "Away Temperature Low").Value, out _away_temperature_low);
            away_temperature_low_f = _away_temperature_low;
            away_temperature_low_c = _away_temperature_low;
        }
Exemple #26
0
        public TimerLabel(OSAEObject sObj)
        {
            InitializeComponent();
            screenObject = sObj;
            screenName   = Name;

            ObjectName = screenObject.Property("Object Name").Value;

            OSAEObjectState os = OSAEObjectStateManager.GetObjectStateValue(ObjectName);

            CurrentState = os.Value;

            OffTimer    = Convert.ToInt16(OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "OFF TIMER").Value);
            TimeInState = (int)os.TimeInState;

            string sValue;
            string sBackColor = screenObject.Property("Back Color").Value;
            string sForeColor = screenObject.Property("Fore Color").Value;
            string iFontSize  = screenObject.Property("Font Size").Value;
            string sFontName  = screenObject.Property("Font Name").Value;

            if (CurrentState == "OFF")
            {
                sValue = os.StateLabel;
            }
            else
            {
                span   = TimeSpan.FromSeconds(OffTimer - TimeInState); //Or TimeSpan.FromSeconds(seconds); (see Jakob C´s answer)
                sValue = span.ToString(@"mm\:ss");
            }

            if (sValue != "")
            {
                if (sBackColor != "")
                {
                    try
                    {
                        BrushConverter  conv  = new BrushConverter();
                        SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush;
                        timerLabel.Background = brush;
                    }
                    catch { }
                }
                if (sForeColor != "")
                {
                    try
                    {
                        BrushConverter  conv  = new BrushConverter();
                        SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush;
                        timerLabel.Foreground = brush;
                    }
                    catch { }
                }
                if (iFontSize != "")
                {
                    try
                    { timerLabel.FontSize = Convert.ToDouble(iFontSize); }
                    catch { }
                }
                timerLabel.Content = sValue;
            }
            else
            {
                timerLabel.Content = "";
            }

            timer.Interval = 1000;
            timer.Enabled  = true;
            timer.Elapsed += new ElapsedEventHandler(timer_tick);
        }
Exemple #27
0
        public StateImage(OSAEObject sObject, string appName)
        {
            InitializeComponent();

            OSAEImageManager imgMgr = new OSAEImageManager();

            gAppName     = appName;
            screenObject = sObject;
            ObjectName   = screenObject.Property("Object Name").Value;
            //    ObjectType = screenObject.Property("Object Name").Value;
            LinkedObject  = OSAEObjectManager.GetObjectByName(ObjectName);
            SliderMethod  = screenObject.Property("Slider Method").Value;
            CurState      = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
            CurStateLabel = OSAEObjectStateManager.GetObjectStateValue(ObjectName).StateLabel;
            try
            {
                string propertyCheck = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "Light Level").Value;
                if (propertyCheck != "")
                {
                    LightLevel = Convert.ToUInt16(propertyCheck);
                }
                else
                {
                    LightLevel = 100;
                }
            }
            catch
            { }

            LastStateChange = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
            Image.ToolTip   = ObjectName + " " + CurStateLabel + "\n" + "since: " + LastStateChange;

            Image.Tag = ObjectName;
            Image.MouseLeftButtonUp += new MouseButtonEventHandler(State_Image_MouseLeftButtonUp);

            foreach (OSAEObjectProperty p in screenObject.Properties)
            {
                if (p.Value.ToLower() == CurState.ToLower())
                {
                    StateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' '));
                }
            }

            try
            {
                string imgName  = screenObject.Property(StateMatch + " Image").Value;
                string imgName2 = screenObject.Property(StateMatch + " Image 2").Value;
                string imgName3 = screenObject.Property(StateMatch + " Image 3").Value;
                string imgName4 = screenObject.Property(StateMatch + " Image 4").Value;

                try
                { repeatAnimation = Convert.ToBoolean(screenObject.Property("Repeat Animation").Value); }
                catch
                {
                    OSAEObjectPropertyManager.ObjectPropertySet(screenObject.Name, "Repeat Animation", "TRUE", gAppName);
                    repeatAnimation = true;
                }

                try
                { frameDelay = Convert.ToInt16(screenObject.Property("Frame Delay").Value); }
                catch
                {
                    frameDelay = 100;
                    OSAEObjectPropertyManager.ObjectPropertySet(screenObject.Name, "Frame Delay", "100", gAppName);
                }
                OSAEImage img1 = imgMgr.GetImage(imgName);
                if (img1 != null)
                {
                    ms1 = new MemoryStream(img1.Data);
                    BitmapImage bitmapImage = new BitmapImage();

                    bitmapImage.BeginInit();
                    bitmapImage.StreamSource = ms1;
                    bitmapImage.EndInit();

                    Image.Source = bitmapImage;
                    ImageWidth   = bitmapImage.Width;
                    ImageHeight  = bitmapImage.Height;

                    Image.Visibility = System.Windows.Visibility.Visible;

                    imageFrames  = 1;
                    currentFrame = 1;
                    OSAEImage img2 = imgMgr.GetImage(imgName2);
                    if (img2 != null)
                    {
                        ms2         = new MemoryStream(img2.Data);
                        imageFrames = 2;
                        OSAEImage img3 = imgMgr.GetImage(imgName3);
                        if (img3 != null)
                        {
                            ms3         = new MemoryStream(img3.Data);
                            imageFrames = 3;
                            OSAEImage img4 = imgMgr.GetImage(imgName4);
                            if (img4 != null)
                            {
                                ms4         = new MemoryStream(img4.Data);
                                imageFrames = 4;
                            }
                        }
                    }
                }
                else
                {
                    Image.Source     = null;
                    Image.Visibility = System.Windows.Visibility.Hidden;
                }
            }
            catch { }

            sliderVisible = Convert.ToBoolean(screenObject.Property("Show Slider").Value);

            if (sliderVisible)
            {
                sldSlider.Visibility = System.Windows.Visibility.Visible;
                try
                {
                    CurLevel        = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, "Level").Value;
                    sldSlider.Value = Convert.ToUInt16(CurLevel);
                }
                catch { }
            }
            else
            {
                sldSlider.Visibility = System.Windows.Visibility.Hidden;
            }

            timer.Interval = TimeSpan.FromMilliseconds(frameDelay);
            timer.Tick    += this.timer_Tick;

            if (imageFrames > 1)
            {
                timer.Start();
            }
        }
        public PropertyLabel(OSAEObject sObj)
        {
            InitializeComponent();
            screenObject = sObj;
            ObjectName   = screenObject.Property("Object Name").Value;
            PropertyName = screenObject.Property("Property Name").Value;

            string sPropertyValue;

            if (string.Equals(PropertyName, "STATE", StringComparison.CurrentCultureIgnoreCase))
            {
                sPropertyValue = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
            }
            else
            {
                sPropertyValue = OSAEObjectPropertyManager.GetObjectPropertyValue(ObjectName, PropertyName).Value;
            }
            string sBackColor = screenObject.Property("Back Color").Value;
            string sForeColor = screenObject.Property("Fore Color").Value;
            string sPrefix    = screenObject.Property("Prefix").Value;
            string sSuffix    = screenObject.Property("Suffix").Value;
            string iFontSize  = screenObject.Property("Font Size").Value;
            string sFontName  = screenObject.Property("Font Name").Value;

            if (sPropertyValue != "")
            {
                if (sBackColor != "")
                {
                    try
                    {
                        BrushConverter  conv  = new BrushConverter();
                        SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush;
                        propLabel.Background = brush;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (sForeColor != "")
                {
                    try
                    {
                        BrushConverter  conv  = new BrushConverter();
                        SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush;
                        propLabel.Foreground = brush;
                    }
                    catch (Exception)
                    {
                    }
                }
                if (iFontSize != "")
                {
                    try
                    {
                        propLabel.FontSize = Convert.ToDouble(iFontSize);
                    }
                    catch (Exception)
                    {
                    }
                }
                propLabel.Content = sPrefix + sPropertyValue + sSuffix;
            }
            else
            {
                propLabel.Content = "";
            }
        }
        // Code to Initialize your custom User Control
        public CustomUserControl(OSAEObject sObj, string ControlName, string appName, string user)
        {
            InitializeComponent();
            gAppName     = appName;
            currentUser  = user;
            _controlname = ControlName;
            screenObject = sObj;
            objName      = sObj.Property("Object Name").Value;
            DataSet ds = OSAEObjectStateManager.ObjectStateListGet(objName);

            if (ds.Tables[0].Rows.Count > 0)
            {
                State1Name  = ds.Tables[0].Rows[0]["state_name"].ToString();
                State1Label = ds.Tables[0].Rows[0]["state_label"].ToString();
            }
            if (ds.Tables[0].Rows.Count > 1)
            {
                State2Name  = ds.Tables[0].Rows[1]["state_name"].ToString();
                State2Label = ds.Tables[0].Rows[1]["state_label"].ToString();
            }
            CurState        = OSAEObjectStateManager.GetObjectStateValue(objName).Value;
            LastStateChange = OSAEObjectStateManager.GetObjectStateValue(objName).LastStateChange;
            try
            {
                ControlWidth  = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, "Width").Value);
                ControlHeight = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, "Height").Value);
            }
            catch (Exception ex)
            { }

            string sBackColor = screenObject.Property("Back Color").Value;
            string sForeColor = screenObject.Property("Fore Color").Value;
            string iFontSize  = screenObject.Property("Font Size").Value;
            string sFontName  = screenObject.Property("Font Name").Value;

            if (sBackColor != "")
            {
                try
                {
                    BrushConverter  conv  = new BrushConverter();
                    SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush;
                    btnState.Background = brush;
                }
                catch (Exception)
                { }
            }
            if (sForeColor != "")
            {
                try
                {
                    BrushConverter  conv  = new BrushConverter();
                    SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush;
                    btnState.Foreground = brush;
                }
                catch (Exception)
                { }
            }
            if (iFontSize != "")
            {
                try
                { btnState.FontSize = Convert.ToDouble(iFontSize); }
                catch (Exception)
                { }
            }
            if (sFontName != "")
            {
                try
                { btnState.FontFamily = new FontFamily(sFontName); }
                catch (Exception)
                { }
            }
            //propLabel.Content = sPrefix + sPropertyValue + sSuffix;


            Update_Button();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        ObjectName       = screenObject.Property("Object Name").Value;
        hdnObjName.Value = ObjectName;
        CurState         = OSAEObjectStateManager.GetObjectStateValue(ObjectName).Value;
        OSAEObject curObj = OSAEObjectManager.GetObjectByName(ObjectName);

        hdnCurState.Value = CurState;
        LastStateChange   = OSAEObjectStateManager.GetObjectStateValue(ObjectName).LastStateChange;
        tblWeather.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
        try
        {
            ControlWidth  = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, "Width").Value);
            ControlHeight = Convert.ToInt32(OSAEObjectPropertyManager.GetObjectPropertyValue(screenObject.Name, "Height").Value);
        }
        catch (Exception ex)
        { }
        string sBackColor = screenObject.Property("Back Color").Value;
        string sForeColor = screenObject.Property("Fore Color").Value;
        int    iFontSize  = Convert.ToInt16(screenObject.Property("Font Size").Value) - 4;
        string sFontName  = screenObject.Property("Font Name").Value;

        if (sBackColor != "")
        {
            try
            { tblWeather.BackColor = System.Drawing.Color.FromName(sBackColor); }
            catch (Exception)
            { }
        }
        if (sForeColor != "")
        {
            try
            {
                lblCurTemp.ForeColor = System.Drawing.Color.FromName(sForeColor);
                lblDay1.ForeColor    = System.Drawing.Color.FromName(sForeColor);
                lblDay2.ForeColor    = System.Drawing.Color.FromName(sForeColor);
                lblDay3.ForeColor    = System.Drawing.Color.FromName(sForeColor);
                lblDay4.ForeColor    = System.Drawing.Color.FromName(sForeColor);
                lblDay5.ForeColor    = System.Drawing.Color.FromName(sForeColor);
            }
            catch (Exception)
            { }
        }
        if (iFontSize >= 0)
        {
            try
            {
                lblDay1.Font.Size = new FontUnit(iFontSize);
                lblDay2.Font.Size = new FontUnit(iFontSize);
                lblDay3.Font.Size = new FontUnit(iFontSize);
                lblDay4.Font.Size = new FontUnit(iFontSize);
                lblDay5.Font.Size = new FontUnit(iFontSize);
            }
            catch (Exception)
            { }
        }
        if (sFontName != "")
        {
            try
            {
                lblDay1.Font.Name = sFontName;
                lblDay2.Font.Name = sFontName;
                lblDay3.Font.Name = sFontName;
                lblDay4.Font.Name = sFontName;
                lblDay5.Font.Name = sFontName;
            }
            catch (Exception)
            { }
        }

        Load_All_Weather();
    }