Ejemplo n.º 1
0
        /// <summary>
        /// this guy is called by Main() and will never be called by anybody else
        /// Use static property instance to access methods of the class
        /// </summary>
        protected Program()
        {
            cli = new CommandLineInterface("JQuant");
            LoadCommandLineInterface();

            #if WITHGUI
            // tricky part - i need output console before main form is initialized
            consoleOut = new JQuantForms.ConsoleOutDummy();

            // now the rest of the GUI controls
            Thread guiThread = new Thread(this.InitGUI);
            guiThread.Priority = ThreadPriority.Lowest;
            guiThread.Start();
            #endif
            #if WITHHTTP
            StartHttp();
            #endif
        }
Ejemplo n.º 2
0
        /// <summary>
        /// executed in a separate thread - uses spare CPU cycles
        /// </summary>
        protected void InitGUI()
        {
            // Control.CheckForIllegalCrossThreadCalls = false;

            // create consoles for output/input
            // output console is one of the first things to create
            JQuantForms.ConsoleOut consoleOut = new JQuantForms.ConsoleOut();
            consoleOut.Dock = DockStyle.Fill;
            this.consoleOut = consoleOut;

            consoleIn = new JQuantForms.ConsoleIn(new JQuantForms.ConsoleIn.ProcessCommandDelegate(this.ConsoleInCommandHalder));
            consoleIn.Dock = DockStyle.Fill;

            // Create layout
            tlp = new TableLayoutPanel();
            tlp.Dock = DockStyle.Fill;
            tlp.ColumnCount = 1;
            tlp.RowCount = 2;

            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle
                              (System.Windows.Forms.SizeType.Percent, 80F));
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle
                              (System.Windows.Forms.SizeType.Absolute, 28F));

            // add consoles
            tlp.Controls.Add(consoleOut, 0, 0);
            tlp.Controls.Add(consoleIn, 0, 1);

            // i have no idea what this thing does
            // tlp.ResumeLayout(false);
            // tlp.PerformLayout();

            // create main form
            mainForm = new Form();
            mainForm.Size = new System.Drawing.Size(600, 400);

            mainForm.SuspendLayout();

            // add layout to the main form
            mainForm.Controls.Add(tlp);

            mainForm.ResumeLayout(false);
            mainForm.PerformLayout();

            mainForm.Show();

            Application.Run(mainForm);
        }