예제 #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);
        }
예제 #2
0
    public static Sizer MyDialogFunc(Window parent, bool call_fit, bool set_sizer)
    {
        BoxSizer item0 = new BoxSizer(Orientation.wxVERTICAL);

        StaticBox      item2 = new StaticBox(parent, -1, "Controls will remember their values");
        StaticBoxSizer item1 = new StaticBoxSizer(item2, Orientation.wxVERTICAL);

        FlexGridSizer item3 = new FlexGridSizer(0, 2, 0, 0);

        item3.AddGrowableCol(0);
        item3.AddGrowableCol(1);

        StaticText item4 = new StaticText(parent, ID_TEXT, "wxSpinCtrl:", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item4.Name = "TestName";
        item3.Add(item4, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        SpinCtrl item5 = new SpinCtrl(parent, ID_MY_NUMBER, "0", Window.wxDefaultPosition, new Size(130, -1), SpinCtrl.wxSP_ARROW_KEYS | SpinCtrl.wxSP_WRAP, 0, 100, 0);

        item3.Add(item5, 0, Stretch.wxGROW | Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        StaticText item6 = new StaticText(parent, ID_TEXT, "wxTextCtrl:", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item3.Add(item6, 0, Alignment.wxALIGN_RIGHT | Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        TextCtrl item7 = new TextCtrl(parent, ID_MY_TEXT, "", Window.wxDefaultPosition, new Size(130, -1), 0);

        item3.Add(item7, 0, Stretch.wxGROW | Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        item1.Add(item3, 1, Stretch.wxGROW | Direction.wxALL, 5);

        item0.Add(item1, 0, Stretch.wxGROW | Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        StaticLine item8 = new StaticLine(parent, ID_LINE, Window.wxDefaultPosition, new Size(300, -1), StaticLine.wxLI_HORIZONTAL);

        item0.Add(item8, 0, Stretch.wxGROW | Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        Button item9 = new Button(parent, Window.wxID_OK, "OK", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item0.Add(item9, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        if (set_sizer)
        {
            parent.SetSizer(item0);
            if (call_fit)
            {
                item0.SetSizeHints(parent);
            }
        }

        return(item0);
    }
예제 #3
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);
        }
예제 #4
0
    public static Sizer MyDialogFunc( Window parent, bool call_fit, bool set_sizer )
    {
        BoxSizer item0 = new BoxSizer( Orientation.wxVERTICAL );

        StaticBox item2 = new StaticBox( parent, -1, "Controls will remember their values" );
        StaticBoxSizer item1 = new StaticBoxSizer( item2, Orientation.wxVERTICAL );

        FlexGridSizer item3 = new FlexGridSizer( 0, 2, 0, 0 );
        item3.AddGrowableCol( 0 );
        item3.AddGrowableCol( 1 );

        StaticText item4 = new StaticText( parent, ID_TEXT, "wxSpinCtrl:", Window.wxDefaultPosition, Window.wxDefaultSize, 0 );
        item4.Name = "TestName";
        item3.Add( item4, 0, Alignment.wxALIGN_CENTER|Direction.wxALL, 5 );

        SpinCtrl item5 = new SpinCtrl( parent, ID_MY_NUMBER, "0", Window.wxDefaultPosition, new Size(130,-1), SpinCtrl.wxSP_ARROW_KEYS|SpinCtrl.wxSP_WRAP, 0, 100, 0 );
        item3.Add( item5, 0, Stretch.wxGROW|Alignment.wxALIGN_CENTER_VERTICAL|Direction.wxALL, 5 );

        StaticText item6 = new StaticText( parent, ID_TEXT, "wxTextCtrl:", Window.wxDefaultPosition, Window.wxDefaultSize, 0 );
        item3.Add( item6, 0, Alignment.wxALIGN_RIGHT|Alignment.wxALIGN_CENTER_VERTICAL|Direction.wxALL, 5 );

        TextCtrl item7 = new TextCtrl( parent, ID_MY_TEXT, "", Window.wxDefaultPosition, new Size(130,-1), 0 );
        item3.Add( item7, 0, Stretch.wxGROW|Alignment.wxALIGN_CENTER_VERTICAL|Direction.wxALL, 5 );

        item1.Add( item3, 1, Stretch.wxGROW|Direction.wxALL, 5 );

        item0.Add( item1, 0, Stretch.wxGROW|Alignment.wxALIGN_CENTER_VERTICAL|Direction.wxALL, 5 );

        StaticLine item8 = new StaticLine( parent, ID_LINE, Window.wxDefaultPosition, new Size(300,-1), StaticLine.wxLI_HORIZONTAL );
        item0.Add( item8, 0, Stretch.wxGROW|Alignment.wxALIGN_CENTER_VERTICAL|Direction.wxALL, 5 );

        Button item9 = new Button( parent, Window.wxID_OK, "OK", Window.wxDefaultPosition, Window.wxDefaultSize, 0 );
        item0.Add( item9, 0, Alignment.wxALIGN_CENTER|Direction.wxALL, 5 );

        if (set_sizer)
        {
            parent.SetSizer( item0 );
            if (call_fit)
                item0.SetSizeHints( parent );
        }

        return item0;
    }
예제 #5
0
        public ValueDisplay(Window parent)
            : base(parent, WxDefaultPosition, WxDefaultSize, WindowStyles.BorderSimple)
        {
            BackgroundColour = Colour.WhiteColour;

            var sizer = new FlexGridSizer(2, 5, 5);

            Font displayFont = new Font(30, FontFamily.wxDefault, FontStyle.Normal, FontWeight.Normal);

            _text = new StaticText(this, "10.000", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight | WindowStyles.StaticTextNoAutoResize);
            _text.SetFont(displayFont);
            sizer.Add(_text);

            _unit = new StaticText(this, "mV");
            sizer.Add(_unit, 1, SizerFlag.AlignBottom | SizerFlag.AlignRight | SizerFlag.Right | SizerFlag.Bottom, 5);

            SetSizer(sizer);
            sizer.SetSizeHints(this);
        }
예제 #6
0
        public ValueDisplay(Window parent)
            : base(parent, WxDefaultPosition, WxDefaultSize, WindowStyles.BorderSimple)
        {
            BackgroundColour = Colour.WhiteColour;

            var sizer = new FlexGridSizer(2, 5, 5);

            Font displayFont = new Font(30, FontFamily.wxDefault, FontStyle.Normal, FontWeight.Normal);

            _text = new StaticText(this, "10.000", WxDefaultPosition, WxDefaultSize, WindowStyles.AlignRight | WindowStyles.StaticTextNoAutoResize);
            _text.SetFont(displayFont);
            sizer.Add(_text);

            _unit = new StaticText(this, "mV");
            sizer.Add(_unit, 1, SizerFlag.AlignBottom | SizerFlag.AlignRight | SizerFlag.Right | SizerFlag.Bottom, 5);

            SetSizer(sizer);
            sizer.SetSizeHints(this);
        }
예제 #7
0
    public static Sizer frmCadAssuntos(Window parent, bool call_fit, bool set_sizer)
    {
        BoxSizer item0 = new BoxSizer(Orientation.wxVERTICAL);

        FlexGridSizer item1 = new FlexGridSizer(0, 2, 0, 0);

        item1.AddGrowableCol(0);

        FlexGridSizer item2 = new FlexGridSizer(0, 1, 0, 0);

        item2.AddGrowableRow(0);
        item2.AddGrowableRow(1);

        BoxSizer item3 = new BoxSizer(Orientation.wxVERTICAL);

        StaticText item4 = new StaticText(parent, LAB_CODIGO, "Código:", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item4.Name = "labCodigo";
        item3.Add(item4, 5, Alignment.wxALIGN_CENTER_VERTICAL, 0);

        TextCtrl item5 = new TextCtrl(parent, EDT_CODIGO, "", Window.wxDefaultPosition, new Size(80, -1), 0);

        item5.Name = "edtCodigo";
        item3.Add(item5, 0, Alignment.wxALIGN_CENTER, 0);

        item2.Add(item3, 0, Alignment.wxALIGN_CENTER_VERTICAL, 0);

        BoxSizer item6 = new BoxSizer(Orientation.wxVERTICAL);

        StaticText item7 = new StaticText(parent, LAB_DESCRICAO, "Assunto:", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item7.Name = "labDescricao";
        item6.Add(item7, 5, Alignment.wxALIGN_CENTER_VERTICAL, 0);

        TextCtrl item8 = new TextCtrl(parent, EDT_DESCRICAO, "", Window.wxDefaultPosition, new Size(200, -1), 0);

        item8.Name = "edtDescricao";
        item6.Add(item8, 0, Alignment.wxALIGN_CENTER, 0);

        item2.Add(item6, 0, Alignment.wxALIGN_CENTER, 0);

        item1.Add(item2, 0, Alignment.wxALIGN_CENTER_HORIZONTAL | Direction.wxALL, 5);

        BoxSizer item9 = new BoxSizer(Orientation.wxVERTICAL);

        Button item10 = new Button(parent, BTN_PESQUISAR, "Pesquisar", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item10.SetDefault();
        item10.Name = "btnPesquisar";
        item9.Add(item10, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 0);

        Button item11 = new Button(parent, BTN_ANTERIOR, "Anterior", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item11.Name    = "btnAnterior";
        item11.Enabled = false;
        item9.Add(item11, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        Button item12 = new Button(parent, BTN_PROXIMO, "Próximo", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item12.Name    = "btnProximo";
        item12.Enabled = false;
        item9.Add(item12, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 0);

        item1.Add(item9, 0, Alignment.wxALIGN_CENTER_HORIZONTAL | Direction.wxALL, 5);

        item0.Add(item1, 0, Stretch.wxGROW | Alignment.wxALIGN_CENTER_VERTICAL, 0);

        BoxSizer item13 = new BoxSizer(Orientation.wxHORIZONTAL);

        Button item14 = new Button(parent, BTN_SALVAR, "Salvar", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item14.Name    = "btnSalvar";
        item14.Enabled = false;
        item13.Add(item14, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        Button item15 = new Button(parent, BTN_EXCLUIR, "Excluir", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item15.Name    = "btnExcluir";
        item15.Enabled = false;
        item13.Add(item15, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        Button item16 = new Button(parent, BTN_LIMPAR, "Limpar", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item16.Name = "btnLimpar";
        item13.Add(item16, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        Button item17 = new Button(parent, BTN_FECHAR, "Fechar", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item17.Name = "btnFechar";
        item13.Add(item17, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        item0.Add(item13, 0, Alignment.wxALIGN_RIGHT | Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        if (set_sizer)
        {
            // parent.SetAutoLayout( true );
            parent.SetSizer(item0);
            if (call_fit)
            {
                item0.Fit(parent);
                item0.SetSizeHints(parent);
            }
        }

        return(item0);
    }
예제 #8
0
    public static Sizer frmConAssuntos(Window parent, bool call_fit, bool set_sizer)
    {
        FlexGridSizer item0 = new FlexGridSizer(0, 1, 0, 0);

        item0.AddGrowableRow(1);

        BoxSizer item1 = new BoxSizer(Orientation.wxHORIZONTAL);

        BoxSizer item2 = new BoxSizer(Orientation.wxVERTICAL);

        StaticText item3 = new StaticText(parent, LAB_DESCRICAO, "Assunto:", Window.wxDefaultPosition, new Size(40, -1), 0);

        item3.Name = "labDescricao";
        item2.Add(item3, 5, Alignment.wxALIGN_CENTER_VERTICAL, 5);

        TextCtrl item4 = new TextCtrl(parent, EDT_DESCRICAO, "", Window.wxDefaultPosition, new Size(250, -1), 0);

        item4.Name = "edtDescricao";
        item2.Add(item4, 0, Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 0);

        item1.Add(item2, 0, Alignment.wxALIGN_CENTER_HORIZONTAL | Direction.wxALL, 5);

        Button item5 = new Button(parent, BTN_PESQUISAR, "Pesquisar", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item5.Name = "btnPesquisar";
        item1.Add(item5, 0, Alignment.wxALIGN_BOTTOM | Alignment.wxALIGN_CENTER_HORIZONTAL | Direction.wxALL, 5);

        item0.Add(item1, 0, Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        item6.Name = "gridConsulta";
        item0.Add(item6, 0, Stretch.wxGROW, 0);

        FlexGridSizer item7 = new FlexGridSizer(0, 2, 0, 0);

        item7.AddGrowableCol(0);

        BoxSizer item8 = new BoxSizer(Orientation.wxHORIZONTAL);

        StaticText item9 = new StaticText(parent, LAB_REGISTROS, "Registro: 0 de 0", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item9.Name = "labRegistros";
        item8.Add(item9, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        item7.Add(item8, 0, Alignment.wxALIGN_BOTTOM | Direction.wxALL, 5);

        BoxSizer item10 = new BoxSizer(Orientation.wxHORIZONTAL);

        Button item11 = new Button(parent, LAB_LIMPAR, "Limpar", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item11.Name = "btnLimpar";
        item10.Add(item11, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        Button item12 = new Button(parent, BTN_FECHAR, "Fechar", Window.wxDefaultPosition, Window.wxDefaultSize, 0);

        item12.Name = "btnFechar";
        item10.Add(item12, 0, Alignment.wxALIGN_CENTER | Direction.wxALL, 5);

        item7.Add(item10, 0, Stretch.wxGROW | Alignment.wxALIGN_BOTTOM | Direction.wxALL, 5);

        item0.Add(item7, 0, Stretch.wxGROW | Alignment.wxALIGN_CENTER_VERTICAL | Direction.wxALL, 5);

        if (set_sizer)
        {
            // parent.SetAutoLayout( true );
            parent.SetSizer(item0);
            if (call_fit)
            {
                item0.Fit(parent);
                item0.SetSizeHints(parent);
            }
        }

        return(item0);
    }