Better error handling/messages
This commit is contained in:
parent
a049d60090
commit
e0330e6bb7
1 changed files with 12 additions and 7 deletions
|
@ -22,8 +22,6 @@ namespace DeviceSchedulerAgent
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Makesure that we have all data loaded.
|
//Makesure that we have all data loaded.
|
||||||
DataStorage data = LoadData();
|
DataStorage data = LoadData();
|
||||||
|
|
||||||
|
@ -44,16 +42,23 @@ namespace DeviceSchedulerAgent
|
||||||
{
|
{
|
||||||
Device item = handler.Find(action.DeviceID);
|
Device item = handler.Find(action.DeviceID);
|
||||||
|
|
||||||
if (action.TurnOn)
|
if (item != null)
|
||||||
handler.TurnOnWithDelay(item);
|
{
|
||||||
else
|
if (action.TurnOn)
|
||||||
handler.TurnOffWithDelay(item);
|
handler.TurnOnWithDelay(item);
|
||||||
|
else
|
||||||
|
handler.TurnOffWithDelay(item);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Device could not be found. Please make sure that TelldusService is running and no device scheduled for turn on/off has been removed.", "Telldus scheduler");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Programmet kunde inte hitta något jobb.");
|
MessageBox.Show("No scheduled jobs could be found.", "Telldus scheduler");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue