Exemplo n.º 1
0
        private void SaveColorsToINI()
        {
            int           iColorIDX;
            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Database\\GUI Layout Databases\\GUI Layout Rabbit 1_0 ECU.INI");

            //UInt32 u32ARGB;
            //string szSetting;
            //byte u8ColorByte;

            for (iColorIDX = 1; iColorIDX < 20; iColorIDX++)
            {
                //szSetting = "";
                //u32ARGB = maclsLoggingColor[iColorIDX - 1].ToArgb();
                //u8ColorByte = (byte)(u32ARGB >> 24);
                //szSetting += u8ColorByte.ToString();
            }

            foreach (Form clsForm in this.MdiChildren)
            {
                String szFormTitle = clsForm.Text;

                mclsIniParser.AddSetting("Window Layout", szFormTitle + ".Left", clsForm.Left.ToString());
                mclsIniParser.AddSetting("Window Layout", szFormTitle + ".Width", clsForm.Width.ToString());
                mclsIniParser.AddSetting("Window Layout", szFormTitle + ".Top", clsForm.Top.ToString());
                mclsIniParser.AddSetting("Window Layout", szFormTitle + ".Height", clsForm.Height.ToString());
            }

            mclsIniParser.SaveSettings();
        }
Exemplo n.º 2
0
        private void SaveWindowsToINI()
        {
            int           formIDX       = 0;
            bool          saveErr       = false;
            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Database\\GUI Layout Databases\\GUI Layout Rabbit 1_0 ECU.INI");

            foreach (Form clsForm in this.MdiChildren)
            {
                String szFormName = clsForm.Name;

                try
                {
                    mclsIniParser.AddSetting("Window Layout", szFormName + formIDX.ToString() + ".Left", clsForm.Left.ToString());
                    mclsIniParser.AddSetting("Window Layout", szFormName + formIDX.ToString() + ".Width", clsForm.Width.ToString());
                    mclsIniParser.AddSetting("Window Layout", szFormName + formIDX.ToString() + ".Top", clsForm.Top.ToString());
                    mclsIniParser.AddSetting("Window Layout", szFormName + formIDX.ToString() + ".Height", clsForm.Height.ToString());
                }
                catch
                {
                    if (false == saveErr)
                    {
                        MessageBox.Show("Error saving view context");
                    }

                    saveErr = true;
                }

                formIDX++;
            }

            mclsIniParser.SaveSettings();
        }
Exemplo n.º 3
0
        private void PopulateLinkCombo(int iCharIDX, UInt32 u32Data, bool reload)
        {
            if (true == reload)
            {
                String        szOutputString;
                String        szOutputStringAlias;
                int           iOutputIDX;
                tclsIniParser clsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Config\\MDAC ECUHOST Calibration.INI");

                maclsChainOrOutputCombo[iCharIDX].Items.Add("No output");
                maclsChainOrOutputCombo[iCharIDX].Items.Add("AND NEXT");
                maclsChainOrOutputCombo[iCharIDX].Items.Add("OR NEXT");
                maclsChainOrOutputCombo[iCharIDX].Items.Add("NOT NEXT");
                maclsChainOrOutputCombo[iCharIDX].Items.Add("XOR NEXT");

                for (iOutputIDX = 0; iOutputIDX < 99; iOutputIDX++)
                {
                    szOutputString      = "Output " + iOutputIDX.ToString();
                    szOutputStringAlias = clsIniParser.GetSetting("InputOutput", szOutputString);

                    if (null != szOutputStringAlias)
                    {
                        szOutputString = szOutputStringAlias + " On";
                    }
                    else
                    {
                        szOutputString += " On";
                    }

                    maclsChainOrOutputCombo[iCharIDX].Items.Add(szOutputString);

                    szOutputString      = "Output " + iOutputIDX.ToString();
                    szOutputStringAlias = clsIniParser.GetSetting("InputOutput", szOutputString);

                    if (null != szOutputStringAlias)
                    {
                        szOutputString = szOutputStringAlias + " Off";
                    }
                    else
                    {
                        szOutputString += " Off";
                    }

                    maclsChainOrOutputCombo[iCharIDX].Items.Add(szOutputString);
                }
            }
            else
            {
                if (maclsChainOrOutputCombo[iCharIDX].Items.Count > u32Data)
                {
                    Invoke((MethodInvoker) delegate
                    {
                        maclsChainOrOutputCombo[iCharIDX].SelectedIndex = (int)u32Data;
                    });
                }
            }
        }
Exemplo n.º 4
0
        public tclsUDSComms(string szAdapterDeviceName, IntPtr MDIFormHandle)
        {
            string szTransferBlockSize;

            mclsUDS            = new tclsUDS();
            mclsCommsInterface = new tclsCommsInterface(MDIFormHandle);
            int iTransferBlockSizeLegal;

            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Config\\MDAC ECUHost Calibration.INI");

            tclsErrlog.LogAppend("INI file opened...");

            try
            {
                szTransferBlockSize = mclsIniParser.GetSetting("Program", "TransferBlockSize");
                miTransferBlockSize = ConstantData.ISO15765.rs32SEG_TRANSFER_BLOCK_SIZE;

                for (iTransferBlockSizeLegal = 1; iTransferBlockSizeLegal <= 512; iTransferBlockSizeLegal *= 2)
                {
                    if (iTransferBlockSizeLegal == (int)Convert.ToInt16(szTransferBlockSize))
                    {
                        miTransferBlockSize = iTransferBlockSizeLegal;
                        break;
                    }
                }

                tclsErrlog.LogAppend("Transfer block size: " + miTransferBlockSize.ToString());
            }
            catch
            {
                miTransferBlockSize = ConstantData.ISO15765.rs32SEG_TRANSFER_BLOCK_SIZE;
            }


            maqiMeasureSubIDXPendingArray = new Queue <int> [ConstantData.BUFFERSIZES.u16UDS_MEASURE_RATE_COUNT];

            mau8InPacketBuffer   = new byte[ConstantData.BUFFERSIZES.u16UDSOU_BUFF_RXPAYLOAD_SIZE];
            mau8ChannelTXPayload = new byte[ConstantData.BUFFERSIZES.u16UDSOU_BUFF_TXPAYLOAD_SIZE];

            mstTransferPageCB.enChannelMode      = tenChannelMode.enChannelModeNone;
            mstTransferPageCB.u32StartAddress    = 0;
            mstTransferPageCB.u32EndAddress      = 0;
            mstTransferPageCB.iBlockSize         = miTransferBlockSize;
            mstTransferPageCB.u32BytesToTransfer = 0;
            miDDDIIDX       = 0;
            miResponseCount = 0;
            mboReplayActive = false;
            mstRPCResponse  = new tstRPCResponse();
            miCommsWaits    = 0;

            mboChannelActive = mclsCommsInterface.CommsTryConnect(this,
                                                                  AppDomain.CurrentDomain.BaseDirectory + "Config\\MDAC ECUHost Calibration.INI",
                                                                  ConstantData.BUFFERSIZES.u16UDSOU_BUFF_RXPAYLOAD_SIZE);

            tclsErrlog.LogAppend("Channel active: " + mboChannelActive.ToString());
        }
Exemplo n.º 5
0
        static tclsDataPage()
        {
            mau8WorkingPage        = new byte[32768];
            mu32OldUpdateAddress   = 0xffffffff;
            mu32WorkingBaseAddress = 0;
            miSequence             = -1;
            miSequencePending      = -1;
            miStartDirtyRange      = -1;
            miEndDirtyRange        = -1;
            mboLockForChanges      = false;
            string szTransferBlockSize;
            int    iTransferBlockSizeLegal;

            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Config\\MDAC ECUHost Calibration.INI");

            try
            {
                szTransferBlockSize = mclsIniParser.GetSetting("Program", "TransferBlockSize");
                miTransferBlockSize = -1;

                for (iTransferBlockSizeLegal = 1; iTransferBlockSizeLegal <= 512; iTransferBlockSizeLegal *= 2)
                {
                    if (iTransferBlockSizeLegal == (int)Convert.ToInt16(szTransferBlockSize))
                    {
                        miTransferBlockSize = iTransferBlockSizeLegal;
                        break;
                    }
                }
            }
            catch
            {
                miTransferBlockSize = -1;
            }

            mlstReg32Write       = new List <tstReg32Write>();
            mlstReg16Write       = new List <tstReg16Write>();
            mlstReg8Write        = new List <tstReg8Write>();
            mlstReg32RepeatWrite = new List <tstReg32Write>();
            mlstReg16RepeatWrite = new List <tstReg16Write>();
            mlstReg8RepeatWrite  = new List <tstReg8Write>();
        }
        private void tclsRoutineControl_Load(object sender, EventArgs e)
        {
            int iRoutIDX = 1;

            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Routines.INI");

            while (1000 > iRoutIDX)
            {
                string szRoutineIDXString = "Routine" + iRoutIDX.ToString();
                string szRoutineString    = "0:0";

                try
                {
                    szRoutineString = mclsIniParser.GetSetting("UserRoutineList", szRoutineIDXString);
                }
                catch
                {
                    szRoutineString = null;
                }

                if ((1000 > iRoutIDX) && (null != szRoutineString))
                {
                    string[] aszRoutineString = szRoutineString.Split(':');

                    mclsRoutinesCombo.Items.Add(aszRoutineString[0]);
                    mlstU8RIDList.Add((byte)(128 + Convert.ToUInt16(aszRoutineString[1])));
                    iRoutIDX++;
                }
                else
                {
                    if (1 == iRoutIDX)
                    {
                        MessageBox.Show("No user defined routines were found in Routines.ini", "Important");
                    }
                    break;
                }
            }
        }
Exemplo n.º 7
0
        private void ArrangeWindowsFromINI()
        {
            int           formIDX       = 0;
            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Database\\GUI Layout Databases\\GUI Layout Rabbit 1_0 ECU.INI");

            foreach (Form clsForm in this.MdiChildren)
            {
                String szFormName = clsForm.Name;
                string szLeft; string szWidth; string szTop; string szHeight;
                int    iLeft; int iTop; int iWidth; int iHeight;

                try
                {
                    szLeft = mclsIniParser.GetSetting("Window Layout", szFormName + formIDX.ToString() + ".Left");
                }
                catch
                {
                    szLeft = "-1";
                }

                try
                {
                    szWidth = mclsIniParser.GetSetting("Window Layout", szFormName + formIDX.ToString() + ".Width");
                }
                catch
                {
                    szWidth = "-1";
                }

                try
                {
                    szTop = mclsIniParser.GetSetting("Window Layout", szFormName + formIDX.ToString() + ".Top");
                }
                catch
                {
                    szTop = "-1";
                }

                try
                {
                    szHeight = mclsIniParser.GetSetting("Window Layout", szFormName + formIDX.ToString() + ".Height");
                }
                catch
                {
                    szHeight = "-1";
                }

                iLeft   = Convert.ToInt16(szLeft);
                iTop    = Convert.ToInt16(szTop);
                iWidth  = Convert.ToInt16(szWidth);
                iHeight = Convert.ToInt16(szHeight);

                if ((0 <= iTop) && (0 < iHeight) && (0 <= iLeft) && (0 < iWidth))
                {
                    clsForm.Left   = iLeft;
                    clsForm.Height = iHeight;
                    clsForm.Top    = iTop;
                    clsForm.Width  = iWidth;
                }

                formIDX++;
            }
        }
Exemplo n.º 8
0
        public tclsMDIParent()
        {
            string szComsTickUS;
            string szGUILayoutXMLPath;
            long   lComsTickUS;

            InitializeComponent();
            mboRequestShutdown = false;
            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Config\\MDAC ECUHost Calibration.INI");

            try
            {
                szComsTickUS = mclsIniParser.GetSetting("Program", "ComsTickus");
            }
            catch
            {
                szComsTickUS = "Unknown";
            }

            try
            {
                szGUILayoutXMLPath = AppDomain.CurrentDomain.BaseDirectory + "Database\\GUI Layout Databases\\" + mclsIniParser.GetSetting("Databases", "SelectedLayoutXML");
            }
            catch
            {
                szGUILayoutXMLPath = "Unknown";
            }

            if (File.Exists(szGUILayoutXMLPath))
            {
                Program.mAPP_clsXMLConfig.ReadWindowConfigFile(szGUILayoutXMLPath);
            }

            mlstMeasValueCharView    = new List <tclsMeasValueCharView>();
            mlstMeasSegmentView      = new List <tclsICMeasSegmentView>();
            mlstMeasCurveMapView     = new List <tclsMeasCurveMapView>();
            mlstMeasValueLoggingView = new List <tclsMeasValueLoggingView>();
            mlstMeasValueGaugeView   = new List <tclsMeasValueGaugeView>();
            mlstLogicBlockView       = new List <tclsLogicBlockView>();
            mlstDSGView    = new List <tclsDSG>();
            mclsCommsTimer = new MicroLibrary.MicroTimer();
            mclsCommsTimer.MicroTimerElapsed += new MicroLibrary.MicroTimer.MicroTimerElapsedEventHandler(OnMicroTimerEvent);
            mlstChildViews   = new List <Form>();
            mlstLoggingViews = new List <tclsMeasValueLoggingView>();

            lComsTickUS = Convert.ToUInt32(szComsTickUS);

            if ((ConstantData.APPDATA.ru32ComsTickMin <= lComsTickUS) &&
                (ConstantData.APPDATA.ru32ComsTickMax >= lComsTickUS))
            {
                mclsCommsTimer.Interval = lComsTickUS;
                mclsCommsTimer.Enabled  = true;
            }

            mclsNavTreeView           = new tclsNavGraphicalTreeView();
            mclsNavTreeView.MdiParent = this;
            mclsNavTreeView.Show();

            mclsNotify           = new tclsNotify();
            mclsNotify.MdiParent = this;
            mclsNotify.Left      = 0;
            mclsNotify.Top       = this.ClientRectangle.Height - 100;
            mclsNotify.Width     = this.ClientRectangle.Width;
            mclsNotify.Show();
        }
Exemplo n.º 9
0
        private void FormUDP_Load(object sender, EventArgs e)
        {
            int    iFormIDX = 0;
            string szGUILayoutXMLPath;

            string[]      aszGUILayout;
            tclsIniParser mclsIniParser                     = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Config\\MDAC ECUHOST Calibration.INI");
            int           iMeasTablesViews                  = 0;
            int           iMeasMapsViews                    = 0;
            int           iMeasValueCharViews               = 0;
            int           iMeasSegmentViews                 = 0;
            int           iDSGViews                         = 0;
            int           iMapViewCountMax                  = 1;
            int           iTableViewCountMax                = 1;
            int           iCharViewCountMax                 = 1;
            int           iSegmentViewCountMax              = 1;
            int           iGaugeViewCountMax                = 1;
            int           iDSGViewCountMax                  = 1;
            int           iLogicBlockViews                  = 0;
            int           iLogicBlockViewCountMax           = 1;
            int           iMeasValueCharViewLastChildIndex  = 1;
            int           iMeasSegmentViewLastChildIndex    = 1;
            int           iMeasTableViewLastChildIndex      = 1;
            int           iLoggingViewLastChildIndex        = 1;
            int           iMeasMapViewLastChildIndex        = 1;
            int           iMeasGaugeViewLastChildIndex      = 1;
            int           iMeasCharConfigViewLastChildIndex = 1;
            int           iLogicBlockViewLastChildIndex     = 1;
            int           iDSGViewLastChildIndex            = 1;
            string        szSegmentViewCountMax;
            string        szMapViewCountMax;
            string        szTableViewCountMax;
            string        szCharViewCountMax;
            string        szGaugeViewCountMax;


            try
            {
                szGUILayoutXMLPath = AppDomain.CurrentDomain.BaseDirectory + "Database\\GUI Layout Databases\\" + mclsIniParser.GetSetting("Databases", "SelectedLayoutXML");
            }
            catch
            {
                szGUILayoutXMLPath = AppDomain.CurrentDomain.BaseDirectory + "Database\\Unknown.XML";
            }

            try
            {
                szMapViewCountMax = mclsIniParser.GetSetting("Program", "MapViewCountMax");
                iMapViewCountMax  = Convert.ToInt32(szMapViewCountMax);
            }
            catch
            {
                szMapViewCountMax = null;
            }

            try
            {
                szTableViewCountMax = mclsIniParser.GetSetting("Program", "TableViewCountMax");
                iTableViewCountMax  = Convert.ToInt32(szTableViewCountMax);
            }
            catch
            {
                szTableViewCountMax = null;
            }

            try
            {
                szCharViewCountMax = mclsIniParser.GetSetting("Program", "CharViewCountMax");
                iCharViewCountMax  = Convert.ToInt32(szCharViewCountMax);
            }
            catch
            {
                szCharViewCountMax = null;
            }

            try
            {
                szGaugeViewCountMax = mclsIniParser.GetSetting("Program", "GaugeViewCountMax");
                iGaugeViewCountMax  = Convert.ToInt32(szGaugeViewCountMax);
            }
            catch
            {
                szGaugeViewCountMax = null;
            }

            try
            {
                szSegmentViewCountMax = mclsIniParser.GetSetting("Program", "SegmentViewCountMax");
                iSegmentViewCountMax  = Convert.ToInt32(szSegmentViewCountMax);
            }
            catch
            {
                szSegmentViewCountMax = null;
            }

            aszGUILayout = szGUILayoutXMLPath.Split('\\');
            aszGUILayout = aszGUILayout[aszGUILayout.Length - 1].Split('.');

            while (0 < Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX].Count)
            {
                switch ((tenWindowChildType)Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].iGUILinkIndex)
                {
                case tenWindowChildType.enMeasValueView:
                {
                    if (iMeasValueCharViews < 1)
                    {
                        tclsMeasValueCharView clsMeasValueCharView
                            = new tclsMeasValueCharView(iFormIDX);
                        clsMeasValueCharView.MdiParent = this;
                        clsMeasValueCharView.Show();
                        mlstChildViews.Add(clsMeasValueCharView);
                        mlstMeasValueCharView.Add(clsMeasValueCharView);
                        iMeasValueCharViews++;
                        iMeasValueCharViewLastChildIndex = mlstChildViews.Count;
                    }
                    else
                    {
                        foreach (tclsMeasValueCharView clsMeasValueCharView in mlstMeasValueCharView)
                        {
                            clsMeasValueCharView.AddViewToList(iFormIDX);
                        }
                    }

                    mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iMeasValueCharViewLastChildIndex, tenWindowChildType.enMeasValueView);
                    iFormIDX++;
                    break;
                }

                case tenWindowChildType.enMeasTableView:
                {
                    if (iMeasTablesViews < iTableViewCountMax)
                    {
                        tclsMeasCurveMapView clsMeasCurveMapView
                            = new tclsMeasCurveMapView(iFormIDX, false);
                        clsMeasCurveMapView.MdiParent = this;
                        clsMeasCurveMapView.Show();
                        mlstChildViews.Add(clsMeasCurveMapView);
                        mlstMeasCurveMapView.Add(clsMeasCurveMapView);
                        iMeasTablesViews++;
                        iMeasTableViewLastChildIndex = mlstChildViews.Count;
                    }
                    else
                    {
                        foreach (tclsMeasCurveMapView clsMeasCurveMapView in mlstMeasCurveMapView)
                        {
                            clsMeasCurveMapView.AddViewToList(iFormIDX, false);
                        }
                    }

                    mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iMeasTableViewLastChildIndex, tenWindowChildType.enMeasTableView);
                    iFormIDX++;
                    break;
                }

                case tenWindowChildType.enLoggingView:
                {
                    tclsMeasValueLoggingView clsMeasValueLoggingView
                        = new tclsMeasValueLoggingView(iFormIDX);
                    clsMeasValueLoggingView.MdiParent = this;
                    clsMeasValueLoggingView.Show();
                    mlstChildViews.Add(clsMeasValueLoggingView);
                    mlstLoggingViews.Add(clsMeasValueLoggingView);
                    mlstMeasValueLoggingView.Add(clsMeasValueLoggingView);

                    iLoggingViewLastChildIndex = mlstChildViews.Count;
                    mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iLoggingViewLastChildIndex, tenWindowChildType.enLoggingView);
                    iFormIDX++;

                    break;
                }

                case tenWindowChildType.enMeasMapView:
                {
                    if (iMeasMapsViews < iMapViewCountMax)
                    {
                        tclsMeasCurveMapView clsMeasCurveMapView
                            = new tclsMeasCurveMapView(iFormIDX, true);
                        clsMeasCurveMapView.MdiParent = this;
                        clsMeasCurveMapView.Show();
                        mlstChildViews.Add(clsMeasCurveMapView);
                        mlstMeasCurveMapView.Add(clsMeasCurveMapView);
                        iMeasMapsViews++;
                        iMeasMapViewLastChildIndex = mlstChildViews.Count;
                    }
                    else
                    {
                        foreach (tclsMeasCurveMapView clsMeasCurveMapView in mlstMeasCurveMapView)
                        {
                            clsMeasCurveMapView.AddViewToList(iFormIDX, true);
                        }
                    }

                    mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iMeasMapViewLastChildIndex, tenWindowChildType.enMeasMapView);
                    iFormIDX++;
                    break;
                }

                case tenWindowChildType.enMeasGaugeView:
                {
                    tclsMeasValueGaugeView clsMeasValueGaugeView
                        = new tclsMeasValueGaugeView(iFormIDX);
                    clsMeasValueGaugeView.MdiParent = this;
                    clsMeasValueGaugeView.Show();
                    mlstChildViews.Add(clsMeasValueGaugeView);
                    mlstMeasValueGaugeView.Add(clsMeasValueGaugeView);
                    iMeasGaugeViewLastChildIndex = mlstChildViews.Count;
                    mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iMeasGaugeViewLastChildIndex, tenWindowChildType.enMeasGaugeView);
                    iFormIDX++;
                    break;
                }

                case tenWindowChildType.enMeasCharConfigView:
                {
                    if (null == mclsBlobSettings)
                    {
                        mclsBlobSettings           = new tclsBlobSettings(iFormIDX);
                        mclsBlobSettings.MdiParent = this;
                        mclsBlobSettings.Show();
                        mlstChildViews.Add(mclsBlobSettings);
                        iMeasCharConfigViewLastChildIndex = mlstChildViews.Count;
                        mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iMeasCharConfigViewLastChildIndex, tenWindowChildType.enMeasCharConfigView);
                    }
                    else
                    {
                        Program.vNotifyProgramEvent(tenProgramEvent.enProgramError, 0,
                                                    "Configuration view is already loaded!");
                    }

                    iFormIDX++;
                    break;
                }

                case tenWindowChildType.enMeasSegmentView:
                {
                    if (iMeasSegmentViews < 1)
                    {
                        tclsICMeasSegmentView clsMeasSegmentView
                            = new tclsICMeasSegmentView(iFormIDX);
                        clsMeasSegmentView.MdiParent = this;
                        clsMeasSegmentView.Show();
                        mlstChildViews.Add(clsMeasSegmentView);
                        mlstMeasSegmentView.Add(clsMeasSegmentView);
                        iMeasSegmentViews++;
                        iMeasSegmentViewLastChildIndex = mlstChildViews.Count;
                    }
                    else
                    {
                        foreach (tclsICMeasSegmentView clsMeasSegmentView in mlstMeasSegmentView)
                        {
                            clsMeasSegmentView.AddViewToList(iFormIDX);
                        }
                    }

                    mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iMeasSegmentViewLastChildIndex, tenWindowChildType.enMeasSegmentView);
                    iFormIDX++;
                    break;
                }

                case tenWindowChildType.enLogicBlockView:
                {
                    if (iLogicBlockViews < iLogicBlockViewCountMax)
                    {
                        tclsLogicBlockView clsLogicBlockView = new tclsLogicBlockView(iFormIDX);
                        clsLogicBlockView.MdiParent = this;
                        clsLogicBlockView.Show();
                        mlstChildViews.Add(clsLogicBlockView);
                        mlstLogicBlockView.Add(clsLogicBlockView);
                        iLogicBlockViews++;
                        iLogicBlockViewLastChildIndex = mlstChildViews.Count;
                        mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iLogicBlockViewLastChildIndex, tenWindowChildType.enLogicBlockView);
                        iFormIDX++;
                    }
                    break;
                    /* TODO multiple views */
                }

                case tenWindowChildType.enDSGView:
                {
                    if (iDSGViews < iDSGViewCountMax)
                    {
                        tclsDSG clsDSGView
                            = new tclsDSG(iFormIDX);
                        clsDSGView.MdiParent = this;
                        clsDSGView.Show();
                        mlstChildViews.Add(clsDSGView);
                        mlstDSGView.Add(clsDSGView);
                        iDSGViews++;
                        iDSGViewLastChildIndex = mlstChildViews.Count;
                    }
                    else
                    {
                        foreach (tclsDSG clsDSGView in mlstDSGView)
                        {
                            clsDSGView.AddViewToList(iFormIDX);
                        }
                    }

                    mclsNavTreeView.vAddViewNode(Program.mAPP_clsXMLConfig.mailstWindowLists[iFormIDX][0].szLabel, iFormIDX, iDSGViewLastChildIndex, tenWindowChildType.enDSGView);
                    iFormIDX++;
                    break;
                }

                default:
                {
                    break;
                }
                }
            }

            mszGUILayout = aszGUILayout[0];
            SetMDIText(null);

            this.WindowState = FormWindowState.Maximized;

            ArrangeWindowsFromINI();

            MDIStatusStrip.Items[0].Image = ConnectionImageList.Images[1];
            MDIStatusStrip.Items[0].Text  = "OFFLINE";
            MDIStatusStrip.Items[1].Text  = "Status: Application started...";

            bool boRetVal = Program.boSetCalibrationPath(AppDomain.CurrentDomain.BaseDirectory + "Database\\Calibration Databases\\default.XML", false);

            Program.vNotifyProgramEvent(tenProgramEvent.enWindowElementsLoaded, 0, null);
        }
Exemplo n.º 10
0
        public bool CommsTryConnect(tclsUDSComms clsUDSComms, string szIniFilePath, int iReceiveMaxLength)
        {
            tclsIniParser mclsIniParser;
            string        szDLL;
            string        szBaud;
            int           iBaud = 0;
            string        szDeviceSerial;
            string        szConnectionType;
            string        szCommPort;
            string        szDiagRXID;
            string        szDiagTXID;
            UInt32        u32DiagRXID = 0;
            UInt32        u32DiagTXID = 0;

            mclsUDSComms = clsUDSComms;

            mclsIniParser = new tclsIniParser(szIniFilePath);

            try
            {
                szConnectionType = mclsIniParser.GetSetting("Program", "ConnectionType");

                if (0 == String.Compare(szConnectionType, "CANAL"))
                {
                    menCommsType = tenCommsType.enCANAL;
                }
                if (0 == String.Compare(szConnectionType, "CANRP1210"))
                {
                    menCommsType = tenCommsType.enCANRP1210;
                }
                if (0 == String.Compare(szConnectionType, "USBCDC"))
                {
                    menCommsType = tenCommsType.enUSBCDC;
                }
                if (0 == String.Compare(szConnectionType, "Serial"))
                {
                    menCommsType = tenCommsType.enSerial;
                }
                if (0 == String.Compare(szConnectionType, "CANLIBKVASER"))
                {
                    menCommsType = tenCommsType.enCANLIBKVASER;
                }
            }
            catch
            {
                szConnectionType = null;
            }

            try
            {
                szBaud = mclsIniParser.GetSetting("Devices", "ComsBaud");
                iBaud  = Convert.ToInt16(szBaud);
            }
            catch
            {
                szBaud = null;
            }

            try
            {
                szDeviceSerial = mclsIniParser.GetSetting("Devices", "ComsDeviceSerial");
            }
            catch
            {
                szDeviceSerial = null;
            }

            try
            {
                szDLL = mclsIniParser.GetSetting("Devices", "RP1210Lib");
            }
            catch
            {
                szDLL = "Unknown";
            }

            try
            {
                szDiagRXID = mclsIniParser.GetSetting("Devices", "ComsDiagIDRX");

                u32DiagRXID = Convert.ToUInt32(szDiagRXID);
            }
            catch
            {
                szDiagRXID = null;
            }

            try
            {
                szDiagTXID = mclsIniParser.GetSetting("Devices", "ComsDiagIDTX");

                u32DiagTXID = Convert.ToUInt32(szDiagTXID);
            }
            catch
            {
                szDiagTXID = null;
            }

            try
            {
                szCommPort = mclsIniParser.GetSetting("Devices", "ComsPort");
            }
            catch
            {
                szCommPort = null;
            }

            switch (menCommsType)
            {
            case tenCommsType.enCANAL:
            {
                if ((null != szDeviceSerial) && (null != szBaud) && (null != szDiagRXID))
                {
                    try
                    {
                        mclsUSB2CAN64Interface = new MDACUSB2CAN64Interface.tclsMDACUSB2CAN64Interface(szDeviceSerial, szBaud);
                        mclsUSB2CAN64Interface.DataReceived +=
                            new MDACUSB2CAN64Interface.tclsMDACUSB2CAN64Interface.DataReceivedEventHandler(vRXCallBackUDSOverCAN2USB);
                        mclsUSB2CAN64Interface.SetHeaderSize(10);
                        mboChannelActive = mclsUSB2CAN64Interface.Connect(iBaud, (int)u32DiagRXID, (int)u32DiagTXID);
                    }
                    catch
                    {
                        mboChannelActive = false;
                    }
                }

                break;
            }

            case tenCommsType.enCANLIBKVASER:
            {
                if ((null != szDeviceSerial) && (null != szBaud) && (null != szDiagRXID))
                {
                    try
                    {
                        mclsUDSDotNet64Interface = new MDACUDSDotNet64Interface.tclsMDACUDSDotNet64Interface();
                        mclsUDSDotNet64Interface.DataReceived +=
                            new MDACUDSDotNet64Interface.tclsMDACUDSDotNet64Interface.DataReceivedEventHandler(vRXCallBackUDSOverCANLIBKVASER);
                        mclsUDSDotNet64Interface.SetHeaderSize(10);
                        mboChannelActive = mclsUDSDotNet64Interface.Connect(iBaud, szDLL, u32DiagRXID);
                    }
                    catch
                    {
                        mboChannelActive = false;
                    }
                }

                break;
            }

            case tenCommsType.enUSBCDC:
            {
                if ((null != szBaud) && (null != szCommPort))
                {
                    try
                    {
                        mclsUSBInterface = new MDACUSBInterface.MDACUSBInterface();
                        mclsUSBInterface.DataReceived +=
                            new MDACUSBInterface.MDACUSBInterface.DataReceivedEventHandler(vRXCallBackUDSOverUSB);
                        mclsUSBInterface.SetHeaderSize(10);
                        mboChannelActive = mclsUSBInterface.Connect(MDACUSBInterface.MDACUSBInterface.tenClassType.enUSBVirtualComm,
                                                                    0, 0, 0, 0, szCommPort, 1000 * iBaud);

                        if (true == mboChannelActive)
                        {
                            mUSBCDCSubscribed = true;
                        }
                    }
                    catch
                    {
                    }
                }

                break;
            }
            }

            return(mboChannelActive);
        }
Exemplo n.º 11
0
        private void GetColorsFromINI()
        {
            tclsIniParser mclsIniParser = new tclsIniParser(AppDomain.CurrentDomain.BaseDirectory + "Database\\GUI Layout Databases\\GUI Layout Rabbit 1_0 ECU.INI");

            string szBgColorTop; string szBgColorBottom; string szGridColorSolid; string szGridColorDashed; string szGridColorFore;

            string[] aszLoggingColor = new string[20];
            string[] aszSplitRGB;
            maclsLoggingColor = new Color[20];
            int iColorIDX;

            try
            {
                szBgColorTop = mclsIniParser.GetSetting("Logging Options", "BgColorTop");
                szBgColorTop = null == szBgColorTop ? "255,255,255" : szBgColorTop;
            }
            catch
            {
                szBgColorTop = "255,255,255";
            }

            try
            {
                szBgColorBottom = mclsIniParser.GetSetting("Logging Options", "BgColorBottom");
                szBgColorBottom = null == szBgColorBottom ? "255,255,255" : szBgColorBottom;
            }
            catch
            {
                szBgColorBottom = "255,255,255";
            }

            try
            {
                szGridColorSolid = mclsIniParser.GetSetting("Logging Options", "GridColorSolid");
                szGridColorSolid = null == szGridColorSolid ? "255,255,255" : szGridColorSolid;
            }
            catch
            {
                szGridColorSolid = "255,255,255";
            }

            try
            {
                szGridColorDashed = mclsIniParser.GetSetting("Logging Options", "GridColorDashed");
                szGridColorDashed = null == szGridColorDashed ? "255,255,255" : szGridColorDashed;
            }
            catch
            {
                szGridColorDashed = "255,255,255";
            }

            try
            {
                szGridColorFore = mclsIniParser.GetSetting("Logging Options", "GridColorFore");
                szGridColorFore = null == szGridColorFore ? "255,255,255" : szGridColorFore;
            }
            catch
            {
                szGridColorFore = "255,255,255";
            }


            for (iColorIDX = 1; iColorIDX < 20; iColorIDX++)
            {
                try
                {
                    aszLoggingColor[iColorIDX - 1] = mclsIniParser.GetSetting("Logging Options", "LoggingColor" + iColorIDX.ToString());
                    aszLoggingColor[iColorIDX - 1] = null == aszLoggingColor[iColorIDX - 1] ? "255,255,255" : aszLoggingColor[iColorIDX - 1];
                }
                catch
                {
                    aszLoggingColor[iColorIDX - 1] = "255,255,255";
                }
            }

            aszSplitRGB = szBgColorTop.Split(',');
            //mclsBgColorTop = System.Drawing.Color.FromArgb(Convert.ToInt16(aszSplitRGB[0]), Convert.ToInt16(aszSplitRGB[1]), Convert.ToInt16(aszSplitRGB[2]));

            aszSplitRGB = szBgColorBottom.Split(',');
            //mclsBgColorBottom = System.Drawing.Color.FromArgb(Convert.ToInt16(aszSplitRGB[0]), Convert.ToInt16(aszSplitRGB[1]), Convert.ToInt16(aszSplitRGB[2]));

            aszSplitRGB = szGridColorSolid.Split(',');
            //mclsGridColorSolid = System.Drawing.Color.FromArgb(Convert.ToInt16(aszSplitRGB[0]), Convert.ToInt16(aszSplitRGB[1]), Convert.ToInt16(aszSplitRGB[2]));

            aszSplitRGB = szGridColorDashed.Split(',');
            //mclsGridColorDashed = System.Drawing.Color.FromArgb(Convert.ToInt16(aszSplitRGB[0]), Convert.ToInt16(aszSplitRGB[1]), Convert.ToInt16(aszSplitRGB[2]));

            aszSplitRGB = szGridColorFore.Split(',');
            //mclsGridColorFore = System.Drawing.Color.FromArgb(Convert.ToInt16(aszSplitRGB[0]), Convert.ToInt16(aszSplitRGB[1]), Convert.ToInt16(aszSplitRGB[2]));

            for (iColorIDX = 1; iColorIDX < 20; iColorIDX++)
            {
                aszSplitRGB = aszLoggingColor[iColorIDX - 1].Split(',');
                maclsLoggingColor[iColorIDX - 1] = System.Drawing.Color.FromArgb(Convert.ToInt16(aszSplitRGB[0]), Convert.ToInt16(aszSplitRGB[1]), Convert.ToInt16(aszSplitRGB[2]));
            }
        }