Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ID"></param>
        /// <param name="data"></param>
        /// <returns>Pushed @ </returns>

        public static void Push(string ID, params List <object>[] data)
        {
            CollectDataFromDyn fromDynamo = new CollectDataFromDyn();

            List <List <object> > containers = new List <List <object> >();

            for (int i = 0; i < data.Count(); i++)
            {
                List <object> d = new List <object>();
                for (int j = 0; j < data[i].Count; j++)
                {
                    if (data[i][j] == null)
                    {
                        continue;
                    }
                    d.Add(data[i][j]);
                }

                containers.Add(d);
            }

            DataContainer dc = fromDynamo.CollectData(containers);

            PushData pd = new PushData();

            pd.PushDataLocal(dc, ID);

            //return "Pushed @" +  string.Format("{0:HH:mm:ss tt}", DateTime.Now);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            //   bool _send = false;
            string _id           = "";
            int    threshold     = 0;
            int    ZUIInputCount = 0;

            //  DA.GetData(0, ref _send);
            DA.GetData(0, ref _id);

            for (int i = 0; i < Params.Input.Count; i++)
            {
                if (Params.Input[i].Name != "Data")
                {
                    threshold++;
                }
                if (Params.Input[i].Optional == true)
                {
                    ZUIInputCount++;
                }
            }


            List <int>            indexes           = new List <int>();
            List <List <object> > dataContainerTemp = new List <List <object> >();



            // Iterate through params and find ZUI parameters (if there are any)
            for (int i = 0; i < Params.Input.Count; i++)
            {
                if (Params.Input[i].Optional == true)
                {
                    // Set temp data
                    dataContainerTemp.Add(new List <object>());
                    indexes.Add(i);
                }
            }


            // Retrieve data from ZUI parameters ( if there are any)
            // and assign it to _dataContainers
            for (int i = 0; i < dataContainerTemp.Count; i++)
            {
                DA.GetDataList(indexes[i], dataContainerTemp[i]);
            }


            DataContainer dc = fromGrasshopper.CollectData(dataContainerTemp);

            PushData pd = new PushData();

            pd.PushDataLocal(dc, _id);

            Message = "Pushed @" + Environment.NewLine + string.Format("{0:HH:mm:ss tt}", DateTime.Now);
        }