Пример #1
0
        private void CustomDataGridView_KeyPress(object sender, KeyPressEventArgs e)
        {
            FormInputText fit = new FormInputText();

            fit.FilterText = e.KeyChar.ToString();
            if (fit.ShowDialog() == DialogResult.OK)
            {
                var filterField = this.Columns[CurrentColumn].Name;
                (DataSource as DataTable).DefaultView.RowFilter = String.Format("[{0}] LIKE '%{1}%'", filterField, fit.FilterText);
            }

            e.Handled = true;
        }
Пример #2
0
        private void ButtonTakeOff_Click(object sender, EventArgs e)
        {
            if (InterfaceController.Instance.GetCurrentVehicle() is null)
            {
                return;
            }

            FormInputText f = new FormInputText(InputType.ALT);

            if (f.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (f.Value == null)
            {
                // invalid value.
                MessageBox.Show("Invalid value");
                return;
            }

            float alt = (float)f.Value;

            if (!InterfaceController.Instance.GetCurrentVehicle().IsArmed)
            {
                // set mode to stabilize for arming.
                var mode = InterfaceController.Instance.GetCurrentVehicle().SetCopterMode(PeachModel.Mavlink.Ardupilotmega.MavEnums.COPTER_MODE.COPTER_MODE_STABILIZE);

                bool arm = InterfaceController.Instance.GetCurrentVehicle().SendCommandLong(400, 1, 21196, 0, 0, 0, 0, 0);
            }

            // set mode to guided for take off.
            var guided = InterfaceController.Instance.GetCurrentVehicle().SetCopterMode(PeachModel.Mavlink.Ardupilotmega.MavEnums.COPTER_MODE.COPTER_MODE_GUIDED);

            bool r = InterfaceController.Instance.GetCurrentVehicle().SendCommandLong(22, 0, 0, 0, 0, 0, 0, alt);
        }