80 lines
2.7 KiB
C#
80 lines
2.7 KiB
C#
|
|
using Plane.FormationCreator.Formation;
|
|
using Plane.FormationCreator.ViewModels;
|
|
using MahApps.Metro.Controls;
|
|
using Microsoft.Practices.ServiceLocation;
|
|
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.Configuration;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using Plane.Logging;
|
|
using GMap.NET;
|
|
using GMap.NET.MapProviders;
|
|
using GMap.NET.WindowsPresentation;
|
|
using Plane.FormationCreator.Maps;
|
|
|
|
namespace Plane.FormationCreator.Views
|
|
{
|
|
/// <summary>
|
|
/// LogWindow.xaml 的交互逻辑
|
|
/// </summary>
|
|
public partial class LogWindow : MetroWindow
|
|
{
|
|
public LogWindow(string log)
|
|
{
|
|
InitializeComponent();
|
|
|
|
|
|
textAppLog.Text = log;
|
|
textAppLog.SelectionStart = textAppLog.Text.Length;
|
|
textAppLog.ScrollToEnd();
|
|
var _logger = ServiceLocator.Current.GetInstance<ILogger>();
|
|
string loger = _logger.ReadLog();
|
|
textCopterLog.Text = loger;
|
|
textCopterLog.SelectionStart = textCopterLog.Text.Length;
|
|
|
|
|
|
try
|
|
{
|
|
System.Net.IPHostEntry e = System.Net.Dns.GetHostEntry("ditu.google.cn");
|
|
}
|
|
catch
|
|
{
|
|
mapControl.Manager.Mode = AccessMode.CacheOnly;
|
|
MessageBox.Show("No internet connection avaible, going to CacheOnly mode.", "GMap.NET Demo", MessageBoxButton.OK, MessageBoxImage.Warning);
|
|
}
|
|
|
|
mapControl.MapProvider = GMapProviders.GoogleChinaSatelliteMap; //google china 地图
|
|
mapControl.MinZoom = 2; //最小缩放
|
|
mapControl.MaxZoom = 23; //最大缩放
|
|
mapControl.Zoom = 19; //当前缩放
|
|
mapControl.ShowCenter = true; //不显示中心十字点
|
|
|
|
mapControl.DragButton = MouseButton.Left; //左键拖拽地图
|
|
mapControl.Position = new LatLng(40.07734857737275, 116.34323845862502).ToGCJ02();
|
|
|
|
mapControl.MouseLeftButtonDown += new MouseButtonEventHandler(mapControl_MouseLeftButtonDown);
|
|
|
|
}
|
|
|
|
void mapControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
Point clickPoint = e.GetPosition(mapControl);
|
|
PointLatLng point = mapControl.FromLocalToLatLng((int)clickPoint.X, (int)clickPoint.Y);
|
|
GMapMarker marker = new GMapMarker(point);
|
|
mapControl.Markers.Add(marker);
|
|
}
|
|
}
|
|
}
|