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);
- }
- private void btnSubs_Click(object sender, RoutedEventArgs e)
- {
- //StartProcess.webSit();
- 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
Guest UserPosted Apr 12, 2016, 9:57 AM
Abbas HamzaPosted Apr 12, 2016, 10:28 AM
Abbas HamzaPosted Apr 12, 2016, 9:40 AM
Guest UserPosted Apr 12, 2016, 7:33 AM