コード例 #1
0
        private void SetGoButtonGreen()
        {
            btnGoButton.Text = "Go";

            btnGoButton.ButtonElement.ButtonFillElement.BackColor  = ColourHelper.HexStringToColor("68ff6c");
            btnGoButton.ButtonElement.ButtonFillElement.BackColor2 = ColourHelper.HexStringToColor("84fc87");
            btnGoButton.ButtonElement.ButtonFillElement.BackColor3 = ColourHelper.HexStringToColor("b0feb2");
            btnGoButton.ButtonElement.ButtonFillElement.BackColor4 = ColourHelper.HexStringToColor("d3fed4");
        }
コード例 #2
0
        private void SetGoButtonRed()
        {
            btnGoButton.Text = "Stop";

            btnGoButton.ButtonElement.ButtonFillElement.BackColor  = ColourHelper.HexStringToColor("ff675f");
            btnGoButton.ButtonElement.ButtonFillElement.BackColor2 = ColourHelper.HexStringToColor("f7918c");
            btnGoButton.ButtonElement.ButtonFillElement.BackColor3 = ColourHelper.HexStringToColor("fbb9b6");
            btnGoButton.ButtonElement.ButtonFillElement.BackColor4 = ColourHelper.HexStringToColor("f9ccca");
        }
コード例 #3
0
        private void LoadMapHTML(string address, bool initialLoad = false)
        {
            if (string.IsNullOrEmpty(tbAPIKey.Text))
            {
                if (!initialLoad)
                {
                    tbAPIKey.BackColor = ColourHelper.HexStringToColor("f98a85");
                    MessageBox.Show("Google API field cannot be empty", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    wbMap.Navigate("about:blank");
                    try
                    {
                        if (wbMap.Document != null)
                        {
                            wbMap.Document.Write(string.Empty);
                        }
                    }
                    catch
                    { } // do nothing with this
                    wbMap.DocumentText = HtmlHelper.GenerateMapHtml("", tbAPIKey.Text);
                }
            }
            else
            {
                tbAPIKey.BackColor = Color.White;

                List <string> latLong = GetLatLong(address, tbAPIKey.Text);

                bool postCodeOnly = false;

                if (latLong[0] == "Fail")
                {
                    // just use the post code if we can't locate the exact address:

                    address = AddressStringHelper.GetPostCodeFromAddress(address);
                    latLong = GetLatLong(address, tbAPIKey.Text);

                    postCodeOnly = true;
                }
                if (latLong[0].Contains("Over Limit"))
                {
                    lblLatLong.Text = "Latitude / Longitude:   " + "Query limit reached";
                }
                else if (latLong[0].Contains("The remote server returned an error") || latLong[0].Contains("instance of an object"))
                {
                    lblLatLong.Text = "Latitude / Longitude:   " + "Server / API key error";
                }
                else
                {
                    if (latLong[0].Contains("Fail"))
                    {
                        lblLatLong.Text = "Latitude / Longitude:   " + "Failed to find coordinates";
                    }
                    else
                    {
                        if (postCodeOnly)
                        {
                            lblLatLong.Text = "Latitude / Longitude:   " + latLong[0] + "\t" + latLong[1] + "\t" + "*PC";
                        }
                        else
                        {
                            lblLatLong.Text = "Latitude / Longitude:   " + latLong[0] + "\t" + latLong[1];
                        }
                    }
                }

                lblLatLong.Visible = true;

                wbMap.Navigate("about:blank");
                try
                {
                    if (wbMap.Document != null)
                    {
                        wbMap.Document.Write(string.Empty);
                    }
                }
                catch
                { } // do nothing with this
                wbMap.DocumentText = HtmlHelper.GenerateMapHtml(address, tbAPIKey.Text);
            }
        }
コード例 #4
0
 protected override void OnPaint(PaintEventArgs e)
 {
     using (SolidBrush brush = new SolidBrush(BackColor))
         e.Graphics.FillRectangle(brush, ClientRectangle);
     e.Graphics.DrawRectangle(new Pen(ColourHelper.HexStringToColor("9cbde8"), 1.0f), 0, 0, ClientSize.Width - 1, ClientSize.Height - 1);
 }