Exemple #1
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object can be used to retrieve data from input parameters and
        /// to store data in output parameters.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            switch (_status)
            {
            case Status.Idle:
                var botUrl = "";
                DA.GetData(_xIn, ref botUrl);
                if (_socket == null && !string.IsNullOrEmpty(botUrl))
                {
                    OpenSocket(botUrl);
                }
                DA.SetData(_resultOut, _data);
                break;

            case Status.Busy:
                if (_socket == null)
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "socket is null");
                    return;
                }
                _socket.Send(_data as string);
                _socket.Close();
                _socket = null;
                _status = Status.Idle;
                ExpireSolution(true);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }