예제 #1
0
        public CalculationPage()
        {
            this.InitializeComponent();
            CoilDeviced   = App.AnchorCollection;
            SensorDeviced = App.SensorCollection;
            double[] position = new double[3] {
                -10, 20, 0
            };
            CanvasPackage CatchCanvas = CreateDrawObj(position, 3);

            PlacePart.Children.Add(CatchCanvas.OwnCanvas);
            if (CoilDeviced != null)
            {
                for (var i = 0; i < CoilDeviced.Count; i++)
                {
                    CanvasPackage tempCanvasPackage = CreateDrawObj(CoilDeviced[i].Position, 0);
                    PlacePart.Children.Add(tempCanvasPackage.OwnCanvas);
                    EllipseContainer.Add(tempCanvasPackage.OwnEllipse);
                }
            }
            if (SensorDeviced != null)
            {
                for (var i = 0; i < SensorDeviced.Count; i++)
                {
                    CanvasPackage tempCanvasPackage = CreateDrawObj(SensorDeviced[i].Position, 1);
                    PlacePart.Children.Add(tempCanvasPackage.OwnCanvas);
                    EllipseContainer.Add(tempCanvasPackage.OwnEllipse);
                }
            }
        }
예제 #2
0
        private async void Move(object sender, RoutedEventArgs e)
        {
            double[] position = new double[3] {
                0, 0, 0
            };
            CanvasPackage CatchCanvas = CreateDrawObj(position, 1);

            PlacePart.Children.Add(CatchCanvas.OwnCanvas);
            EllipseContainer.Add(CatchCanvas.OwnEllipse);

            for (var i = 0; i < 20; i++)
            {
                position[0] += 1;
                SetPostion(EllipseContainer[0], position);
                await Task.Delay(TimeSpan.FromSeconds(0.005));
            }

            for (var i = 0; i < 20; i++)
            {
                position[1] += 1;
                SetPostion(EllipseContainer[0], position);
                await Task.Delay(TimeSpan.FromSeconds(0.005));
            }

            for (var i = 0; i < 20; i++)
            {
                position[2] += 1;
                SetPostion(EllipseContainer[0], position);
                await Task.Delay(TimeSpan.FromSeconds(0.005));
            }
        }
예제 #3
0
        public CanvasPackage CreateAnCanvas(double x, double y, int colorCase)
        {
            Canvas  testCanvas  = new Canvas();
            Ellipse testEllipse = CreateAnEllipse(colorCase);

            testCanvas.Children.Add(testEllipse);
            testEllipse.SetValue(Canvas.LeftProperty, x);
            testEllipse.SetValue(Canvas.TopProperty, y);
            CanvasPackage temp = new CanvasPackage(testCanvas, testEllipse);

            return(temp);
        }