Better error handling and tellduscenter can now be opened from scheduler, even on windows 7 with different registry layout.

This commit is contained in:
Stefan Persson 2010-10-29 13:25:24 +00:00
parent e0330e6bb7
commit 95a5b60337

View file

@ -207,6 +207,12 @@ namespace DeviceScheduler
private void ConfigUnits() private void ConfigUnits()
{ {
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Telldus"); RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Telldus");
if (key == null)
{
key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Telldus"); //64 bit (windows 7)
}
if (key != null)
{
string path = key.GetValue("UninstallString").ToString(); string path = key.GetValue("UninstallString").ToString();
path = System.IO.Path.GetDirectoryName(path); path = System.IO.Path.GetDirectoryName(path);
@ -222,6 +228,12 @@ namespace DeviceScheduler
Cursor = Cursors.Default; Cursor = Cursors.Default;
} }
else
{
MessageBox.Show("Path to TelldusCenter.exe cannot be found in Windows Registry. Please open TelldusCenter manually to configure devices.",
"", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void toolManageDevices_Click(object sender, EventArgs e) private void toolManageDevices_Click(object sender, EventArgs e)
{ {