Esempio n. 1
0
        public FrontPanelPanel(MainFrame parent, ComService comService)
            : base(parent)
        {
            _comService = comService;
            _comService.DataArrived += ComDataArrived;
            FlexGridSizer sizer = new FlexGridSizer(4, 0, 0);

            sizer.Add(new StaticText(this, "External\nVoltage", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
            _externalVoltage = new ValueDisplay(this) { Value = "0.0", Unit = "mV" };
            sizer.Add(_externalVoltage, 0, SizerFlag.All, 5);

            sizer.Add(new StaticText(this, "Load\nVoltage", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
            _loadVoltage = new ValueDisplay(this) { Value = "0.0", Unit = "mV" };
            sizer.Add(_loadVoltage, 0, SizerFlag.All, 5);

            sizer.Add(new StaticText(this, "External\nCurrent", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
            _externalCurrent = new ValueDisplay(this) { Value = "0.0", Unit = "mA" };
            sizer.Add(_externalCurrent, 0, SizerFlag.All, 5);

            sizer.Add(new StaticText(this, "Load\nCurrent", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
            _loadCurrent = new ValueDisplay(this) { Value = "0.0", Unit = "mV" };
            sizer.Add(_loadCurrent, 0, SizerFlag.All, 5);

            sizer.Add(0, 0);
            sizer.Add(0, 0);

            sizer.Add(new StaticText(this, "Target\nCurrent", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight), 0, SizerFlag.AlignCenterVertical | SizerFlag.All, 5);
            Panel targetCurrentPanel = new Panel(this);
            var targetCurrentSizer = new FlexGridSizer(2, 5, 5);
            _targetCurrentSet = new Button(targetCurrentPanel, ID_TargetCurrentSet, "Set");
            EvtButton(ID_TargetCurrentSet, (s, e) => SetTargetCurrent());
            _targetCurrent = new TextCtrl(targetCurrentPanel, "0.0mA", WxDefaultPosition, new Size(70, _targetCurrentSet.Size.Height));
            targetCurrentSizer.Add(_targetCurrent);
            targetCurrentSizer.Add(_targetCurrentSet);
            targetCurrentPanel.SetSizer(targetCurrentSizer);
            targetCurrentSizer.SetSizeHints(targetCurrentPanel);
            sizer.Add(targetCurrentPanel, 0, SizerFlag.All, 5);

            SetSizer(sizer);
            sizer.SetSizeHints(this);

            EvtDestroy((s, e) => { OnDestory(); e.Skip(true); });
            _targetCurrent.EvtSetFocus((s, e) => _targetCurrentHasFocus = true);
            _targetCurrent.EvtKillFocus((s, e) => _targetCurrentHasFocus = false);
        }
 public override bool OnInit()
 {
     MainFrame frame = new MainFrame();
     frame.Show(true);
     return base.OnInit();
 }