Rev 2419 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2419 | Rev 2421 | ||
---|---|---|---|
Line 407... | Line 407... | ||
407 | checkBoxAutoSetHP.IsChecked = _bAutoHome; |
407 | checkBoxAutoSetHP.IsChecked = _bAutoHome; |
408 | checkBoxFollowCopter.IsChecked = _bFollowCopter; |
408 | checkBoxFollowCopter.IsChecked = _bFollowCopter; |
409 | checkBoxGPXLog.IsChecked = _bGPXLog; |
409 | checkBoxGPXLog.IsChecked = _bGPXLog; |
410 | checkBoxShowWPRoute.IsChecked = _bShowWPRoute; |
410 | checkBoxShowWPRoute.IsChecked = _bShowWPRoute; |
Line -... | Line 411... | ||
- | 411 | ||
- | 412 | GridSettings.Visibility = Visibility.Visible; |
|
411 | 413 | GridData.Visibility = GridWP.Visibility = Visibility.Collapsed; |
|
412 | _initSerialCtrl(); |
414 | _initSerialCtrl(); |
413 | } |
415 | } |
414 | /// <summary> |
416 | /// <summary> |
415 | /// initialize the datatables |
417 | /// initialize the datatables |
Line 3654... | Line 3656... | ||
3654 | MainMap.Markers.Add(wpMarker); |
3656 | MainMap.Markers.Add(wpMarker); |
3655 | if (type == 0 || type == 3) |
3657 | if (type == 0 || type == 3) |
3656 | wpList.Add(p); |
3658 | wpList.Add(p); |
3657 | ((CustomMarkerWP)wpMarker.Shape).positionChanged += _updateDTWPPos; |
3659 | ((CustomMarkerWP)wpMarker.Shape).positionChanged += _updateDTWPPos; |
3658 | ((CustomMarkerWP)wpMarker.Shape).newPosition += _updateDTWPPosFin; |
3660 | ((CustomMarkerWP)wpMarker.Shape).newPosition += _updateDTWPPosFin; |
3659 | ((CustomMarkerWP)wpMarker.Shape).mouseCaptured += _WPMouseCatured; |
3661 | ((CustomMarkerWP)wpMarker.Shape).mouseCaptured += _WPMouseCaptured; |
3660 | }); |
3662 | }); |
3661 | return wpMarker; |
3663 | return wpMarker; |
3662 | } |
3664 | } |
3663 | bool _WPisMouseCaptured = false; |
3665 | bool _WPisMouseCaptured = false; |
3664 | void _WPMouseCatured(bool isCaptured) |
3666 | void _WPMouseCaptured(bool isCaptured) |
3665 | { |
3667 | { |
3666 | _WPisMouseCaptured = isCaptured; |
3668 | _WPisMouseCaptured = isCaptured; |
3667 | MainMap.CanDragMap = !isCaptured; |
3669 | MainMap.CanDragMap = !isCaptured; |
3668 | } |
3670 | } |
3669 | void _updateDTWPPos(CustomMarkerWP wp) |
3671 | void _updateDTWPPos(CustomMarkerWP wp) |
Line 3691... | Line 3693... | ||
3691 | GMapMarker p = ((GMapMarker)wp.DataContext); |
3693 | GMapMarker p = ((GMapMarker)wp.DataContext); |
3692 | if (p != null && index < dtWaypoints.Rows.Count) |
3694 | if (p != null && index < dtWaypoints.Rows.Count) |
3693 | { |
3695 | { |
3694 | dtWaypoints.Rows[index][3] = p.Position.Lat; |
3696 | dtWaypoints.Rows[index][3] = p.Position.Lat; |
3695 | dtWaypoints.Rows[index][4] = p.Position.Lng; |
3697 | dtWaypoints.Rows[index][4] = p.Position.Lng; |
- | 3698 | Dispatcher.Invoke(() => |
|
- | 3699 | { |
|
3696 | Dispatcher.Invoke(() => dgvWP.Items.Refresh()); |
3700 | dgvWP.Items.Refresh(); |
- | 3701 | dgvWP.SelectedIndex = index; |
|
- | 3702 | _dgvWPselectEditRow(); |
|
- | 3703 | }); |
|
- | 3704 | ||
3697 | } |
3705 | } |
Line 3698... | Line 3706... | ||
3698 | 3706 | ||
Line 3699... | Line 3707... | ||
3699 | } |
3707 | } |
Line 4010... | Line 4018... | ||
4010 | { |
4018 | { |
4011 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
4019 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
4012 | { |
4020 | { |
4013 | Dispatcher.Invoke(() => { |
4021 | Dispatcher.Invoke(() => { |
4014 | DataGridRow row; |
4022 | DataGridRow row; |
- | 4023 | dgvWP.UpdateLayout(); |
|
4015 | if (_wpEdit > -1 && _wpEdit < dgvWP.ItemContainerGenerator.Items.Count) |
4024 | if (_wpEdit > -1 && _wpEdit < dgvWP.ItemContainerGenerator.Items.Count) |
4016 | { |
4025 | { |
4017 | row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpEdit); |
4026 | row = (DataGridRow)dgvWP.ItemContainerGenerator.ContainerFromIndex(_wpEdit); |
4018 | row.Background = new SolidColorBrush(Colors.Transparent); |
4027 | row.Background = new SolidColorBrush(Colors.Transparent); |
4019 | row.BorderBrush = new SolidColorBrush(Colors.Transparent); |
4028 | row.BorderBrush = new SolidColorBrush(Colors.Transparent); |
Line 4031... | Line 4040... | ||
4031 | } |
4040 | } |
4032 | } |
4041 | } |
4033 | void _setWPEditFields(int index) |
4042 | void _setWPEditFields(int index) |
4034 | { |
4043 | { |
4035 | int iVal; |
4044 | int iVal; |
- | 4045 | lblWPEditIndex.Content = dtWaypoints.Rows[index][0].ToString(); |
|
4036 | cbWPEditType.SelectedIndex = (int)dtWaypoints.Rows[index][1]; |
4046 | cbWPEditType.SelectedIndex = (int)dtWaypoints.Rows[index][1]; |
4037 | tbWPEditPrefix.Text = dtWaypoints.Rows[index][2].ToString().Substring(0,1); |
4047 | tbWPEditPrefix.Text = dtWaypoints.Rows[index][2].ToString().Substring(0,1); |
4038 | tbWPEditLat.Text = dtWaypoints.Rows[index][3].ToString(); |
4048 | tbWPEditLat.Text = dtWaypoints.Rows[index][3].ToString(); |
4039 | tbWPEditLon.Text = dtWaypoints.Rows[index][4].ToString(); |
4049 | tbWPEditLon.Text = dtWaypoints.Rows[index][4].ToString(); |
4040 | tbWPEditAlt.Text = dtWaypoints.Rows[index][5].ToString(); |
4050 | tbWPEditAlt.Text = dtWaypoints.Rows[index][5].ToString(); |
Line 4116... | Line 4126... | ||
4116 | } |
4126 | } |
4117 | iVal = Convert.ToInt16(dtWaypoints.Rows[index][14]); |
4127 | iVal = Convert.ToInt16(dtWaypoints.Rows[index][14]); |
4118 | tbWPEditOut1.Text = iVal.ToString(); |
4128 | tbWPEditOut1.Text = iVal.ToString(); |
Line 4119... | Line 4129... | ||
4119 | 4129 | ||
- | 4130 | } |
|
- | 4131 | private void btnWPEditmoveUp_Click(object sender, RoutedEventArgs e) |
|
- | 4132 | { |
|
- | 4133 | if (dgvWP.SelectedIndex > 0 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count) |
|
- | 4134 | { |
|
- | 4135 | int index = dgvWP.SelectedIndex; |
|
- | 4136 | DataRow dr = dtWaypoints.Rows[index]; |
|
- | 4137 | DataRow newRow = dtWaypoints.NewRow(); |
|
- | 4138 | newRow.ItemArray = dr.ItemArray; |
|
- | 4139 | dtWaypoints.Rows.Remove(dr); |
|
- | 4140 | dtWaypoints.Rows.InsertAt(newRow, index - 1); |
|
- | 4141 | dtWaypoints.Rows[index][0] = 100; |
|
- | 4142 | dtWaypoints.Rows[index - 1][0] = index; |
|
- | 4143 | GMapMarker m1 = _findWPMarker(dtWaypoints.Rows[index - 1][2].ToString()); |
|
- | 4144 | GMapMarker m2 = _findWPMarker(dtWaypoints.Rows[index][2].ToString()); |
|
- | 4145 | dtWaypoints.Rows[index - 1][2] = dtWaypoints.Rows[index - 1][2].ToString().Substring(0, 1) + index.ToString(); |
|
- | 4146 | ((CustomMarkerWP)m1.Shape).text.Text = dtWaypoints.Rows[index - 1][2].ToString(); |
|
- | 4147 | dtWaypoints.Rows[index][0] = index + 1; |
|
- | 4148 | dtWaypoints.Rows[index][2] = dtWaypoints.Rows[index][2].ToString().Substring(0, 1) + (index+1).ToString(); |
|
- | 4149 | ((CustomMarkerWP)m2.Shape).text.Text = dtWaypoints.Rows[index][2].ToString(); |
|
- | 4150 | dgvWP.Items.Refresh(); |
|
- | 4151 | dgvWP.SelectedIndex = index - 1; |
|
- | 4152 | _dgvWPselectEditRow(); |
|
- | 4153 | PointLatLng p = wpList[index]; |
|
- | 4154 | wpList.RemoveAt(index); |
|
- | 4155 | wpList.Insert(index - 1, p); |
|
- | 4156 | MainMap.Markers.Remove(mRouteWP); |
|
- | 4157 | _routeUpdate(); |
|
- | 4158 | } |
|
- | 4159 | } |
|
- | 4160 | ||
- | 4161 | private void btnWPEditmoveDown_Click(object sender, RoutedEventArgs e) |
|
- | 4162 | { |
|
- | 4163 | if (dgvWP.SelectedIndex > -1 && dgvWP.SelectedIndex < dtWaypoints.Rows.Count - 1) |
|
- | 4164 | { |
|
- | 4165 | int index = dgvWP.SelectedIndex; |
|
- | 4166 | DataRow dr = dtWaypoints.Rows[index]; |
|
- | 4167 | DataRow newRow = dtWaypoints.NewRow(); |
|
- | 4168 | newRow.ItemArray = dr.ItemArray; |
|
- | 4169 | dtWaypoints.Rows.Remove(dr); |
|
- | 4170 | dtWaypoints.Rows.InsertAt(newRow, index + 1); |
|
- | 4171 | dtWaypoints.Rows[index][0] = 100; |
|
- | 4172 | dtWaypoints.Rows[index + 1][0] = index + 2; |
|
- | 4173 | GMapMarker m1 = _findWPMarker(dtWaypoints.Rows[index + 1][2].ToString()); |
|
- | 4174 | GMapMarker m2 = _findWPMarker(dtWaypoints.Rows[index][2].ToString()); |
|
- | 4175 | dtWaypoints.Rows[index + 1][2] = dtWaypoints.Rows[index + 1][2].ToString().Substring(0, 1) + (index+2).ToString(); |
|
- | 4176 | ((CustomMarkerWP)m1.Shape).text.Text = dtWaypoints.Rows[index + 1][2].ToString(); |
|
- | 4177 | dtWaypoints.Rows[index][0] = index + 1; |
|
- | 4178 | dtWaypoints.Rows[index][2] = dtWaypoints.Rows[index][2].ToString().Substring(0, 1) + (index+1).ToString(); |
|
- | 4179 | ((CustomMarkerWP)m2.Shape).text.Text = dtWaypoints.Rows[index][2].ToString(); |
|
- | 4180 | dgvWP.Items.Refresh(); |
|
- | 4181 | dgvWP.SelectedIndex = index + 1; |
|
- | 4182 | _dgvWPselectEditRow(); |
|
- | 4183 | PointLatLng p = wpList[index]; |
|
- | 4184 | wpList.RemoveAt(index); |
|
- | 4185 | wpList.Insert(index + 1, p); |
|
- | 4186 | MainMap.Markers.Remove(mRouteWP); |
|
- | 4187 | _routeUpdate(); |
|
- | 4188 | } |
|
- | 4189 | ||
Line 4120... | Line 4190... | ||
4120 | } |
4190 | } |
4121 | 4191 | ||
4122 | private void btnEditWPSave_Click(object sender, RoutedEventArgs e) |
4192 | private void btnEditWPSave_Click(object sender, RoutedEventArgs e) |
4123 | { |
4193 | { |