public PickUnitsPointsViewModel(Bitmap bitmap, IWhiskerPoint point1 = null, IWhiskerPoint point2 = null)
        {
            Image = bitmap;

            IGenericPoint genericPoint1 = ModelResolver.Resolve <IGenericPoint>();
            IGenericPoint genericPoint2 = ModelResolver.Resolve <IGenericPoint>();

            genericPoint1.PointId = 1;
            genericPoint2.PointId = 2;

            GenericPointViewModel viewModel1 = new GenericPointViewModel(genericPoint1);
            GenericPointViewModel viewModel2 = new GenericPointViewModel(genericPoint2);

            //IWhisker whisker = ModelResolver.Resolve<IWhisker>();
            //whisker.WhiskerId = 1;

            //IWhiskerPoint whiskerPoint1 = point1 ?? ModelResolver.Resolve<IWhiskerPoint>();
            //whiskerPoint1.Parent = whisker;
            ////whiskerPoint1.WhiskerId = 0;

            //IWhiskerPoint whiskerPoint2 = point2 ?? ModelResolver.Resolve<IWhiskerPoint>();
            //whiskerPoint2.Parent = whisker;
            ////whiskerPoint2.WhiskerId = 1;
            //whisker.WhiskerPoints = new IWhiskerPoint[] { whiskerPoint1, whiskerPoint2 };

            //WhiskerViewModel whiskerViewModel = new WhiskerViewModel(whisker);
            //WhiskerPointViewModel viewModel1 = new WhiskerPointViewModel(whiskerPoint1, whiskerViewModel);
            //WhiskerPointViewModel viewModel2 = new WhiskerPointViewModel(whiskerPoint2, whiskerViewModel);

            CanvasChildren.Add(viewModel1);
            CanvasChildren.Add(viewModel2);
        }
Example #2
0
        public void Preprocess(int maxEdgeLength, int singleTileWidth)
        {
            var rectVerticalShift = (int)((double)(maxEdgeLength - Height) / 2 * singleTileWidth);

            for (var i = 0; i < Height; ++i)
            {
                for (var j = 0; j < Width; ++j)
                {
                    if (!Content[i, j])
                    {
                        continue;
                    }
                    var rectLeftPosition = j * singleTileWidth;
                    var topRectPosition  = i * singleTileWidth + rectVerticalShift;
                    var rect             = new RectItem
                    {
                        FillColor   = Constants.BlockFillColor,
                        StrokeColor = Constants.BlockEdgeColor,
                        Width       = singleTileWidth,
                        Height      = singleTileWidth,
                        X           = rectLeftPosition,
                        Y           = topRectPosition
                    };
                    CanvasChildren.Add(rect);
                }
            }
        }
Example #3
0
        public Vm()
        {
            Steps.Add(0);
            Slider  = 100;
            _bugs   = new BitmapImage(bugsUri);
            _food   = new BitmapImage(foodUri);
            _poison = new BitmapImage(poisonUri);

            for (int i = 0; i < 100; i++)
            {
                Image t = new Image();
                t.Source = _bugs;
                CanvasChildren.Add(t);
                Canvas.SetLeft(CanvasChildren[i], 2000);
                Canvas.SetTop(CanvasChildren[i], 2000);
            }

            for (int i = 100; i < 200; i++)
            {
                Image t = new Image();
                t.Source = _food;
                CanvasChildren.Add(t);
                Canvas.SetLeft(CanvasChildren[i], 2000);
                Canvas.SetTop(CanvasChildren[i], 2000);
            }


            for (int i = 200; i < 300; i++)
            {
                Image t = new Image();
                t.Source = _poison;
                CanvasChildren.Add(t);
                Canvas.SetLeft(CanvasChildren[i], 2000);
                Canvas.SetTop(CanvasChildren[i], 2000);
            }

            for (int i = 300; i < 400; i++)
            {
                labels            = new TextBlock();
                labels.FontSize   = 12;
                labels.Foreground = Brushes.Red;
                Canvas.SetLeft(labels, 2000);
                Canvas.SetTop(labels, 2000);
                CanvasChildren.Add(labels);
            }

            World.Move        += Mouve;
            World.ReloadWorld += ReloadWorld;
            World.Create();
        }
Example #4
0
    /// <summary>
    /// Get canvas childrens
    /// </summary>
    public static void GetCanvasChildrens()
    {
        if (CanvasChildren.Count > 0)
        {
            foreach (var item in CanvasChildren)
            {
                CanvasChildren.Remove(item.Key);
            }
        }

        for (int i = 0; i < CanvasGO.transform.childCount - 1; i++)
        {
            CanvasChildren.Add(CanvasGO.transform.GetChild(i).name, CanvasGO.transform.GetChild(i).gameObject);
        }
    }
Example #5
0
        private void ParseXmlFile()
        {
            var openFileDialog = new OpenFileDialog()
            {
                Filter           = "XML files (*.xml)|*.xml",
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
            };

            if (openFileDialog.ShowDialog() == true)
            {
                var data = XmlParser <UkrainianCadastralExchangeFile> .ParseFile(openFileDialog.FileName);

                PraseInfoLandsPlot praseInfoLandsPlot = new PraseInfoLandsPlot(data);
                LandPlots = new ObservableCollection <LandPlot>(praseInfoLandsPlot.GetLandPlots());
                CanvasChildren.Clear();

                /////////////////////
                //CanvasChildren.AddRange(praseInfoLandsPlot.Polilines.Values.ToList());
                //AddMouseHandlr();


                //////////////////   Не працює коректно

                var tr = LandPlots.Select(e => e.Polygon).ToList();

                foreach (var item in LandPlots)
                {
                    item.Polygon.MouseUp += (s, e) =>
                    {
                        SelecLandPlot = item;
                        foreach (var item2 in LandPlots)
                        {
                            item2.Polygon.Fill = Brushes.White;
                        }
                        item.Polygon.Fill = Brushes.Gray;
                    };
                }
                CanvasChildren.AddRange(tr);
            }
        }