Example #1
0
        public MainPanel(string mw_SerialPort,string rx_SerialPort)
        {
            InitializeComponent();
            if (!String.IsNullOrEmpty(rx_SerialPort))
            {
                rx_profiler = new Profiler(this, init_display_rx, update_display_rx);
                RC_driver = new serial_driver(rx_SerialPort, this, rx_profiler, stream_source.RC_transmitter);
                rx_status.Text = "Open";
            }
            else
            {
                rx_status.Text = "Not Available";
            }
            System.Threading.Thread.Sleep(1000);
            if (!String.IsNullOrEmpty(mw_SerialPort))
            {
                mw_profiler = new Profiler(this, init_display_mw, update_display_mw);
                hardware_driver = new serial_driver(mw_SerialPort, this, mw_profiler, stream_source.flight_controller);
                mw_commander = new commander();
                lblStrip_mw_status.Text = "Open";
            }
            else
            {
                lblStrip_mw_status.Text = "Not Available";
            }
            msg_ctrl_main = new msg_ctrl(hardware_driver.SerialParser, stream_source.flight_controller);
            msg_ctrl_main.DebugTextReceived += new msg_ctrl.DebugTextReceivedHandler(this.OnDebugTextReceived);
            mw_profiler.AttachProbeReceivedEvent();
            display_adapter_main = new dispaly_adapter(this,mw_profiler, attitudeIndicatorInstrument, rollRateInstrument);
            display.Smoothing = System.Drawing.Drawing2D.SmoothingMode.None;
            display.Refresh();
            //int tmp = Thread.CurrentThread.ManagedThreadId;
            display.PlaySpeed = 0.05f;
            session_organizer_main = new session_organizer(treeView_mrft, hardware_driver, mw_commander, msg_ctrl_main);
            flight_scenario_main = new flight_scenario(0, session_organizer_main, listViewFlightScenario, lbl_status_txt,lblStrip_mw_status,lst_flight_history, this);
            //TODO: Optimize this
            session_display_manager_main = new session_display_manager(barBeta, barAmp, barBias,txt_mrft_session_cmnt,
                txt_point_comment,txt_num_mrft_bags, chart_mrft,chart_mrft_session, tabControlTune,combo_tune_method,combo_model_type,
                combo_pid_optim, listViewMRFTPoints,barProp,barIntegral, barDerivative,barWindup,chk_en_pv_derive,
                chk_get_bias, txt_pid_comment,combo_cmd_type,combo_ref_src,txt_beta_val,txt_amp_val,txt_bias_val,
                session_organizer_main);
            DisplayUpdateTimer = new Timer();
            DisplayUpdateTimer.Interval = 100;
            DisplayUpdateTimer.Start();
            DisplayUpdateTimer.Tick += new EventHandler(OnDisplayRefreshTimerTick);

        }
 //Constructor:
 public session_organizer(TreeView tree_view_para,serial_driver mw_serial_driver_para,
     commander mw_commander_para,msg_ctrl msg_ctrls_para)
 {
     if (msg_ctrls_para.MsgStreamSource.Equals(stream_source.flight_controller))
         {
             _msg_ctrl = msg_ctrls_para;
         }
      _mw_serial_driver=mw_serial_driver_para;
      _mw_commander = mw_commander_para;
     tree_view_ctrl = tree_view_para;
 }