public void Init() { mainPanel = new MainPanel(); buildTabelPanel = new BuildTabelPanel(); communicationPanel = new CommunicationPanel(); recordPanel = new RecordPanel(); //panel加入dictionary (key -> value) mPanelDictionary.Add(Page.Main, mainPanel); mPanelDictionary.Add(Page.Communication, communicationPanel); mPanelDictionary.Add(Page.Record, recordPanel); mPanelDictionary.Add(Page.BuildTable, buildTabelPanel); this.Controls.Add(mPanelDictionary[Page.Main]); this.Controls.Add(mPanelDictionary[Page.Communication]); this.Controls.Add(mPanelDictionary[Page.Record]); this.Controls.Add(mPanelDictionary[Page.BuildTable]); }
/// <summary> /// Builder /// </summary> /// <param name="simulator"></param> public SimulatorPanel(ISimulator simulator) { InitializeComponent(); //The simulator is saved this.simulator = simulator; //A Simulator status Change event is logged this.simulator.StateChanged += new EventHandler(Simulator_StateChanged); //MOway module panels are added this.outputPanel = new OutputsPanel(this.simulator.MowayModel); this.LoadSubPanel(this.outputPanel); this.sensorsPanel = new SensorsPanel(this.simulator.MowayModel); this.LoadSubPanel(this.sensorsPanel); this.enviromentPanel = new EnviromentPanel(this.simulator.MowayModel); this.LoadSubPanel(this.enviromentPanel); this.accelerometerPanel = new AccelerometerPanel(this.simulator.MowayModel); this.LoadSubPanel(this.accelerometerPanel); this.communicationPanel = new CommunicationPanel(this.simulator.MowayModel); this.LoadSubPanel(this.communicationPanel); this.registersPanel = new RegistersPanel(this.simulator.MowayModel); this.LoadSubPanel(this.registersPanel); this.cbMowayModule.SelectedIndex = 0; }