diff --git a/PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml b/PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml new file mode 100644 index 0000000..e90e209 --- /dev/null +++ b/PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml @@ -0,0 +1,10 @@ + + + diff --git a/PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml.cs b/PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml.cs new file mode 100644 index 0000000..44e8f90 --- /dev/null +++ b/PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace MapFinder.Control +{ + /// + /// CustomWebBrowser.xaml에 대한 상호 작용 논리 + /// + public partial class CustomWebBrowser : UserControl + { + public System.Windows.Forms.WebBrowser WebBrowser { get; private set; } + + public CustomWebBrowser() + { + InitializeComponent(); + InitInstance(); + } + + private void InitInstance() + { + this.WebBrowser = new System.Windows.Forms.WebBrowser(); + wfhMain.Child = this.WebBrowser; + } + } +} diff --git a/PacticeSolution/MapFinder/MainWindow.xaml b/PacticeSolution/MapFinder/MainWindow.xaml index 81b0618..9d32b94 100644 --- a/PacticeSolution/MapFinder/MainWindow.xaml +++ b/PacticeSolution/MapFinder/MainWindow.xaml @@ -3,7 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:local="clr-namespace:MapFinder" + xmlns:local="clr-namespace:MapFinder" xmlns:control="clr-namespace:MapFinder.Control" mc:Ignorable="d" Title="Map Finder" Height="450" Width="800" Loaded="Window_Loaded"> @@ -43,9 +43,13 @@ Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3"/>--> - + Grid.ColumnSpan="3"/>--> + diff --git a/PacticeSolution/MapFinder/MainWindow.xaml.cs b/PacticeSolution/MapFinder/MainWindow.xaml.cs index e8ac4e7..a4821de 100644 --- a/PacticeSolution/MapFinder/MainWindow.xaml.cs +++ b/PacticeSolution/MapFinder/MainWindow.xaml.cs @@ -25,8 +25,6 @@ namespace MapFinder /// public partial class MainWindow : Window { - System.Windows.Forms.WebBrowser _webBrowser; - public MainWindow() { InitializeComponent(); @@ -35,10 +33,8 @@ namespace MapFinder private void InitInstance() { - _webBrowser = new System.Windows.Forms.WebBrowser(); - wfhWebBrowser.Child = _webBrowser; - _webBrowser.ScriptErrorsSuppressed = true; - _webBrowser.Navigate("https://map.naver.com/"); + wbMain.WebBrowser.ScriptErrorsSuppressed = true; + wbMain.WebBrowser.Navigate("https://map.naver.com/"); } private double[] ConvertToEPSG3857(double lat, double lng) @@ -65,14 +61,14 @@ namespace MapFinder return; double[] epsg3857 = ConvertToEPSG3857(selected.Lat, selected.Lng); - string url = $"http://map.naver.com/v5/search?c={epsg3857[0]},{epsg3857[1]},{18},0,0,0,dh"; + string url = $"http://map.naver.com/v5/search?c={epsg3857[0]},{epsg3857[1]},{17},0,0,0,dh"; //string url = $"https://google.co.kr/maps/@{selected.Lat},{selected.Lng},11z"; //string url = $"https://map.kakao.com/link/map/{selected.Name},{selected.Lat},{selected.Lng}"; //Uri uri = new Uri(url); //wbMain.Source = uri; - _webBrowser.Navigate(url); + wbMain.WebBrowser.Navigate(url); } private void Window_Loaded(object sender, RoutedEventArgs e) diff --git a/PacticeSolution/MapFinder/Utility/KakaoAPI.cs b/PacticeSolution/MapFinder/Utility/KakaoAPI.cs index c77548b..2fd3f34 100644 --- a/PacticeSolution/MapFinder/Utility/KakaoAPI.cs +++ b/PacticeSolution/MapFinder/Utility/KakaoAPI.cs @@ -21,7 +21,7 @@ namespace MapFinder.Utility string site = "https://dapi.kakao.com/v2/local/search/keyword.json"; string rquery = $"{site}?query={query}"; WebRequest request = WebRequest.Create(rquery); - string rkey = ""; // REST API KEY + string rkey = "69747398a2142e62bfdaefbab4adbc42"; // REST API KEY string header = $"KakaoAK {rkey}"; request.Headers.Add("Authorization", header);