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);
     }
 }
        public Point3D ChangeProductPoints(int counter, SimulationServiceReference.position position)
        {
            double x = position.x;
            double y = position.y;
            double z = 0;

            if(counter > 8 )
            {
                z = (counter / 9) * 0.3;
                counter -= ((counter / 9) * 9);
            }

            switch (counter)
            {
                case 0:
                    x -= 0.3;
                    y -= 0.3;
                    break;
                case 1:
                    y -= 0.3;
                    break;
                case 2:
                    x += 0.3;
                    y -= 0.3;
                    break;
                case 3:
                    x -= 0.3;
                    break;
                case 5:
                    x += 0.3;
                    break;
                case 6:
                    x -= 0.3;
                    y += 0.3;
                    break;
                case 7:
                    y += 0.3;
                    break;
                case 8:
                    x += 0.3;
                    y += 0.3;
                    break;
            }
            return new Point3D(x, y, z);
        }
 private void updateUIAfterLoadingSimulation(int height, int width, SimulationServiceReference.machineMap simulation)
 {
     ResizeGrid(height, width);
     grid.InitSimulationGrid(simulation);
     Show3DGrid();
 }