コード例 #1
0
        public WirelessSignal(Canvas rootcvs, WLDev dev, double x, double y)
        {
            this.IsHitTestVisible = false;
            this.rootcvs          = rootcvs;
            this.dev = dev;
            Margin   = new Thickness(x, y, 0, 0);
            rootcvs.Children.Add(line);
            DragCanvas.MouseMoveAction += UpdateMove;

            Children.Add(new Canvas()
            {
                Margin     = new Thickness(-VisualRadius, -VisualRadius, 0, 0),
                Width      = 2 * VisualRadius,
                Height     = 2 * VisualRadius,
                Background = new DrawingBrush()
                {
                    Drawing = new GeometryDrawing()
                    {
                        Brush    = Brushes.Brown,
                        Geometry = new EllipseGeometry(new Point(VisualRadius, VisualRadius), VisualRadius, VisualRadius)
                    }
                }
            });

            timer.Tick    += UpdateTick;
            timer.Interval = TimeSpan.FromMilliseconds(200);
            timer.Start();
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: frto027/IotSimulate
        public void TestMethod1()
        {
            byte[] b1 = new byte[1024], b2 = new byte[1024];

            for (int i = 0; i < 1024; i++)
            {
                b1[i] = (byte)i;
            }

            var dev  = new WLDev();
            var dev2 = new WLDev();
            var host = new WLHostDev();

            dev.SetHost(host);
            dev2.SetHost(host);
            dev.SendMessage(b1, 0, 1024);

            Assert.AreEqual(0, dev.RemainData);
            Assert.AreEqual(1024, dev2.RemainData);
            Assert.AreEqual(1024, host.RemainData);
        }