Skip to content

Commit

Permalink
Ajouter la possibilité de voir la localisation d'une adresse IP dans …
Browse files Browse the repository at this point in the history
…Bing Maps (#117)
  • Loading branch information
Leo-Peyronnet committed Jul 31, 2020
1 parent 0acebb0 commit 804d62d
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 295 deletions.
32 changes: 22 additions & 10 deletions InternetTest/Forms/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,33 @@ public Form1()
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
private async void Form1_Load(object sender, EventArgs e)
{
Icon = new Branches().IconBranch(); // Met l'icône en foncion de la branche
gunaPictureBox1.Image = new Branches().ImageBranch(); // Met l'image en fonction de la branche
Guna.UI.Lib.GraphicsHelper.ShadowForm(this);
ChangeTheme(); // Change le thème en fonction des préférences de l'utilisateur
if (Properties.Settings.Default.TestOnStart)
await Task.Run(() =>
{
LaunchTest(); // Lancer un test
}
Invoke(new MethodInvoker(delegate ()
{
Icon = new Branches().IconBranch(); // Met l'icône en foncion de la branche
gunaPictureBox1.Image = new Branches().ImageBranch(); // Met l'image en fonction de la branche
Guna.UI.Lib.GraphicsHelper.ShadowForm(this);
ChangeTheme(); // Change le thème en fonction des préférences de l'utilisateur
if (Properties.Settings.Default.TestOnStart)
{
LaunchTest(); // Lancer un test
}
}));
});
}

private void gunaGradientButton1_Click(object sender, EventArgs e)
private async void gunaGradientButton1_Click(object sender, EventArgs e)
{
LaunchTest(); // Lancer un test
await Task.Run(() =>
{
Invoke(new MethodInvoker(delegate ()
{
LaunchTest(); // Lancer un test
}));
});
}

private void LaunchTest()
Expand Down
29 changes: 29 additions & 0 deletions InternetTest/Forms/LocalizeIP.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion InternetTest/Forms/LocalizeIP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ private void ChangeLanguage()
}
lat = new WebClient().DownloadString(string.Format("http://ip-api.com/line/{0}?fields=lat", ip)); // Latitude
lon = new WebClient().DownloadString(string.Format("http://ip-api.com/line/{0}?fields=lon", ip)); // Longitude
//Process.Start(string.Format("https://www.bing.com/maps?q={0} {1}", lat, lon)); // Ouvrir dans une carte
}

private void LocalizeIP_Load(object sender, EventArgs e)
Expand Down Expand Up @@ -174,6 +173,11 @@ private async void gunaGradientButton1_Click(object sender, EventArgs e)
}
}

private void gunaGradientButton2_Click(object sender, EventArgs e)
{
Process.Start(string.Format("https://www.bing.com/maps?q={0} {1}", lat, lon)); // Ouvrir dans une carte
}

private void ChangeTheme()
{
if (new Theme().IsDark()) // Si le thème est sombre
Expand Down
11 changes: 10 additions & 1 deletion InternetTest/Forms/LocalizeIP.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,16 @@
<value>434, 37</value>
</data>
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>434, 299</value>
<value>434, 334</value>
</data>
<data name="gunaGradientButton2.Location" type="System.Drawing.Point, System.Drawing">
<value>147, 294</value>
</data>
<data name="gunaGradientButton2.Size" type="System.Drawing.Size, System.Drawing">
<value>141, 29</value>
</data>
<data name="gunaGradientButton2.Text" xml:space="preserve">
<value>See on a map</value>
</data>
<data name="gunaGradientButton1.Location" type="System.Drawing.Point, System.Drawing">
<value>247, 80</value>
Expand Down

0 comments on commit 804d62d

Please sign in to comment.