/// <summary>
        /// Occurs when CANoe has quit.
        /// </summary>
        private void CANoeQuit()
        {
            // Pay attention to thread safety, as the accessed controls were created in the GUI thread!
            DelSafeInvocation safeinvocation = new DelSafeInvocation(CANoeQuitInternal);

            this.Invoke(safeinvocation);

            UnregisterCANoeEventHandlers();

            // Indicate that the instance of CANoe was closed.
            mCANoeInstanceRunning = false;
        }
        /// <summary>
        /// Occurs when the measurement has exited.
        /// </summary>
        private void MeasurementExited()
        {
            // Pay attention to thread safety, as the accessed controls were created in the GUI thread!
            DelSafeInvocation safeinvocation = new DelSafeInvocation(MeasurementExitedInternal);

            this.Invoke(safeinvocation);

            // Unregister system variables on event handlers.
            if (mCANoeSysVar1 != null)
            {
                mCANoeSysVar1.OnChange -= new CANoe._IVariableEvents_OnChangeEventHandler(SysVar1Changed);
            }

            if (mCANoeSysVar2 != null)
            {
                mCANoeSysVar2.OnChange -= new CANoe._IVariableEvents_OnChangeEventHandler(SysVar2Changed);
            }
        }
        /// <summary>
        /// Occurs when the measurement has been initiated.
        /// </summary>
        private void MeasurementInitiated()
        {
            // Compile CAPL code of the CANoe configuration.
            CANoe.CAPL CANoeCAPL = (CANoe.CAPL)mCANoeApp.CAPL;
            if (CANoeCAPL != null)
            {
                CANoeCAPL.Compile(null);
            }

            try
            {
                // Assign CAPL functions.
                mCANoeMultiply = (CANoe.CAPLFunction)CANoeCAPL.GetFunction("Multiply");
            }
            catch (System.Exception)
            {
                MessageBox.Show("Possible cause: Wrong CAPL function name in source code or configuration.",
                                "Error while assigning CAPL functions", MessageBoxButtons.OK, MessageBoxIcon.Error);

                return;
            }

            // Pay attention to thread safety, as the accessed controls were created in the GUI thread!
            DelSafeInvocation safeinvocation = new DelSafeInvocation(MeasurementInitiatedInternal);

            this.Invoke(safeinvocation);

            // Create system variable on event handlers.
            if (mCANoeSysVar1 != null)
            {
                mCANoeSysVar1.OnChange += new CANoe._IVariableEvents_OnChangeEventHandler(SysVar1Changed);
            }

            if (mCANoeSysVar2 != null)
            {
                mCANoeSysVar2.OnChange += new CANoe._IVariableEvents_OnChangeEventHandler(SysVar2Changed);
            }
        }