﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DezvoltarePersonala_NeXT_CO
{
    public partial class Linkurics : Form
    {
        //Verific conexiunea de internet pentru a putea accesa link-urile
        
        
        public static bool CheckForInternetConnection()
        {
            try
            {
                using (var client = new WebClient())
                using (var stream = client.OpenRead("http://www.google.com"))
                {
                    return true;
                }
            }
            catch
            {
                return false;
            }
        }
        
       
        //Modific proprietatea link-ului pentru a avea un backgroud transparent
      
        void transparentLabel(LinkLabel lb)
        {
            var pos = this.PointToScreen(lb.Location);
            pos = pictureBox1.PointToClient(pos);
            lb.Parent = pictureBox1;
            lb.Location = pos;
            lb.BackColor = Color.Transparent;
        }


        public Linkurics()
        {
            InitializeComponent();
            transparentLabel(linkLabel1);
            transparentLabel(linkLabel2);
            transparentLabel(linkLabel3);
            transparentLabel(linkLabel4);
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void pictureBox2_MouseHover(object sender, EventArgs e)
        {
            ZoomInZoomOut.Effect(pictureBox2);
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (CheckForInternetConnection() == false)
                MessageBox.Show("Ne pare rau insa nu aveti o conexiune stabila la internet, prin urmare nu puteti folosi testele puse la dispozitie.");
            else
                Process.Start("chrome.exe", linkLabel1.Text);
        }

        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (CheckForInternetConnection() == false)
                MessageBox.Show("Ne pare rau insa nu aveti o conexiune stabila la internet, prin urmare nu puteti folosi testele puse la dispozitie.");
            else
                Process.Start("chrome.exe", linkLabel4.Text);
        }

        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (CheckForInternetConnection() == false)
                MessageBox.Show("Ne pare rau insa nu aveti o conexiune stabila la internet, prin urmare nu puteti folosi testele puse la dispozitie.");
            else
                Process.Start("chrome.exe", linkLabel3.Text);
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (CheckForInternetConnection() == false)
                MessageBox.Show("Ne pare rau insa nu aveti o conexiune stabila la internet, prin urmare nu puteti folosi testele puse la dispozitie.");
            else
                Process.Start("chrome.exe", linkLabel2.Text);
        }


    }
}
