Example #1
0
        /* ------------------------------------------ Server-Methoden ----------------------------------------------*/

        public void PopulateGrid(int simulationFactoryId)
        {
            ClientServerUtil csu = ClientServerUtil.getInstance();

            Sim.productMap productMap = csu.GetProducts(simulationFactoryId);

            if (productMap != null)
            {
                foreach (Sim.productMapEntry entry in productMap.productMap1.AsEnumerable())
                {
                    Sim.position  position = entry.key;
                    Sim.product[] products = entry.value;

                    for (int i = 0; i < products.Count(); i++)
                    {
                        Point3D point   = TransformServerToClientCoords(ChangeProductPoints(i, position));
                        Product product = GetProductByID(products[i].id);
                        if (product == null)
                        {
                            product = CreateProduct(products[i].id, point, point, products[i].name);
                            PlaceProduct(product);
                        }
                        else
                        {
                            product.position = point;
                            product.UpdateModelProperties(xOffset, yOffset);
                        }
                    }
                }
            }
        }
 public void populateGrid(SimulationServiceReference.productMap productMap)
 {
     foreach (SimulationServiceReference.productMapEntry entry in productMap.productMap1.AsEnumerable())
     {
         SimulationServiceReference.position  position = entry.key;
         SimulationServiceReference.product[] products = entry.value;
         string displayText = products.Length + "";
         for (int i = 0; i < products.Length; i += 1)
         {
             if (products[i] != null)
             {
                 displayText = displayText + "\n" + products[i].name;
             }
         }
         UIElement        textBox    = GridCanvas.getTextBox(displayText);
         List <UIElement> uiProducts = new List <UIElement>();
         uiProducts.Add(textBox);
         GridC.addProducts(uiProducts, position.x, position.y);
     }
 }