Пример #1
0
        private void mnTerminal_Click(object sender, EventArgs e)
        {
            if (this.TerminalForm == null)
            {
                this.TerminalForm = new TerminalForm();
            }

            this.TerminalForm.Show(this.dockPanel1);
            this.UpdateUI();
        }
Пример #2
0
        public UserInterface(string title)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            mForm = new TerminalForm(title, 120, 50);
            mForm.TerminalControl.KeyDown += TerminalControl_KeyDown;
            mForm.TerminalControl.KeyUp   += TerminalControl_KeyUp;
            mForm.FormClosing             += Form_FormClosing;
        }
Пример #3
0
        private IDockContent GetContentFromPersistString(string persistString)
        {
            string[] items = persistString.Split(',');

            persistString = items[0];

            if (persistString == typeof(TerminalForm).ToString())
            {
                if (this.TerminalForm != null)
                {
                    return(this.TerminalForm);
                }
                this.TerminalForm          = new TerminalForm();
                this.TerminalForm.IsHidden = false;
                if (this.TerminalForm.DockState == DockState.Document)
                {
                    this.TerminalForm.DockState = DockState.DockRight;
                }
                return(this.TerminalForm);
            }

            //else if (persistString == typeof(ErrorListForm).ToString())
            //{
            //    if (this.ErrorListForm != null)
            //        return this.ErrorListForm;
            //    this.ErrorListForm = new ErrorListForm();
            //    this.ErrorListForm.IsHidden = false;
            //    return this.ErrorListForm;
            //}

            else if (persistString == typeof(EditorForm).ToString())
            {
                if (items.Length == 3 && File.Exists(items[1]))
                {
                    if (this.FindDocument(items[1]) == null)
                    {
                        EditorForm editor = new EditorForm(this);
                        editor.LoadFromFile(items[1]);
                        editor.scintilla.GotoPosition(int.Parse(items[2]));
                        editor.scintilla.SetSavePoint();
                        editor.IsHidden = false;
                        editor.Focus();
                        return(editor);
                    }
                    return(null);
                }
                else
                {
                    return(null);
                }
            }
            return(null);
        }
    // Use this for initialization
    void Start()
    {
        GLU.terminal = GLUTerminal.GetTerminal("plane");
        GLU.terminal.modalBackgroundColor = new GLUColor(0, 0.75f);
        TerminalForm f = new TerminalForm();

        f.Show();
        GLU.terminal = GLU.screen;

        TerminalHUDForm tf = new TerminalHUDForm();

        tf.Show();
    }
Пример #5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //this.TerminalForm.PortOpen += TerminalForm_PortOpen;
            //this.TerminalForm.PortClose += TerminalForm_PortClose;

            string configFile = this.DockPanelConfigFile;

            if (!File.Exists(configFile))
            {
            }
            else
            {
                try
                {
                    deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                    dockPanel1.LoadFromXml(configFile, this.deserializeDockContent);
                }
                catch (Exception ex)
                {
                    Helpers.ErrorBox(ex.Message + "\r\n\r\n" + "Plase restart the program!");
                    this.TerminalForm.Close();
                    this.Close();
                    return;
                }
            }

            this.CurretPortName = Properties.Settings.Default.PortName;

            if (this.TerminalForm == null)
            {
                this.TerminalForm = new TerminalForm();
                this.TerminalForm.Show(this.dockPanel1);
            }
            //
            //if (!this.ComportIsExists)
            //{
            //    this.btnConnect.Enabled = false;
            //    MessageBox.Show($"Serialport \"{this.CurretPortName}\" does not exists!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
            //else
            //{
            this.btnConnect.Enabled = true;
            //}

            this.UpdateUI();
        }
Пример #6
0
        private void Main_Load(object sender, EventArgs e)
        {
            fmIMU = new FormIMU(m_connection);
            DockForm(fmIMU, TabPageIMUUI);

            fmTermial = new TerminalForm();
            DockForm(fmTermial, tabPageMessage);

            this.Text = Assembly.GetExecutingAssembly().GetName().Name + " (Port Closed)" + " V" + Assembly.GetExecutingAssembly().GetName().Version;

            Int32 baud = Convert.ToInt32(iniFile.Read("SerialPort", "Baudrate"));

            if (baud == 0)
            {
                iniFile.Write("SerialPort", "Baudrate", "115200");
            }
            RefreshSerialPortList(toolStripMenuItemSerial);

            m_connection.OnSendData       += new Connection.SendDataEventHandler(SendSerialPort);
            KbootDecoder.OnPacketRecieved += new KbootPacketDecoder.KBootDecoderDataReceivedEventHandler(OnKbootDecoderDataReceived);
            serialPort.WriteTimeout        = 1000;
        }
Пример #7
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //this.TerminalForm.PortOpen += TerminalForm_PortOpen;
            //this.TerminalForm.PortClose += TerminalForm_PortClose;

            string configFile = this.DockPanelConfigFile;

            if (!File.Exists(configFile))
            {
            }
            else
            {
                try
                {
                    deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                    dockPanel1.LoadFromXml(configFile, this.deserializeDockContent);
                }
                catch (Exception ex)
                {
                    Helpers.ErrorBox(ex.Message + "\r\n\r\n" + "请重新启动程序!");
                    this.TerminalForm.Close();
                    this.Close();
                    return;
                }
            }

            this.CurretPortName = Properties.Settings.Default.PortName;

            if (this.TerminalForm == null)
            {
                this.TerminalForm = new TerminalForm();
                this.TerminalForm.Show(this.dockPanel1, DockState.DockBottom);
            }
            if (this.yunfile == null)
            {
                this.yunfile = new yunfile(this);
                this.yunfile.Show(this.dockPanel1, DockState.DockLeft);
                this.yunfile.Hide();
            }
            //
            //if (!this.ComportIsExists)
            //{
            //    this.btnConnect.Enabled = false;
            //    MessageBox.Show($"Serialport \"{this.CurretPortName}\" does not exists!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            //}
            //else
            //{
            this.btnConnect.Enabled = true;
            //}
            this.UpdateUI();
            //打开关联文件
            string command = Environment.CommandLine;//获取进程命令行参数

            string[] para = command.Split('\"');

            if (para.Length > 3)
            {
                string pathC = para[3];//获取打开的文件的路径
                //下面就可以自己编写代码使用这个pathC参数了
                //FileStream fs = new FileStream(pathC, FileMode.Open, FileAccess.Read);
                FileFormats ff = EditorForm.EditorFileFormats;
                OpenFromFile(pathC, ff);
                MessageBox.Show(pathC);
            }
        }
Пример #8
0
 /// <summary>
 /// Initializes the console
 /// </summary>
 /// <returns></returns>
 static Terminal()
 {
     form = new TerminalForm();
 }