Exemplo n.º 1
0
        public ComTempSensorCanvas(GlobalGUIManager global) : base(global.rootcvs)
        {
            EnviromentCanvas.EnvSetableList.Add(this);

            Width = 130; Height = 60;
            AddClickPoint(new RemoveClickPoint(0, 0, this));

            SetupBackgrountStyle();

            Label titleLabel = new Label()
            {
                Margin           = new Thickness(20, 1, 0, 0),
                Content          = "温度传感器",
                FontSize         = 20,
                IsHitTestVisible = false
            };

            Children.Add(titleLabel);



            comCanvas = new ComCanvas(30, 40, global, tempSensor);
            AddClickPoint(comCanvas);

            timer.Tick    += Update;
            timer.Interval = TimeSpan.FromMilliseconds(200);
            timer.Start();
        }
Exemplo n.º 2
0
        public WirelessComDevCanvas(GlobalGUIManager global) : base(global.rootcvs)
        {
            Height = 60;
            Width  = 180;
            SetupBackgrountStyle();

            //Remove
            AddClickPoint(new RemoveClickPoint(0, 0, this));

            //Title
            Children.Add(new Label()
            {
                Margin           = new Thickness(40, 5, 0, 0),
                IsHitTestVisible = false,
                Content          = "WirelessDev<->Com"
            });

            //WLCom


            //ComBase
            AddClickPoint(ComCanvas = new ComCanvas(40, 40, global, WLCom.comBase));

            //signal
            Children.Add(signal = new WirelessSignal(global.rootcvs, WLCom, 20, 20));
            //timer
            timer.Tick    += Update;
            timer.Interval = TimeSpan.FromMilliseconds(200);
            timer.Start();
        }
Exemplo n.º 3
0
        public ComRealDevCanvas(ComRealDevSetthings setthings, GlobalGUIManager global) : base(global.rootcvs)
        {
            this.global = global;

            Width  = 140;
            Height = 140;

            SetupBackgrountStyle();
            //title canvas
            Children.Add(new Label()
            {
                Margin           = new Thickness(20, 0, 0, 0),
                Content          = "RealCom",
                Foreground       = Brushes.Black,
                IsHitTestVisible = false,
                FontSize         = 18
            });
            //info canvas
            Children.Add(new Label()
            {
                Margin           = new Thickness(10, 30, 0, 0),
                IsHitTestVisible = false,
                Content          = String.Format("Com info:\nName:{0}\n" +
                                                 "bundrate:{1}\n" +
                                                 "databits:{2}\n" +
                                                 "stopbits:{3}\n" +
                                                 "parity:{4}", setthings.portName, setthings.baudrate, setthings.databits,
                                                 setthings.stopBits.ToString(), setthings.parity.ToString()),
                Foreground = Brushes.Black
            });

            try
            {
                com = new ComRealDev(setthings);
            }catch (Exception e)
            {
                //创建错误,清理退出
                Remove();
                throw e;
            }


            AddClickPoint(new RemoveClickPoint(0, 0, this));

            AddClickPoint(comCvs = new ComCanvas(100, 40, global, com));

            AddClickPoint(openButton);
            openButton.OnClickEvent  += ComOpen;
            warrButton.OnClickEvent  += ComOpen;
            closeButton.OnClickEvent += ComClose;
        }
Exemplo n.º 4
0
        public VtmDevCanvas(GlobalGUIManager global, String binpath) : base(global.rootcvs)
        {
            this.global = global;

            Width  = 500;
            Height = 360;
            SetupBackgrountStyle();

            AddClickPoint(new RemoveClickPoint(3, 3, this));
            AddClickPoint(RunButton);

            Children.Add(StatusLabel);
            //Dev
            dev = new VtmDev(binpath);
            //ComCanvas
            for (int i = 0; i < coms.Length; i++)
            {
                coms[i] = new ComCanvas(30 + 50 * i, 270, global, dev.GetComPortBase(i));
                AddClickPoint(coms[i]);
            }

            //title
            Children.Add(new Label()
            {
                Content          = "VTM-C",
                FontSize         = 30,
                Foreground       = Brushes.SlateBlue,
                Margin           = new Thickness(20, 290, 0, 0),
                IsHitTestVisible = false
            });


            timer.Tick    += Update;
            timer.Interval = TimeSpan.FromMilliseconds(50);

            RunButton.OnClickEvent += Run;

            //BlackModule
            BlackModule = VtmModule.BlackModule.NewBlackModules(this, global);
            foreach (var m in BlackModule)
            {
                Children.Add(m.Value);
                m.Value.FitPosition(m.Key);
            }

            /*
             * //LedModule
             * AddModule(typeof(LedModule));
             */
        }
Exemplo n.º 5
0
        public ComLedCanvas(GlobalGUIManager manager) : base(manager.rootcvs)
        {
            Width  = 100;
            Height = 80;


            SetupBackgrountStyle();

            Children.Add(new Label()
            {
                IsHitTestVisible = false,
                Content          = "ComLed",
                FontSize         = 16,
                Margin           = new Thickness(18, 0, 0, 0)
            });


            AddClickPoint(new RemoveClickPoint(3, 3, this));

            L1 = new Label()
            {
                Foreground       = Brushes.Red,
                Margin           = new Thickness(5, 20, 0, 0),
                FontSize         = 28,
                IsHitTestVisible = false
            };
            L2 = new Label()
            {
                Foreground       = Brushes.Red,
                Margin           = new Thickness(25, 20, 0, 0),
                FontSize         = 28,
                IsHitTestVisible = false
            };
            Lcount = new Label()
            {
                Margin = new Thickness(10, 55, 0, 0)
            };

            Children.Add(L1);
            Children.Add(L2);
            Children.Add(Lcount);

            timer.Interval = TimeSpan.FromMilliseconds(100);
            timer.Tick    += Update;

            timer.Start();

            //添加一个Com口连接点
            AddClickPoint(comCanvas = new ComCanvas(60, 40, manager, led.com));
        }
Exemplo n.º 6
0
        public WirelessComHostCanvas(GlobalGUIManager global) : base(global.rootcvs)
        {
            Width  = 250;
            Height = 60;

            SetupBackgrountStyle();

            rootcvs = global.rootcvs;
            maskcvs = global.maskcvs;
            //Title
            Children.Add(new Label()
            {
                IsHitTestVisible = false,
                Margin           = new Thickness(30, 5, 0, 0),
                Content          = "wireless(host) <-> com"
            });
            //Remove
            AddClickPoint(new RemoveClickPoint(0, 0, this));
            //Combase
            ComCanvas = new ComCanvas(30, 30, global, WLComHost.comBase);
            AddClickPoint(ComCanvas);

            //Range
            maskcvs.Children.Add(RangeCanvas = new Canvas()
            {
                Margin     = new Thickness(0, 0, 0, 0),
                Background = new DrawingBrush()
                {
                    Drawing = new GeometryDrawing()
                    {
                        Pen      = new Pen(Brushes.Red, 0.2),
                        Geometry = RangeGeometry = new EllipseGeometry(),
                        Brush    = new SolidColorBrush(Color.FromArgb(60, 100, 100, 10))
                    },
                },
                IsHitTestVisible = false
            });
            UpdateRange();

            timer.Tick    += Update;
            timer.Interval = TimeSpan.FromMilliseconds(100);
            timer.Start();
        }
Exemplo n.º 7
0
        public ComVirtualIncCanvas(GlobalGUIManager global) : base(global.rootcvs)
        {
            //初始化一个TitleCvs用于显示标题
            Children.Add(new Label()
            {
                IsHitTestVisible = false,
                Content          = "VirIncCom",
                FontSize         = 20,
                Margin           = new Thickness(25, 0, 0, 0)
            });

            Height = 80;
            Width  = 140;

            SetupBackgrountStyle();

            AddClickPoint(new RemoveClickPoint(3, 3, this));

            AddClickPoint(comCanvas = new ComCanvas(100, 35, global, com));

            AddClickPoint(Button = new ClickEventPoint(10, 30)
            {
                Height = 40,
                Width  = 60,
            });

            Button.Children.Add(new Label()
            {
                Margin           = new Thickness(0, 0, 0, 0),
                IsHitTestVisible = false,
                FontSize         = 20,
                Content          = "Send",
                Foreground       = Brushes.Green,
            });

            Button.SetupBackgrountStyle();

            Button.OnClickEvent += SendData;

            Children.Add(nextLabel);
            UpdateNextLabel();
        }
Exemplo n.º 8
0
 public ComConnectorCanvas(ComCanvas A, ComCanvas B, Canvas rootcvs) : base(A, B, rootcvs)
 {
     //调用驱动
     connector.Bind(A.ComBase, B.ComBase);
 }