Ejemplo n.º 1
0
        public void SendCommand(XPlaneCommand command)
        {
            var dg = new XPDatagram();

            dg.Add("CMND");
            dg.Add(command.Command);

            client.Send(dg.Get(), dg.Len);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends a command
        /// </summary>
        /// <param name="command">Command to send</param>
        public void SendCommand(XPlaneCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            var dg = new XPDatagram("CMND", command.Command);

            client.Send(dg.Bytes, dg.Bytes.Length);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a command continously. Use return parameter to cancel the send cycle
        /// </summary>
        /// <param name="command">Command to send</param>
        /// <returns>Token to cancel the executing</returns>
        public CancellationTokenSource StartCommand(XPlaneCommand command)
        {
            var tokenSource = new CancellationTokenSource();

            Task.Run(() =>
            {
                while (!tokenSource.IsCancellationRequested)
                {
                    SendCommand(command);
                }
            }, tokenSource.Token);

            return(tokenSource);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sends a command
        /// </summary>
        /// <param name="command">Command to send</param>
        public void SendCommand(XPlaneCommand command)
        {
            if (command == null)
            {
                throw new ArgumentNullException(nameof(command));
            }

            var dg = new XPDatagram();

            dg.Add("CMND");
            dg.Add(command.Command);

            client.Send(dg.Get(), dg.Len);
        }