Example #1
0
 public void UnLoadPage()
 {
     IsReadly = false;
     Services.Device.EndOnTimeTask(Service.PLC.OnTimeTasks.GetAdditionalInfo);
     Services.Device.EndOnTimeTask(Service.PLC.OnTimeTasks.GetTiji2DCurve);
     Services.Device.EndOnTimeTask(Service.PLC.OnTimeTasks.GetTiji3DCurve);
     foreach (var item in SettingPanelsDic.Values)
     {
         var temp = item as UserControls.SettingPanels.DiagramPanel;
         if (temp != null)
         {
             temp.PanelUnLoad();
         }
         item.Dispose();
     }
     SettingPanelsDic.Clear();
     Services.RealyDataPre.Begin();
     this.Dispose();
 }
Example #2
0
        private UserControls.SettingPanels.ISettingPanel GetPanelAndShow(String name)
        {
            if (CurrentSettingPanel != null)
            {
                CurrentSettingPanel.Hide();
                var temp = CurrentSettingPanel as UserControls.SettingPanels.DiagramPanel;
                if (temp != null)
                {
                    temp.PanelUnLoad();
                }
            }
            switch (name)
            {
            case "btn1":
                btn2.BaseColor   = Color.White;
                btn2.ButtonColor = Color.White;
                btn2.BackColor   = Color.Transparent;
                btn1.BackColor   = Color.Transparent;
                btn1.BaseColor   = Color.FromArgb(245, 130, 31);
                btn1.ButtonColor = Color.FromArgb(245, 130, 31);
                btn8.ForeColor   = Color.FromArgb(245, 130, 31);
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.ECUSetting);
                break;

            case "btn2":
                System.Diagnostics.Debug.WriteLine("高级设置");
                btn1.BaseColor   = Color.White;
                btn1.ButtonColor = Color.White;
                btn2.BackColor   = Color.Transparent;
                btn1.BackColor   = Color.Transparent;
                btn2.BaseColor   = Color.FromArgb(245, 130, 31);
                btn2.ButtonColor = Color.FromArgb(245, 130, 31);
                btn8.ForeColor   = Color.FromArgb(245, 130, 31);
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.ECUSetting);
                //   Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.InjectorCorrection);
                break;

            case "btn3":
                btn1.Visible = false;
                btn2.Visible = false;
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.ECUSetting);
                break;

            case "btn4":
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.MAPCalibrationParams);
                break;

            case "MAPbtn":
                btn1.Visible = false;
                btn2.Visible = false;
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.CorrectionSetting);    //LDC MAP删除
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.MAPCalibrationParams);
                //   Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.ECUCorrectionParams);//LDC MAP删除
                break;

            case "btn7":
                btn1.Visible = false;
                btn2.Visible = false;
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.ECUSetting);
                break;

            case "btn8":
                btn1.Visible     = true;
                btn2.Visible     = true;
                btn2.BaseColor   = Color.White;
                btn2.ButtonColor = Color.White;
                btn2.BackColor   = Color.Transparent;
                btn1.BackColor   = Color.Transparent;
                btn1.BaseColor   = Color.FromArgb(245, 130, 31);
                btn1.ButtonColor = Color.FromArgb(245, 130, 31);
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.ECUSetting);
                break;

            case "btn9":    //附加设定
                btn1.Visible = false;
                btn2.Visible = false;
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.Additional);
                break;

            case "OBDSETBtn":
                btn1.Visible = false;
                btn2.Visible = false;
                //    AdvancedSETbtn.ForeColor = Color.FromArgb(46, 106, 179);
                Services.Stroe.WaitReadyIfPLC(IGT.Service.Storage.SettingItems.ECUSetting);
                break;
            }
            if (!SettingPanelsDic.ContainsKey(name))
            {
                switch (name)
                {
                case "btn1":
                    CurrentSettingPanel = new UserControls.SettingPanels.CarParametersSettings();
                    break;

                case "btn2":
                    CurrentSettingPanel = new UserControls.SettingPanels.SwitchSettingsPanel();
                    break;

                case "btn3":
                    CurrentSettingPanel = new UserControls.SettingPanels.SensorsSettingsPanel();
                    break;

                case "btn4":
                    CurrentSettingPanel = new UserControls.SettingPanels.MAPCalibrationSettingPanel();
                    break;

                case "MAPbtn":
                    CurrentSettingPanel = new UserControls.SettingPanels.DiagramPanel();
                    break;

                case "btn7":
                    CurrentSettingPanel = new UserControls.SettingPanels.AdvancedSettingPanel();
                    break;

                case "btn8":
                    CurrentSettingPanel = new UserControls.SettingPanels.CarParametersSettings();
                    break;

                case "btn9":
                    CurrentSettingPanel = new UserControls.SettingPanels.AdditionalSettingsPanel();
                    Services.Device.BeginOnTimeTask(Service.PLC.OnTimeTasks.GetAdditionalInfo);
                    break;

                case "OBDSETBtn":
                    CurrentSettingPanel = new UserControls.SettingPanels.OBDSettingPanel();
                    break;

                default:
                    throw new ArgumentException("name");
                }
                (CurrentSettingPanel as Control).Dock = DockStyle.Fill;
                SettingPanelsDic.Add(name, CurrentSettingPanel);
                panelSettings.Controls.Add(CurrentSettingPanel as Control);
            }
            else
            {
                CurrentSettingPanel = SettingPanelsDic[name];
            }
            CurrentSettingPanel.ShowData();
            CurrentSettingPanel.Show();
            return(CurrentSettingPanel);
        }