public KeyModule(VtmDev dev, GlobalGUIManager global) : base(dev, global) { Background = Brushes.Gray; //key to UI for (int i = 0; i < keys.Length; i++) { keys[i].Background = KeyColors[i]; EndTimes[i] = DateTime.Now; Children.Add(keys[i]); } //key click event for (int i = 0; i < VtmDev.TrigKeyCount; i++) { int x = i;//闭包 keys[i].OnHalfClickEvent += () => { VtmDev.TrigKeyPress(x); keys[x].Background = PressedColor; EndTimes[x] = DateTime.Now.AddMilliseconds(ShowDelayMs); //Active Timer UITimer.Start(); }; } VtmDev.TrigKeyActive = true; UITimer.Interval = TimeSpan.FromMilliseconds(ShowDelayMs / 3); UITimer.Tick += UpdateUI; }
public BlackModule(VtmDev dev, Position position, VtmDevCanvas canvas, GlobalGUIManager global) : base(dev, global) { this.global = global; VtmDevCanvas = canvas; Children.Add(new Label() { Content = position.ToString() }); this.position = position; //为所有此位置的模块创建menuItems foreach (var moduleInfo in from info in ModuleList where ModulePositionAttribute.GetPositionsByType(info.Item1).Contains(position) select info) { //moduleInfo中所有Type都是符合position的 MenuItem menuItem = new MenuItem() { Header = moduleInfo.Item2 }; menuItem.Click += AddItem; menuItem.Tag = moduleInfo.Item1; menuItems.Add(menuItem); } }
public VtmModuleBase(VtmDev dev, GlobalGUIManager global) { //IsHitTestVisible = false; Cursor = Cursors.Cross; Background = Brushes.Green; ContextMenu = new ContextMenu(); VtmDev = dev; }
public override void Update() { base.Update(); for (int i = 0; i < leds.Length; i++) { leds[i] = VtmDev.GetLedValue(i); } DrawLed(); }
public TemSensorModule(VtmDev dev, GlobalGUIManager global) : base(dev, global) { Children.Add(new Canvas() { Margin = new System.Windows.Thickness(SensorPosition.X, SensorPosition.Y, 0, 0), Width = 5, Height = 5, Background = Brushes.Yellow }); }
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)); */ }
public LedModule(VtmDev dev, GlobalGUIManager global) : base(dev, global) { //LED CANVAS for (int i = 0; i < leds.Length; i++) { LedCanvasControls[i] = new LedCanvasControl() { Width = 40, Height = 80, Margin = new Thickness(40 * i, 0, 0, 0), IsHitTestVisible = false }; Children.Add(LedCanvasControls[i]); } Background = Brushes.White; }
public EnvModuleBase(VtmDev dev, GlobalGUIManager global) : base(dev, global) { EnviromentCanvas.EnvSetableList.Add(this); rootcvs = global.rootcvs; }
public BpwsnModule(VtmDev dev, GlobalGUIManager global) : base(dev, global) { Background = Brushes.Gray; signal = new WirelessSignal(global.rootcvs, dev.WirelessPackageDevice, 20, 20); Children.Add(signal); }