Ejemplo n.º 1
0
        private void Edit()
        {
            TabPage    curTabPage = GetCurTabPage();
            ScpiEditor scpiEditor = new ScpiEditor();

            TabData tabData = (TabData)curTabPage.Tag;

            tabData.state = State.Edit;

            //copy Scpilistview commands to scpi editor
            ScpiListView curScpiListView = (ScpiListView)curTabPage.Controls[0];

            string readStr   = "";
            string editorTxt = "";

            while (curScpiListView.GetNextLine(ref readStr) == true)
            {
                editorTxt += readStr + System.Environment.NewLine;
            }
            //TODO:remove the extra new line
            //editorTxt.Remove(editorTxt.LastIndexOf(System.Environment.NewLine));

            scpiEditor.Text = editorTxt;

            curTabPage.Controls.Remove(curScpiListView);
            curScpiListView.Dispose();
            curTabPage.Controls.Add(scpiEditor);
        }
Ejemplo n.º 2
0
        private void FinishEdit()
        {
            TabPage    curTabPage = GetCurTabPage();
            ScpiEditor scpiEditor = (ScpiEditor)curTabPage.Controls[0];

            ScpiListView scpiListView = new ScpiListView();

            scpiListView.LoadFromEditor(scpiEditor);

            curTabPage.Controls.RemoveAt(0);
            scpiEditor.Dispose();
            curTabPage.Controls.Add(scpiListView);
        }
Ejemplo n.º 3
0
        private void LoadFile(string fileName)
        {
            TabPage curTabPage = GetCurTabPage();
            TabData tabData    = (TabData)curTabPage.Tag;

            tabData.fileName = fileName;
            tabData.parseStd = ParseStd.TEK;
            tabData.state    = State.View;


            curTabPage.Text = System.IO.Path.GetFileName(fileName);


            ScpiListView scpiListView = (ScpiListView)tabControl.SelectedTab.Controls[0];

            scpiListView.LoadFromFile(tabData);
        }
Ejemplo n.º 4
0
        private void newTab_Click(object sender, EventArgs e)
        {
            //Add tab page
            TabPage      newTabPage  = new TabPage();
            ScpiListView newListView = new ScpiListView();

            newTabPage.Controls.Add(newListView);
            TabData tabData = new TabData();

            newTabPage.Tag = tabData;
            tabControl.Controls.Add(newTabPage);

            //Set focus
            tabControl.SelectedTab = newTabPage;

            //Clear Details
            comboBoxFileName.Text = "";
        }
Ejemplo n.º 5
0
        /// <summary>
        /// launches a thred that runs scpitest. scpitest needs to be tun in a
        /// seperate thread to enable pause and breakpoint features
        /// </summary>
        private void ScpiRunner()
        {
            //Always get the curtabpage and work on it instead of directly
            //working on tabControl.SelectedTab. This helps if the selected
            //tab chnages evne before the function gets completed
            //TabPage curTabPage = tabControl.SelectedTab;
            //ScpiListView curScpilistView = (ScpiListView)curTabPage.Controls[0];
            ScpiListView curScpilistView = (ScpiListView)this.Invoke(new GetCurrentListviewDelegate(this.GetCurrentListview), null);
            TabData      tabData         = (TabData)this.Invoke(new GetCurTabDataDelegate(this.GetCurTabData), null);

            try
            {
                //AutoResetEvent syncEvent = new AutoResetEvent(false);
                TextParser parser   = new TextParser(curScpilistView, ParseStd.TEK);
                ScpiTest   scpiTest = new ScpiTest(parser, curScpilistView, tabData.machineName, tabData.port);
                //tabData.syncEvent = syncEvent;
                scpiTest.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }