usercontrol wrapping
This commit is contained in:
10
PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml
Normal file
10
PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml
Normal file
@@ -0,0 +1,10 @@
|
||||
<UserControl x:Class="MapFinder.Control.CustomWebBrowser"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:MapFinder.Control"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<WindowsFormsHost Name="wfhMain"/>
|
||||
</UserControl>
|
37
PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml.cs
Normal file
37
PacticeSolution/MapFinder/Control/CustomWebBrowser.xaml.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// CustomWebBrowser.xaml에 대한 상호 작용 논리
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -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"/>-->
|
||||
<WindowsFormsHost Name="wfhWebBrowser"
|
||||
<!--<WindowsFormsHost Name="wfhWebBrowser"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="3"/>
|
||||
Grid.ColumnSpan="3"/>-->
|
||||
<control:CustomWebBrowser x:Name="wbMain"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="3"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@@ -25,8 +25,6 @@ namespace MapFinder
|
||||
/// </summary>
|
||||
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)
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user