예제 #1
0
        private Panel CreateControlPanel()
        {
            Panel    panel = new Panel(this);
            BoxSizer sizer = new BoxSizer(Orientation.Horizontal);

            _port = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, new string[0],
                                 WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            UpdatePorts();
            sizer.Add(_port, 0, SizerFlag.Expand | SizerFlag.All, 5);

            Bitmap refreshBitmap = GetType().Assembly.GetManifestResourceWxBitmap("DummyLoadController.Images.refresh.png");

            _refreshPorts = new BitmapButton(panel, ID_RefreshPorts, refreshBitmap);
            EvtButton(ID_RefreshPorts, (s, e) => UpdatePorts());
            sizer.Add(_refreshPorts, 0, SizerFlag.Expand | SizerFlag.All, 0);

            string[] baudRates = new[] { "300", "600", "1200", "2400", "4800", "9600", "14,400", "19,200", "28,800", "38,400", "57,600", "76,800", "115,200", "230,400" };
            _baudRate = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, baudRates, WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            _baudRate.Select(5);
            sizer.Add(_baudRate, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _connect = new Button(panel, ID_Connect, "Connect");
            EvtButton(ID_Connect, (s, e) => Connect());
            sizer.Add(_connect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _disconnect = new Button(panel, ID_Disconnect, "Disconnect");
            EvtButton(ID_Disconnect, (s, e) => _comService.Disconnect());
            sizer.Add(_disconnect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            panel.SetSizer(sizer);
            sizer.SetSizeHints(panel);

            return(panel);
        }
예제 #2
0
        private Panel CreateSendPanel()
        {
            Panel    panel = new Panel(this);
            BoxSizer sizer = new BoxSizer(Orientation.Horizontal);

            _textInput = new TextCtrl(panel, "", WxDefaultPosition, WxDefaultSize, WindowStyles.TextCtrlProcessEnter)
            {
                Font = _dataFont
            };
            sizer.Add(_textInput, 1, SizerFlag.Expand | SizerFlag.All, 0);
            _textInput.EvtKeyDown((s, e) =>
            {
                KeyEvent keyEvent = e as KeyEvent;
                if (keyEvent != null && keyEvent.KeyCode == 13)
                {
                    OnSend();
                }
                e.Skip(true);
            });

            _send = new Button(panel, ID_Send, "Send");
            EvtButton(ID_Send, (s, e) => OnSend());
            sizer.Add(_send, 0, SizerFlag.Expand | SizerFlag.All, 0);

            panel.SetSizer(sizer);
            sizer.SetSizeHints(panel);

            return(panel);
        }
예제 #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 Panel CreatePage2()
        {
            Panel page2 = new Panel(this, wxID_ANY);

            BoxSizer column = new BoxSizer(Orientation.wxVERTICAL);
            BoxSizer row;

            row = AddFileRow(page2, Globals.alert_sound, _alert);
            column.Add(row);
            row = AddFileRow(page2, Globals.entry_sound, _enter);
            column.Add(row);
            row = AddFileRow(page2, Globals.searchPath, _search);
            column.Add(row);

            page2.SetSizer(column);
            return(page2);
        }
예제 #5
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);
        }
예제 #6
0
        Panel CreatePage3()
        {
            Panel page = new Panel(this, wxID_ANY);

            BoxSizer column = new BoxSizer(Orientation.wxVERTICAL);

            TDSkin m_skin = Globals.curSkin;

            AddSkinRow(page, column, wxPorting.L("Background"), m_background, m_skin.background);
            AddSkinRow(page, column, wxPorting.L("Free Track"), m_freeTrack, m_skin.free_track);
            AddSkinRow(page, column, wxPorting.L("Reserved Track"), m_reservedTrack, m_skin.reserved_track);
            AddSkinRow(page, column, wxPorting.L("Reserved for Shunting"), m_reservedShunting, m_skin.reserved_shunting);
            AddSkinRow(page, column, wxPorting.L("Occupied"), m_occupiedTrack, m_skin.occupied_track);
            AddSkinRow(page, column, wxPorting.L("Reserved for Working"), m_workingTrack, m_skin.working_track);
            AddSkinRow(page, column, wxPorting.L("Switch Outline"), m_outline, m_skin.outline);
            AddSkinRow(page, column, wxPorting.L("Text"), m_text, m_skin.text);

            page.SetSizer(column);
            return(page);
        }
예제 #7
0
        private Panel CreateSendPanel()
        {
            Panel panel = new Panel(this);
            BoxSizer sizer = new BoxSizer(Orientation.Horizontal);

            _textInput = new TextCtrl(panel, "", WxDefaultPosition, WxDefaultSize, WindowStyles.TextCtrlProcessEnter)
            {
                Font = _dataFont
            };
            sizer.Add(_textInput, 1, SizerFlag.Expand | SizerFlag.All, 0);
            _textInput.EvtKeyDown((s, e) =>
            {
                KeyEvent keyEvent = e as KeyEvent;
                if (keyEvent != null && keyEvent.KeyCode == 13)
                {
                    OnSend();
                }
                e.Skip(true);
            });

            _send = new Button(panel, ID_Send, "Send");
            EvtButton(ID_Send, (s, e) => OnSend());
            sizer.Add(_send, 0, SizerFlag.Expand | SizerFlag.All, 0);

            panel.SetSizer(sizer);
            sizer.SetSizeHints(panel);

            return panel;
        }
예제 #8
0
        private Panel CreateControlPanel()
        {
            Panel panel = new Panel(this);
            BoxSizer sizer = new BoxSizer(Orientation.Horizontal);

            _port = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, new string[0],
                WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            UpdatePorts();
            sizer.Add(_port, 0, SizerFlag.Expand | SizerFlag.All, 5);

            Bitmap refreshBitmap = GetType().Assembly.GetManifestResourceWxBitmap("DummyLoadController.Images.refresh.png");
            _refreshPorts = new BitmapButton(panel, ID_RefreshPorts, refreshBitmap);
            EvtButton(ID_RefreshPorts, (s, e) => UpdatePorts());
            sizer.Add(_refreshPorts, 0, SizerFlag.Expand | SizerFlag.All, 0);

            string[] baudRates = new[] { "300", "600", "1200", "2400", "4800", "9600", "14,400", "19,200", "28,800", "38,400", "57,600", "76,800", "115,200", "230,400" };
            _baudRate = new ComboBox(panel, "", WxDefaultPosition, WxDefaultSize, baudRates, WindowStyles.ComboBoxDropDown | WindowStyles.ComboBoxReadonly);
            _baudRate.Select(5);
            sizer.Add(_baudRate, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _connect = new Button(panel, ID_Connect, "Connect");
            EvtButton(ID_Connect, (s, e) => Connect());
            sizer.Add(_connect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            _disconnect = new Button(panel, ID_Disconnect, "Disconnect");
            EvtButton(ID_Disconnect, (s, e) => _comService.Disconnect());
            sizer.Add(_disconnect, 0, SizerFlag.Expand | SizerFlag.All, 5);

            panel.SetSizer(sizer);
            sizer.SetSizeHints(panel);

            return panel;
        }