コード例 #1
0
        private void UpdateInteractiveElements()
        {
            inputManager.SetFlags(droneControl.IsConnected, droneControl.IsEmergency, droneControl.IsFlying, droneControl.IsHovering);

            if (!droneControl.IsConnected && !droneControl.IsConnecting)
            {
                buttonConnect.IsEnabled = true;
            }
            else
            {
                buttonConnect.IsEnabled = false;
            }
            if (droneControl.IsConnected)
            {
                buttonShutdown.IsEnabled = true;
            }
            else
            {
                buttonShutdown.IsEnabled = false;
            }

            if (droneControl.CanTakeoff || droneControl.CanLand)
            {
                buttonCommandTakeoff.IsEnabled = true;
            }
            else
            {
                buttonCommandTakeoff.IsEnabled = false;
            }
            if (droneControl.CanEnterHoverMode || droneControl.CanLeaveHoverMode)
            {
                buttonCommandHover.IsEnabled = true;
            }
            else
            {
                buttonCommandHover.IsEnabled = false;
            }
            if (droneControl.CanCallEmergency)
            {
                buttonCommandEmergency.IsEnabled = true;
            }
            else
            {
                buttonCommandEmergency.IsEnabled = false;
            }
            if (droneControl.CanSendFlatTrim)
            {
                buttonCommandFlatTrim.IsEnabled = true;
            }
            else
            {
                buttonCommandFlatTrim.IsEnabled = false;
            }
            if (droneControl.IsCommandPossible(new SwitchCameraCommand(DroneCameraMode.NextMode)) && !videoRecorder.IsVideoCaptureRunning && !videoRecorder.IsCompressionRunning)
            {
                buttonCommandChangeCamera.IsEnabled = true;
            }
            else
            {
                buttonCommandChangeCamera.IsEnabled = false;
            }

            if (!droneControl.IsFlying)
            {
                buttonCommandTakeoff.Content = "Take off";
            }
            else
            {
                buttonCommandTakeoff.Content = "Land";
            }
            if (!droneControl.IsHovering)
            {
                buttonCommandHover.Content = "Start hover";
            }
            else
            {
                buttonCommandHover.Content = "Stop hover";
            }

            if (droneControl.IsConnected)
            {
                buttonSnapshot.IsEnabled = true;
            }
            else
            {
                buttonSnapshot.IsEnabled = false;
            }
            if (!droneControl.IsConnected || videoRecorder.IsVideoCaptureRunning || videoRecorder.IsCompressionRunning)
            {
                checkBoxVideoCompress.IsEnabled = false;
            }
            else
            {
                checkBoxVideoCompress.IsEnabled = true;
            }
            if (CanCaptureVideo && !videoRecorder.IsVideoCaptureRunning && !videoRecorder.IsCompressionRunning)
            {
                buttonVideoStart.IsEnabled = true;
            }
            else
            {
                buttonVideoStart.IsEnabled = false;
            }
            if (CanCaptureVideo && videoRecorder.IsVideoCaptureRunning && !videoRecorder.IsCompressionRunning)
            {
                buttonVideoEnd.IsEnabled = true;
            }
            else
            {
                buttonVideoEnd.IsEnabled = false;
            }

            if (droneControl.IsConnected && !droneControl.IsFlying)
            {
                buttonShowConfig.IsEnabled = true;
            }
            else
            {
                buttonShowConfig.IsEnabled = false;
            }
            if (!droneControl.IsConnected && !droneControl.IsConnecting)
            {
                buttonGeneralSettings.IsEnabled = true;
            }
            else
            {
                buttonGeneralSettings.IsEnabled = false;
            }
            if (!droneControl.IsConnected && !droneControl.IsConnecting)
            {
                buttonInputSettings.IsEnabled = true;
            }
            else
            {
                buttonInputSettings.IsEnabled = false;
            }

            if (videoRecorder.IsCompressionRunning)
            {
                labelVideoStatus.Content = "Compressing";
            }
            else if (videoRecorder.IsVideoCaptureRunning)
            {
                labelVideoStatus.Content = "Recording";
            }
            else
            {
                labelVideoStatus.Content = "Idling ...";
            }
        }
コード例 #2
0
        private void UpdateInteractiveElements()
        {
            inputManager.SetFlags(arDroneControl.IsConnected, arDroneControl.IsEmergency, arDroneControl.IsFlying, arDroneControl.IsHovering);

            if (arDroneControl.CanConnect)
            {
                buttonConnect.IsEnabled = true;
            }
            else
            {
                buttonConnect.IsEnabled = false;
            }
            if (arDroneControl.CanDisconnect)
            {
                buttonShutdown.IsEnabled = true;
            }
            else
            {
                buttonShutdown.IsEnabled = false;
            }

            if (arDroneControl.CanTakeoff || arDroneControl.CanLand)
            {
                buttonCommandTakeoff.IsEnabled = true;
            }
            else
            {
                buttonCommandTakeoff.IsEnabled = false;
            }
            if (arDroneControl.CanEnterHoverMode || arDroneControl.CanLeaveHoverMode)
            {
                buttonCommandHover.IsEnabled = true;
            }
            else
            {
                buttonCommandHover.IsEnabled = false;
            }
            if (arDroneControl.CanCallEmergency)
            {
                buttonCommandEmergency.IsEnabled = true;
            }
            else
            {
                buttonCommandEmergency.IsEnabled = false;
            }
            if (arDroneControl.CanSendFlatTrim)
            {
                buttonCommandFlatTrim.IsEnabled = true;
            }
            else
            {
                buttonCommandFlatTrim.IsEnabled = false;
            }
            if (arDroneControl.CanChangeCamera && !videoRecorder.IsVideoCaptureRunning && !videoRecorder.IsCompressionRunning)
            {
                buttonCommandChangeCamera.IsEnabled = true;
            }
            else
            {
                buttonCommandChangeCamera.IsEnabled = false;
            }


            if (!arDroneControl.IsFlying)
            {
                buttonCommandTakeoff.Content = "Take off";
            }
            else
            {
                buttonCommandTakeoff.Content = "Land";
            }
            if (!arDroneControl.IsHovering)
            {
                buttonCommandHover.Content = "Start hover";
            }
            else
            {
                buttonCommandHover.Content = "Stop hover";
            }

            if (arDroneControl.IsConnected)
            {
                buttonSnapshot.IsEnabled = true;
            }
            else
            {
                buttonSnapshot.IsEnabled = false;
            }
            if (!arDroneControl.IsConnected || videoRecorder.IsVideoCaptureRunning || videoRecorder.IsCompressionRunning)
            {
                checkBoxVideoCompress.IsEnabled = false;
            }
            else
            {
                checkBoxVideoCompress.IsEnabled = true;
            }
            if (CanCaptureVideo && !videoRecorder.IsVideoCaptureRunning && !videoRecorder.IsCompressionRunning)
            {
                buttonVideoStart.IsEnabled = true;
            }
            else
            {
                buttonVideoStart.IsEnabled = false;
            }
            if (CanCaptureVideo && videoRecorder.IsVideoCaptureRunning && !videoRecorder.IsCompressionRunning)
            {
                buttonVideoEnd.IsEnabled = true;
            }
            else
            {
                buttonVideoEnd.IsEnabled = false;
            }


            if (videoRecorder.IsCompressionRunning)
            {
                labelVideoStatus.Content = "Compressing";
            }
            else if (videoRecorder.IsVideoCaptureRunning)
            {
                labelVideoStatus.Content = "Recording";
            }
            else
            {
                labelVideoStatus.Content = "Idling ...";
            }
        }