Example #1
0
        void OpenEcuCodingForm()
        {
            //! DEBUG
            //Global.EcuList.CurrentEcu = new Battery_ECU();

            EcuModelId ecuModel = EcuModelId.none;

            if (DiagAddress >= (byte)EcuDiagAddress.GENERAL_ECU_DIAG_ID && DiagAddress < (byte)EcuDiagAddress.DISPLAY_ECU_DIAG_ID)
            {
                ecuModel = EcuModelId.gEcu;
            }
            else if (DiagAddress >= (byte)EcuDiagAddress.DISPLAY_ECU_DIAG_ID && DiagAddress < (byte)EcuDiagAddress.MAIN_ECU_DIAG_ID)
            {
                ecuModel = EcuModelId.dEcu;
            }
            else if (DiagAddress >= (byte)EcuDiagAddress.MAIN_ECU_DIAG_ID && DiagAddress < (byte)EcuDiagAddress.BATTERY_ECU_ID)
            {
                ecuModel = EcuModelId.mEcu;
            }
            else if (DiagAddress >= (byte)EcuDiagAddress.BATTERY_ECU_ID)
            {
                ecuModel = EcuModelId.bms;
            }


            if (ecuModel == EcuModelId.none)
            {
                return;
            }

            codingForm = null;

            switch (Global.EcuList.CurrentEcu.ModelId)
            {
            case EcuModelId.bms:
                codingForm = new Bms_ECUCoding();
                break;

            case EcuModelId.gEcu:
                codingForm = new General_ECUCoding();
                break;

            case EcuModelId.mEcu:
                codingForm = new Mcu_ECUCoding();
                break;

            case EcuModelId.dEcu:
                codingForm = new Display_ECUCoding();
                break;
            }


            grid.Children.Clear();
            if (codingForm != null)
            {
                codingForm.CurrentEcu = Global.EcuList.CurrentEcu;
                grid.Children.Add(codingForm as UIElement);
            }
        }
Example #2
0
 private void EcuCoding_Loaded(object sender, RoutedEventArgs e)
 {
     codingForm = null;
     OpenEcuCodingForm();
     //Download();
 }