Exemple #1
0
 private void RemoveDeviceConfiguration()
 {
     if (configurationLoaded)
     {
         base.Visible = false;
         splitContainer.Panel1.Controls.Clear();
         ((ToolStripMenuItem) menuStrip1.Items["toolToolStripMenuItem"]).DropDownItems.Clear();
         ((ToolStripMenuItem) menuStrip1.Items["viewToolStripMenuItem"]).DropDownItems.RemoveAt(2);
         if (userCtrlMain != null)
         {
             userCtrlMain = null;
         }
         if (communicationMain != null)
         {
             communicationMain = null;
         }
         configurationLoaded = false;
     }
 }
Exemple #2
0
        private void LoadDeviceConfiguration(DeviceManaged deviceType)
        {
            switch (deviceType)
            {
                case DeviceManaged.STEVAL_MKI062V1:
                    userCtrlMain = new ControlLibrary.MKI062V1.MainUserControl();
                    communicationMain = new ControlLibrary.MKI062V1.CommunicationControl();
                    break;

                case DeviceManaged.STEVAL_MKI062V2:
                    userCtrlMain = new ControlLibrary.MKI062V2.MainUserControl();
                    communicationMain = new ControlLibrary.MKI062V2.CommunicationControl();
                    break;
            }
            userCtrlMain.Dock = DockStyle.Fill;
            splitContainer.Panel1.Controls.Add(userCtrlMain);
            toolStripContainer1.TopToolStripPanel.Controls.Clear();
            communicationMain.OnCommunicationSettings_Change = (CoomunicationSettings_Change) Delegate.Combine(communicationMain.OnCommunicationSettings_Change, new CoomunicationSettings_Change(OnCommChange));
            communicationMain.OnMessageToLog = (MessageToLog) Delegate.Combine(communicationMain.OnMessageToLog, new MessageToLog(AddInLogBar));
            communicationMain.OnDataReceived = (DataReceived) Delegate.Combine(communicationMain.OnDataReceived, new DataReceived(AddDataInPlot));
            communicationMain.OnStart = (StartAcquisition) Delegate.Combine(communicationMain.OnStart, new StartAcquisition(OnStartAcquistion));
            communicationMain.OnStop = (StopAcquistion) Delegate.Combine(communicationMain.OnStop, new StopAcquistion(OnStopAcquisition));
            communicationMain.OnTCPState_Change = (TCPState_Change) Delegate.Combine(communicationMain.OnTCPState_Change, new TCPState_Change(OnTCP_Change));
            userCtrlMain.OnClear = (ClearEvent) Delegate.Combine(userCtrlMain.OnClear, new ClearEvent(communicationMain.Clear));
            userCtrlMain.OnSave = (SaveEvent) Delegate.Combine(userCtrlMain.OnSave, new SaveEvent(SaveFromClear));
            userCtrlMain.OnMessageToLog = (MessageToLog) Delegate.Combine(userCtrlMain.OnMessageToLog, new MessageToLog(AddInLogBar));
            toolStripStatusLabel1.Text = communicationMain.CommSettingsInfo;

            toolStripContainer1.TopToolStripPanel.Controls.Add(toolStrip1);
            toolStripContainer1.TopToolStripPanel.Controls.Add(menuStrip1);
            toolStripContainer1.TopToolStripPanel.Controls.Add(communicationMain.LocalToolBar);
            toolStripContainer1.TopToolStripPanel.Controls.Add(userCtrlMain.LocalToolBar);
            menuStrip1.AllowMerge = false;
            ((ToolStripMenuItem) menuStrip1.Items["toolToolStripMenuItem"]).DropDownItems.AddRange(userCtrlMain.LocalMenuBarTool);
            ((ToolStripMenuItem) menuStrip1.Items["toolToolStripMenuItem"]).DropDownItems.AddRange(communicationMain.LocalMenuBarTool);
            ((ToolStripMenuItem) menuStrip1.Items["viewToolStripMenuItem"]).DropDownItems.AddRange(userCtrlMain.LocalMenuBarView);
            base.Visible = true;
            configurationLoaded = true;
        }