Upcoming event Dim level

Support questions for server and client (Windows, iPhone, Android, Linux)
Post Reply
pekkak
2 stars
2 stars
Posts: 44
Joined: Sat 10 Nov 2012, 07:31

Upcoming event Dim level

Post by pekkak » Tue 15 Jan 2013, 18:24

In the web client upcoming event's action is shown only on/off with this statement:

Code: Select all

dr["Action"] = events[i].Action.ID == Common.Server.IdConstants.DeviceActionTurnOnId ? "On" : "Off";
How can I get "Dim 10%" etc. like displayed in the SK client "coming up" list's Information column?

Martin
Administrator
Administrator
Posts: 2655
Joined: Tue 09 Nov 2010, 20:25

Re: Upcoming event Dim level

Post by Martin » Wed 16 Jan 2013, 10:24

There is a DimLevel property on events (should be events.DimLevel) that can be used to get dim level if action equals TurnOn.
Martin | Switch King

pekkak
2 stars
2 stars
Posts: 44
Joined: Sat 10 Nov 2012, 07:31

Re: Upcoming event Dim level

Post by pekkak » Wed 16 Jan 2013, 16:03

Got it, thank you very much! :clap:

Code: Select all

					if (events[i].Action.ID == Common.Server.IdConstants.DeviceStateOffId)
					{
						dr["Action"] = "OFF";
					}
					else if (events[i].Action.ID == Common.Server.IdConstants.DeviceStateOnId)
					{
						if (!events[i].DimLevel.HasValue || events[i].DimLevel.Value == 100)
						{
							dr["Action"] = "ON";
						}
						else
						{
							dr["Action"] = events[i].DimLevel.Value.ToString() +"%";
						}
					}
					else
						dr["Action"]  = "ON";

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests