Rev 2315 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2315 | Rev 2318 | ||
---|---|---|---|
Line 637... | Line 637... | ||
637 | 637 | ||
638 | private void MainMap_Loaded(object sender, RoutedEventArgs e) |
638 | private void MainMap_Loaded(object sender, RoutedEventArgs e) |
639 | { |
639 | { |
640 | MainMap.Manager.Mode = AccessMode.ServerAndCache; |
640 | MainMap.Manager.Mode = AccessMode.ServerAndCache; |
- | 641 | copter = new GMapMarker(MainMap.Position); |
|
641 | copter = new GMapMarker(MainMap.Position); |
642 | |
- | 643 | copter.Shape = new CustomMarkerCopter(this, copter, MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°"),"red"); |
|
- | 644 | if (comboBoxCopterColor.SelectionBoxItem != null) |
|
- | 645 | { |
|
- | 646 | string s = comboBoxCopterColor.SelectionBoxItem.ToString(); |
|
- | 647 | ((CustomMarkerCopter)(copter.Shape)).setColor(s); |
|
642 | copter.Shape = new CustomMarkerCopter(this, copter, MainMap.Position.Lat.ToString("0.#######°") + System.Environment.NewLine + MainMap.Position.Lng.ToString("0.#######°")); |
648 | } |
643 | copter.Offset = new System.Windows.Point(-18, -18); |
649 | copter.Offset = new System.Windows.Point(-18, -18); |
644 | copter.ZIndex = int.MaxValue; |
650 | copter.ZIndex = int.MaxValue; |
645 | MainMap.Markers.Add(copter); |
651 | MainMap.Markers.Add(copter); |
646 | copter.Position = MainMap.Position; |
652 | copter.Position = MainMap.Position; |
Line 1769... | Line 1775... | ||
1769 | if (_bGetWP) |
1775 | if (_bGetWP) |
1770 | { |
1776 | { |
1771 | if (data[1] == 1) |
1777 | if (data[1] == 1) |
1772 | { |
1778 | { |
1773 | dtWaypoints.Rows.Clear(); |
1779 | dtWaypoints.Rows.Clear(); |
- | 1780 | Dispatcher.Invoke(() => { |
|
1774 | foreach (GMapMarker p in MainMap.Markers) |
1781 | for (int k = 0; k < MainMap.Markers.Count;) |
1775 | { |
1782 | { |
- | 1783 | GMapMarker p = MainMap.Markers[k]; |
|
1776 | if (p.Shape.GetType() == typeof(CustomMarkerWP)) |
1784 | if (p.Shape.GetType() == typeof(CustomMarkerWP)) |
1777 | MainMap.Markers.Remove(p); |
1785 | MainMap.Markers.Remove(p); |
- | 1786 | else |
|
- | 1787 | k++; |
|
- | 1788 | } |
|
1778 | } |
1789 | }); |
1779 | } |
1790 | } |
1780 | DataRow dr = dtWaypoints.NewRow(); |
1791 | DataRow dr = dtWaypoints.NewRow(); |
1781 | dr = Waypoints.toDataRow(data, dr); |
1792 | dr = Waypoints.toDataRow(data, dr); |
1782 | dtWaypoints.Rows.Add(dr); |
1793 | dtWaypoints.Rows.Add(dr); |
- | 1794 | Dispatcher.Invoke(() => { |
|
1783 | GMapMarker wp = new GMapMarker(new PointLatLng((double)dr[3], (double)dr[4])); |
1795 | GMapMarker wp = new GMapMarker(new PointLatLng((double)dr[3], (double)dr[4])); |
1784 | wp.Shape = new CustomMarkerWP(this, wp, (string)dr[2],(int)dr[1]); |
1796 | wp.Shape = new CustomMarkerWP(this, wp, (string)dr[2],(int)dr[1]); |
1785 | _setMarkerColor(wp, (int)dr[1]); |
1797 | _setMarkerColor(wp, (int)dr[1]); |
1786 | MainMap.Markers.Add(wp); |
1798 | MainMap.Markers.Add(wp); |
- | 1799 | }); |
|
1787 | Dispatcher.Invoke(() => dgvWP.Items.Refresh()); |
1800 | Dispatcher.Invoke(() => dgvWP.Items.Refresh()); |
1788 | Dispatcher.Invoke(() => _iWPIndex = data[1]); |
1801 | Dispatcher.Invoke(() => _iWPIndex = data[1]); |
1789 | if (data[1] == data[0]) |
1802 | if (data[1] == data[0]) |
1790 | { |
1803 | { |
1791 | _bGetWP = false; |
1804 | _bGetWP = false; |
Line 2793... | Line 2806... | ||
2793 | } |
2806 | } |
2794 | } |
2807 | } |
2795 | } |
2808 | } |
2796 | }); |
2809 | }); |
2797 | } |
2810 | } |
- | 2811 | ||
- | 2812 | private void comboBoxCopterColor_DropDownClosed(object sender, EventArgs e) |
|
- | 2813 | { |
|
- | 2814 | Dispatcher.Invoke(() => { |
|
- | 2815 | if (comboBoxCopterColor.SelectionBoxItem != null) |
|
- | 2816 | { |
|
- | 2817 | string s = comboBoxCopterColor.SelectionBoxItem.ToString(); |
|
- | 2818 | ((CustomMarkerCopter)(copter.Shape)).setColor(s); |
|
- | 2819 | } |
|
- | 2820 | else |
|
- | 2821 | ((CustomMarkerCopter)(copter.Shape)).setColor("red"); |
|
- | 2822 | }); |
|
- | 2823 | } |
|
- | 2824 | ||
2798 | private void btnLoadWPLFile_Click(object sender, RoutedEventArgs e) |
2825 | private void btnLoadWPLFile_Click(object sender, RoutedEventArgs e) |
2799 | { |
2826 | { |
2800 | _readWPLFile(); |
2827 | _readWPLFile(); |
2801 | } |
2828 | } |
2802 | #endregion WP |
2829 | #endregion WP |