Example #1
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();
        }
        public WLPackageSendCanvas(GlobalGUIManager global) : base(global.rootcvs)
        {
            Width      = 20 + textBoxes.Length * WindowDistance + 20;
            Height     = 60;
            Background = Brushes.DarkGreen;
            //title
            Children.Add(new Label()
            {
                IsHitTestVisible = false, Content = "Wireless Package Sender", Margin = new Thickness(30, 0, 0, 0)
            });
            //remove
            AddClickPoint(new RemoveClickPoint(0, 0, this));

            for (int i = 0; i < textBoxes.Length; i++)
            {
                textBoxes[i] = new NumberOnlyTextBox()
                {
                    Margin = new Thickness(20 + WindowDistance * i, 20, 0, 0),
                    Width  = WindowDistance,
                };
                Children.Add(textBoxes[i]);
            }

            ClickEventPoint clickEventPoint = new ClickEventPoint(20, 40)
            {
                Width = 10, Height = 10, Background = Brushes.LightGreen
            };

            clickEventPoint.OnClickEvent += Submit;
            AddClickPoint(clickEventPoint);

            signal = new WirelessSignal(global.rootcvs, dev, 20, 20);
            Children.Add(signal);

            timer.Tick    += Update;
            timer.Interval = TimeSpan.FromMilliseconds(200);
            timer.Start();
        }