Added a help button for how to obtain a google api key

Brian [2016-08-23 14:53:24]
Added a help button for how to obtain a google api key
Filename
PokemonGo.RocketBot.Window/Forms/SettingForm.cs
PokemonGo.RocketBot.Window/Images/Miscs/question.png
PokemonGo.RocketBot.Window/PokemonGo.RocketBot.Window.csproj
PokemonGo.RocketBot.Window/Properties/Resources.Designer.cs
PokemonGo.RocketBot.Window/Properties/Resources.resx
diff --git a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
index 861f10c..f27137d 100644
--- a/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
+++ b/PokemonGo.RocketBot.Window/Forms/SettingForm.cs
@@ -1,9 +1,11 @@
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Drawing;
 using System.Globalization;
 using System.IO;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Windows.Forms;
 using GMap.NET;
 using GMap.NET.MapProviders;
@@ -285,6 +287,31 @@ namespace PokemonGo.RocketBot.Window.Forms
             #endregion
         }

+        #region Help button for API key
+
+        protected override void OnLoad(EventArgs e)
+        {
+            var btn = new Button {Size = new Size(25, GoogleApiBox.ClientSize.Height + 2)};
+            btn.Location = new Point(GoogleApiBox.ClientSize.Width - btn.Width, -1);
+            btn.Cursor = Cursors.Default;
+            btn.Image = ResourceHelper.GetImage("question");
+            btn.Click += googleapihep_click;
+            GoogleApiBox.Controls.Add(btn);
+            // Send EM_SETMARGINS to prevent text from disappearing underneath the button
+            SendMessage(GoogleApiBox.Handle, 0xd3, (IntPtr) 2, (IntPtr) (btn.Width << 16));
+            base.OnLoad(e);
+        }
+
+        private void googleapihep_click(object sender, EventArgs e)
+        {
+            Process.Start("https://developers.google.com/maps/documentation/directions/get-api-key");
+        }
+
+        [DllImport("user32.dll")]
+        private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
+
+        #endregion
+
         #region private methods

         private static int ConvertStringToInt(string input)
@@ -318,7 +345,7 @@ namespace PokemonGo.RocketBot.Window.Forms
         /// </summary>
         private void GetLanguageList()
         {
-            var languages = new List<string> { "en" };
+            var languages = new List<string> {"en"};
             var langFiles = Directory.GetFiles(LanguagePath, "*.json", SearchOption.TopDirectoryOnly);
             languages.AddRange(langFiles.Select(
                 langFileName => Path.GetFileNameWithoutExtension(langFileName)?.Replace("translation.", ""))
@@ -335,7 +362,7 @@ namespace PokemonGo.RocketBot.Window.Forms
             tbLatitude.Text = gMapCtrl.Position.Lat.ToString(CultureInfo.InvariantCulture);
             tbLongitude.Text = gMapCtrl.Position.Lng.ToString(CultureInfo.InvariantCulture);
             //update trackbar
-            trackBar.Value = (int)Math.Round(gMapCtrl.Zoom);
+            trackBar.Value = (int) Math.Round(gMapCtrl.Zoom);
         }

         /// <summary>
@@ -616,7 +643,6 @@ namespace PokemonGo.RocketBot.Window.Forms
                 Application.Restart();
                 Close();
             }
-
         }

         private void cancelBtn_Click(object sender, EventArgs e)
@@ -681,7 +707,7 @@ namespace PokemonGo.RocketBot.Window.Forms

         private void AdressBox_KeyPress(object sender, KeyPressEventArgs e)
         {
-            if (e.KeyChar != (char)Keys.Enter)
+            if (e.KeyChar != (char) Keys.Enter)
             {
                 return;
             }
diff --git a/PokemonGo.RocketBot.Window/Images/Miscs/question.png b/PokemonGo.RocketBot.Window/Images/Miscs/question.png
new file mode 100644
index 0000000..0c854e9
Binary files /dev/null and b/PokemonGo.RocketBot.Window/Images/Miscs/question.png differ
diff --git a/PokemonGo.RocketBot.Window/PokemonGo.RocketBot.Window.csproj b/PokemonGo.RocketBot.Window/PokemonGo.RocketBot.Window.csproj
index 4dfaafe..f5dbe64 100644
--- a/PokemonGo.RocketBot.Window/PokemonGo.RocketBot.Window.csproj
+++ b/PokemonGo.RocketBot.Window/PokemonGo.RocketBot.Window.csproj
@@ -334,6 +334,7 @@
     <None Include="cert.pfx">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </None>
+    <None Include="Images\Miscs\question.png" />
     <Content Include="Resources\device info.csv">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
diff --git a/PokemonGo.RocketBot.Window/Properties/Resources.Designer.cs b/PokemonGo.RocketBot.Window/Properties/Resources.Designer.cs
index 2a9c7d7..fe5a228 100644
--- a/PokemonGo.RocketBot.Window/Properties/Resources.Designer.cs
+++ b/PokemonGo.RocketBot.Window/Properties/Resources.Designer.cs
@@ -1830,6 +1830,16 @@ namespace PokemonGo.RocketBot.Window.Properties {
             }
         }

+        /// <summary>
+        ///   查找 System.Drawing.Bitmap 类型的本地化资源。
+        /// </summary>
+        internal static System.Drawing.Bitmap question {
+            get {
+                object obj = ResourceManager.GetObject("question", resourceCulture);
+                return ((System.Drawing.Bitmap)(obj));
+            }
+        }
+
         /// <summary>
         ///   查找 System.Drawing.Bitmap 类型的本地化资源。
         /// </summary>
diff --git a/PokemonGo.RocketBot.Window/Properties/Resources.resx b/PokemonGo.RocketBot.Window/Properties/Resources.resx
index 7ebfacf..4636423 100644
--- a/PokemonGo.RocketBot.Window/Properties/Resources.resx
+++ b/PokemonGo.RocketBot.Window/Properties/Resources.resx
@@ -1990,6 +1990,9 @@
   <data name="Pokestop_looted" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Images\Markers\Pokestop_looted.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <data name="question" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Images\Miscs\question.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+  </data>
   <data name="Trainer_Front" type="System.Resources.ResXFileRef, System.Windows.Forms">
     <value>..\Images\Markers\Trainer_Front.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
You may download the files in Public Git.