첨부 소스 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

TestProject.zip
다운로드

▶ MainForm.cs

using System;
using System.Windows.Forms;

using DevExpress.XtraEditors;
using DevExpress.XtraMap;

namespace TestProject
{
    /// <summary>
    /// 메인 폼
    /// </summary>
    public partial class MainForm : XtraForm
    {
        //////////////////////////////////////////////////////////////////////////////////////////////////// Field
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region Field

        /// <summary>
        /// 빙 맵 키
        /// </summary>
        private string bingKey = "INPUT YOUR BING KEY";

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
        ////////////////////////////////////////////////////////////////////////////////////////// Public

        #region 생성자 - MainForm()

        /// <summary>
        /// 생성자
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            this.bingMapDataProvider.BingKey = this.bingKey;

            this.bingGeocodeDataProvider.BingKey = this.bingKey;

            this.searchButton.Click += searchButton_Click;
        }

        #endregion

        //////////////////////////////////////////////////////////////////////////////////////////////////// Method
        ////////////////////////////////////////////////////////////////////////////////////////// Private

        #region 조회 버튼 클릭시 처리하기 - searchButton_Click(sender, e)

        /// <summary>
        /// 조회 버튼 클릭시 처리하기
        /// </summary>
        /// <param name="sender">이벤트 발생자</param>
        /// <param name="e">이벤트 인자</param>
        private void searchButton_Click(object sender, EventArgs e)
        {
            if(string.IsNullOrEmpty(this.latitudeTextEdit.Text))
            {
                MessageBox.Show("Latitude field should be filled.");

                return;
            }

            double latitude = double.Parse(this.latitudeTextEdit.Text);

            if((latitude > 90) || (latitude < -90))
            {
                MessageBox.Show("Latitude must be less than or equal to 90 and greater than or equal to - 90. Correct the input value.");

                return;
            }

            if(string.IsNullOrEmpty(this.longitudeTextEdit.Text))
            {
                MessageBox.Show("Longitude field should be filled.");

                return;
            }

            double longitude = double.Parse(this.longitudeTextEdit.Text);

            if((longitude > 180) || (longitude < -180))
            {
                MessageBox.Show("Longitude must be less than or equal to 180 and greater than or equal to - 180. Correct the input value.");

                return;
            }
           
            this.bingGeocodeDataProvider.RequestLocationInformation(new GeoPoint(latitude, longitude), null);
        }

        #endregion
    }
}
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요