i have this method which will take 1 url :
- public static void LaunchSite(Uri sitUrl)
- {
-
- SHDocVw.ShellWindows w = new SHDocVw.ShellWindows();
- bool found = false;
- foreach (SHDocVw.ShellBrowserWindow item in w)
- {
- var doc = item.LocationURL;
- if (!string.IsNullOrEmpty(doc))
- if (doc == sitUrl.AbsoluteUri)
- {
- found = true;
- break;
- }
- }
- if (!found)
- Process.Start(sitUrl.AbsoluteUri);
- }
button event handler looks like this
- private void btnSubs_Click(object sender, RoutedEventArgs e)
- {
-
- Uri oxfArt = new Uri(@"http://www.oxfordartonline.com/subscriber/");
- Uri theoryTst = new Uri("http://theorytestpro.co.uk/");
- string webAddress = oxfArt.OriginalString;
- switch (webAddress)
- {
- case "http://www.oxfordartonline.com/subscriber/":
- StartProcess.LaunchSite(oxfArt);
- break;
- case "http://theorytestpro.co.uk/":
- StartProcess.LaunchSite(theoryTst);
- break;
- default:
- break;
- }
-
-
- }
the button event handler will handle multiple buttons so depending on which button clicked need to determine which Uri need to be launched using switch statement. thank you