public tclsMeasureSelect(int iFormIDX, Form parentForm)
        {
            miFormIDX   = iFormIDX;
            mParentForm = (tclsMeasValueGaugeView)parentForm;
            InitializeComponent();

            comboBoxGaugeVars.DrawMode  = DrawMode.OwnerDrawFixed;
            comboBoxGaugeVars.DrawItem += new DrawItemEventHandler(comboBoxGaugeVars_DrawItem);

            mboDrawBold = new bool[tclsASAM.milstAvailableMeasList.Count];
            LoadComboBoxLoggingVars();
        }
Beispiel #2
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);
        }