Skip to content

Commit

Permalink
Added the possibility to open the user's web browser (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Mar 19, 2021
1 parent 52a514e commit 3a141fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions InternetTest/InternetTest/Classes/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MIT License
using InternetTest.Pages;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand Down Expand Up @@ -91,6 +92,15 @@ public static string GetHiSentence
}
}

/// <summary>
/// Opens a link in a web browser.
/// </summary>
/// <param name="url">The URL to open.</param>
public static void OpenLinkInBrowser(string url)
{
Process.Start("explorer.exe", url); // Open the URL
}

/// <summary>
/// Changes the application's theme.
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion InternetTest/InternetTest/Pages/ConnectionPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ MIT License
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
using InternetTest.Classes;
using LeoCorpLibrary;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -95,7 +96,7 @@ private void TestBtn_Click(object sender, RoutedEventArgs e)

private void OpenBrowserBtn_Click(object sender, RoutedEventArgs e)
{

Global.OpenLinkInBrowser("https://www.leocorp.fr/"); // Open in a browser
}
}
}

0 comments on commit 3a141fe

Please sign in to comment.