Example #1
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{1} (*.{0})|*.{0}", FileExtensionEnum.ItgBind, FileExtensionEnum.ItgBind.GetDescription());
            myOpenFileDialog.Title            = "选择方法";
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderMInteg;
            if (myOpenFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            this._model = BindModel.ReadModel <IntegrateModel>(myOpenFileDialog.FileName);



            //检查子方法是否存在
            List <string> notExitFiles = this._model.CheckModelNotExist();

            if (notExitFiles.Count > 0)
            {
                MessageBox.Show(string.Format("以下方法不存在,未被加载:\n{0}", string.Join("\n", notExitFiles)));
                return;
            }
            this.initGrid();
            this.showModel();
            this.setWightWithModel();

            this.btnAddModel.Enabled = true;
            this.btnSave.Enabled     = true;
            this.setTitle();
        }
Example #2
0
        private void loadModel()
        {
            var ftype        = (FileExtensionEnum)this.type;
            var tempfullName = Path.Combine(HttpContext.Current.Server.MapPath("~/"), this.path);

            switch (ftype)
            {
            case FileExtensionEnum.Allmethods:
                if (this._mBind == null)
                {
                    this._mBind      = BindModel.ReadModel <BindModel>(tempfullName);
                    this._components = this._mBind.GetComponents();
                }
                break;

            case FileExtensionEnum.PLSBind:
                if (this._mPLS == null)
                {
                    this._mPLS       = BindModel.ReadModel <PLSModel>(tempfullName);
                    this._components = this._mPLS.GetComponents();
                }
                break;

            case FileExtensionEnum.IdLib:
                if (this._mId == null)
                {
                    this._mId        = BindModel.ReadModel <IdentifyModel>(tempfullName);
                    this._components = this._mId.GetComponents();
                }
                break;

            case FileExtensionEnum.FitLib:
                if (this._mFitting == null)
                {
                    this._mFitting   = BindModel.ReadModel <FittingModel>(tempfullName);
                    this._components = this._mFitting.GetComponents();
                }
                break;

            case FileExtensionEnum.PLS1:
            case FileExtensionEnum.PLSANN:
                if (this._mPLS1 == null)
                {
                    this._mPLS1      = BindModel.ReadModel <PLSSubModel>(tempfullName);
                    this._components = this._mPLS1.GetComponents();
                }
                break;

            case FileExtensionEnum.ItgBind:
                if (this._itgSub == null)
                {
                    this._itgSub     = BindModel.ReadModel <IntegrateModel>(tempfullName);
                    this._components = this._itgSub.GetComponents();
                }
                break;

            default:
                break;
            }
        }
Example #3
0
        private void addModel(string fullpath)
        {
            FileInfo f      = new FileInfo(fullpath);
            string   fexten = f.Extension.ToUpper().Replace(".", "");

            if (fexten == FileExtensionEnum.IdLib.ToString().ToUpper())
            {
                var model = BindModel.ReadModel <IdentifyModel>(fullpath);
                if (!this._model.AddID(model))
                {
                    MessageBox.Show("该方法已经存在!");
                }
            }
            else if (fexten == FileExtensionEnum.FitLib.ToString().ToUpper())
            {
                var model = BindModel.ReadModel <FittingModel>(fullpath);
                if (!this._model.AddFit(model))
                {
                    MessageBox.Show("该方法已经存在!");
                }
            }
            else if (fexten == FileExtensionEnum.PLSBind.ToString().ToUpper())
            {
                var submodel = BindModel.ReadModel <PLSModel>(fullpath);
                if (this._model.Itg != null && MessageBox.Show("信息提示", "该方法包包含有集成包,是否替换?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
                if (this._model.PLS != null)
                {
                    if (MessageBox.Show("已经存在,是否替换", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.Yes)
                    {
                        return;
                    }
                }
                this._model.PLS1Path = submodel.FullPath;
                this._model.ItgPath  = null;
            }
            else if (fexten == FileExtensionEnum.ItgBind.ToString().ToUpper())
            {
                var submodel = BindModel.ReadModel <IntegrateModel>(fullpath);
                if (this._model.PLS != null && MessageBox.Show("信息提示", "该方法包包含有PLS捆绑模型,是否替换?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
                {
                    return;
                }
                if (this._model.Itg != null)
                {
                    if (MessageBox.Show("已经存在,是否替换", "信息提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.Yes)
                    {
                        return;
                    }
                }
                this._model.PLS1Path = null;
                this._model.ItgPath  = submodel.FullPath;
            }
            this.fillGrid();
        }
Example #4
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (this.cheakSave())
            {
                return;
            }
            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{1} (*.{0})|*.{0}", FileExtensionEnum.PLSBind, FileExtensionEnum.PLSBind.GetDescription());
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderMModel;
            if (myOpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this._model = BindModel.ReadModel <PLSModel>(myOpenFileDialog.FileName);
                if (this._model != null)
                {
                    if (this._model.LibBase == null || this._model.LibBase.Count == 0)
                    {
                        MessageBox.Show("该捆绑模型不含光谱库,不能修改!", "信息提示");
                    }
                    else
                    {
                        lblLibIntro.Text = this._model.ToString();
                    }

                    this._nodes.Clear();
                    foreach (var m in this._model.SubModels)
                    {
                        var step = 1;
                        var tag  = true;
                        if (m.LibBase == null || m.LibBase.Count == 0 || m.Trained)
                        {
                            step = 4;
                            tag  = false;
                        }

                        this._nodes.Add(new MyTreeNode()
                        {
                            IsFinished  = false,
                            ToolTipText = "双击可编辑子模型",
                            PLS         = new PLSFormContent()
                            {
                                ActiveStep      = step,
                                VResult         = null,
                                CVResult        = null,
                                Model           = m,
                                FlowPanelEnable = tag
                            }
                        });
                    }
                    this.treeInit();
                }
            }
        }
Example #5
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{1} (*.{0})|*.{0}", FileExtensionEnum.Allmethods, FileExtensionEnum.Allmethods.GetDescription());
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderMMethod;
            if (myOpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this._model = BindModel.ReadModel <BindModel>(myOpenFileDialog.FileName);
                if (this._model != null)
                {
                    this.fillGrid();
                }
            }
        }
Example #6
0
        private void btnLoadModel_Click(object sender, EventArgs e)
        {
            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{1} (*.{0})|*.{0}", FileExtensionEnum.IdLib, FileExtensionEnum.IdLib.GetDescription());
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderMId;
            if (myOpenFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            this._baseModel = BindModel.ReadModel <IdentifyModel>(myOpenFileDialog.FileName);
            ToolTip tip = new ToolTip();

            tip.SetToolTip(this.btnLoadModel, myOpenFileDialog.FileName);
            this.clear();
        }
Example #7
0
        private void btnLoadModel_Click(object sender, EventArgs e)
        {
            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{0} (*.{1})|*.{1}", FileExtensionEnum.PLSBind.GetDescription(), FileExtensionEnum.PLSBind);
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderBlendMod;
            if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    this._model = BindModel.ReadModel <PLSModel>(myOpenFileDialog.FileName);
                    if (this._model.SubModels.Count < 2)
                    {
                        MessageBox.Show("该捆绑模型不是混兑比例光谱的模型");
                        this._model = null;
                        return;
                    }

                    //验证是不是混兑模型
                    foreach (var m in this._model.SubModels)
                    {
                        if (m.Method != PLSMethodEnum.PLSMix)
                        {
                            MessageBox.Show("该捆绑模型不是混兑比例光谱的模型");
                            this._model = null;
                            return;
                        }
                    }

                    //设置按钮
                    this.btnAddFromLib.Enabled = true;
                    this.btnPredict.Enabled    = true;
                    this.btnSpec1.Enabled      = this._model.SubModels.Count > 0;
                    this.btnSpec2.Enabled      = this._model.SubModels.Count > 1;
                    this.btnSpec3.Enabled      = this._model.SubModels.Count > 2;
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    log.Error(ex);
                }
            }
        }
Example #8
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (this.cheakSave())
            {
                return;
            }

            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{1} (*.{0})|*.{0}", FileExtensionEnum.FitLib, FileExtensionEnum.FitLib.GetDescription());
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderMFit;
            if (myOpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                this._model = BindModel.ReadModel <FittingModel>(myOpenFileDialog.FileName);
                if (this._model != null)
                {
                    this.libGridView.Specs    = this._model.LibBase;
                    this.preForFit.Processors = this._model.Filters.Select(f => new RIPP.NIR.Data.Preprocesser()
                    {
                        Filter = f,
                        Statu  = WorkStatu.NotSet
                    }).ToList();
                    this.setIdParams1.Model     = this._model;
                    this.setTQ1.Model           = this._model;
                    this.resultForm1.Model      = this._model;
                    this.calibResultForm1.Model = this._model;


                    if (this._model.LibBase == null)
                    {
                        MessageBox.Show("该模型没有存储建模所需的光谱库,无法对模型进行修改,只能使用外部验证功能!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        this.flowControl1.Active(6);
                    }
                    else
                    {
                        this.flowControl1.Active(1);
                        this.flowControl1.Enabled = true;
                    }
                    this._model.Edited = false;
                }
            }
            this.setTitle();
        }
Example #9
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{1} (*.{0})|*.{0}", FileExtensionEnum.PLS1, FileExtensionEnum.PLS1.GetDescription());
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderMModelLib;
            myOpenFileDialog.Multiselect      = true;
            if (myOpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    foreach (var f in myOpenFileDialog.FileNames)
                    {
                        var model = BindModel.ReadModel <PLSSubModel>(f);
                        if (model == null)
                        {
                            return;
                        }
                        for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
                        {
                            var row = this.dataGridView1.Rows[i] as mydataRow;
                            if (row != null && row.Model.Comp.Name == model.Comp.Name)
                            {
                                MessageBox.Show("所添加的子模型对应的性质已经存在!");
                                row.Selected = true;
                                return;
                            }
                        }
                        var myrow = new mydataRow()
                        {
                            Model = model
                        };
                        myrow.CreateCells(this.dataGridView1, model.Comp.Name);
                        this.dataGridView1.Rows.Add(myrow);
                    }
                }
                catch
                {
                }
            }
        }
Example #10
0
        private void addModel(string fullpath)
        {
            FileInfo f      = new FileInfo(fullpath);
            string   fexten = f.Extension.ToUpper().Replace(".", "");

            try
            {
                if (fexten == FileExtensionEnum.IdLib.ToString().ToUpper())
                {
                    var model = BindModel.ReadModel <IdentifyModel>(fullpath);
                    if (!this._model.AddID(model))
                    {
                        MessageBox.Show("该方法已经存在!");
                    }
                    else
                    {
                        this.showModel();
                    }
                }
                else if (fexten == FileExtensionEnum.FitLib.ToString().ToUpper())
                {
                    var model = BindModel.ReadModel <FittingModel>(fullpath);
                    if (!this._model.AddFit(model))
                    {
                        MessageBox.Show("该方法已经存在,或者该方法的参数与与有拟合库参数不一致!");
                    }
                    else
                    {
                        this.showModel();
                    }
                }
                else if (fexten == FileExtensionEnum.PLS1.ToString().ToUpper() || fexten == FileExtensionEnum.PLSANN.ToString().ToUpper())
                {
                    var model = BindModel.ReadModel <PLSSubModel>(fullpath);
                    var tag   = false;
                    if (model.AnnType != PLSAnnEnum.None)
                    {
                        tag = this._model.CheckPLSIsExist(model, false);
                    }
                    else
                    {
                        tag = this._model.CheckPLSIsExist(model, true);
                    }
                    if (tag)
                    {
                        if (MessageBox.Show("信息提示!", "该模型已经存在,是否覆盖原有模型?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.Yes)
                        {
                            tag = true;
                        }
                    }
                    if (!tag)
                    {
                        if (model.AnnType != PLSAnnEnum.None)
                        {
                            this._model.AddAnn(model);
                        }
                        else
                        {
                            this._model.AddPLS1(model);
                        }
                        this.showModel();
                    }
                }
            }
            catch
            {
                MessageBox.Show("读取方法出错,请检查文件!");
            }
            this.getDataFromControls();
            this.setWightWithModel();
        }
Example #11
0
        private FilesStatus upload(Stream inputStream, string fileName, HttpContext context)
        {
            var statu = new FilesStatus();

            var filename     = RIPP.Web.Chem.Tools.Common.GetRnd(10, true, true, false) + Path.GetExtension(fileName);
            var tempfullName = Path.Combine(StorageRoot, filename);

            statu.progress = "1.0";
            statu.size     = (int)inputStream.Length;
            statu.name     = fileName;
            try
            {
                //先保存在服务器一个临时文件
                using (var fs = new FileStream(tempfullName, FileMode.Append, FileAccess.Write))
                {
                    var buffer = new byte[1024];
                    var l      = inputStream.Read(buffer, 0, 1024);
                    while (l > 0)
                    {
                        fs.Write(buffer, 0, l);
                        l = inputStream.Read(buffer, 0, 1024);
                    }
                    fs.Flush();
                    fs.Close();
                }
            }
            catch
            {
                statu.error = "服务器错误,上传文件失败!";
                return(statu);
            }

            //根据文件后缀尝试打开文件
            var   ftype   = BindModel.CheckType(tempfullName);
            model dbmodel = new model();
            spec  sp      = new spec();

            try
            {
                statu.type   = ftype.GetDescription();
                dbmodel.path = Path.Combine(RIPP.Web.Chem.Tools.Common.GetUploadPath(), filename);
                sp.path      = dbmodel.path;
                switch (ftype)
                {
                case FileExtensionEnum.Allmethods:
                    var mBind = BindModel.ReadModel <BindModel>(tempfullName);
                    statu.description  = mBind.ToString();
                    dbmodel.createtime = mBind.CreateTime;
                    dbmodel.name       = mBind.Name;
                    // ;
                    // dbmodel.type = (int)ftype;
                    //  dbmodel.
                    break;

                case FileExtensionEnum.PLSBind:
                    var mPLS = BindModel.ReadModel <PLSModel>(tempfullName);
                    statu.description  = mPLS.ToString();
                    dbmodel.createtime = mPLS.CreateTime;
                    dbmodel.name       = mPLS.Name;
                    break;

                case FileExtensionEnum.IdLib:
                    var mId = BindModel.ReadModel <IdentifyModel>(tempfullName);
                    statu.description  = mId.ToString();
                    dbmodel.createtime = mId.CreateTime;
                    dbmodel.name       = mId.Name;
                    break;

                case FileExtensionEnum.FitLib:
                    var mFitting = BindModel.ReadModel <FittingModel>(tempfullName);
                    statu.description  = mFitting.ToString();
                    dbmodel.createtime = mFitting.CreateTime;
                    dbmodel.name       = mFitting.Name;
                    break;

                case FileExtensionEnum.PLS1:
                case FileExtensionEnum.PLSANN:
                    var mPLS1 = BindModel.ReadModel <PLSSubModel>(tempfullName);
                    statu.description  = mPLS1.ToString();
                    dbmodel.createtime = mPLS1.CreateTime;
                    dbmodel.name       = mPLS1.Name;
                    break;

                case FileExtensionEnum.ItgBind:
                    var itgSub = BindModel.ReadModel <IntegrateModel>(tempfullName);
                    statu.description  = itgSub.ToString();
                    dbmodel.createtime = itgSub.CreateTime;
                    dbmodel.name       = itgSub.Name;
                    break;

                case FileExtensionEnum.Spec:
                default:
                    var s = new Spectrum(tempfullName);
                    ftype             = FileExtensionEnum.Spec;
                    sp.Spec           = s;
                    sp.name           = Path.GetFileName(fileName);
                    statu.description = "光谱文件";
                    break;
                }
            }
            catch (Exception ex)//读取文件失败
            {
                statu.error = "上传的文件类型有误,服务器无法识别,上传文件失败!";

                if (File.Exists(tempfullName))
                {
                    File.Delete(tempfullName);
                }
                return(statu);
            }


            //根据文件类型保存数据库
            using (var db = new RIPPWebEntities())
            {
                if (ftype != FileExtensionEnum.Unkown)
                {
                    var user = RIPP.Web.Chem.Tools.Common.Get_User;
                    if (user == null)
                    {
                        var uid = Convert.ToInt32(context.Request["uid"]);
                        user = db.S_User.Where(d => d.ID == uid).FirstOrDefault();
                    }

                    if (ftype == FileExtensionEnum.Spec)//光谱
                    {
                        if (RIPP.Web.Chem.Tools.Common.UserCanPredict(user))
                        {
                            sp.addtime = DateTime.Now;
                            sp.ext     = Path.GetExtension(fileName).Substring(1);
                            sp.uid     = user.ID;
                            sp.gid     = user.GroupID;
                            db.spec.Add(sp);
                            db.SaveChanges();
                            statu.deleteType = "DELETE";
                            statu.deleteUrl  = "/upload/UploadHandler.ashx?t=s&id=" + sp.id;
                            statu.url        = "/admin/spec/detail/" + sp.id;
                            statu.id         = sp.id;

                            File.Move(tempfullName, Path.Combine(HttpContext.Current.Server.MapPath("~/"), sp.path));//移动刚才上传的临时文件
                        }
                        else
                        {
                            statu.error = "您无权上传光谱文件,请与管理员联系。";
                            if (File.Exists(tempfullName))
                            {
                                File.Delete(tempfullName);
                            }
                        }
                    }
                    else//模型
                    {
                        if (user.HasRole(RoleEnum.Administrator) || user.HasRole(RoleEnum.Engineer))
                        {
                            dbmodel.addtime = DateTime.Now;
                            dbmodel.type    = (int)ftype;
                            dbmodel.uid     = user.ID;
                            dbmodel.gid     = user.GroupID;
                            db.model.Add(dbmodel);
                            db.SaveChanges();
                            statu.deleteType = "DELETE";
                            statu.deleteUrl  = "/upload/UploadHandler.ashx?t=m&id=" + dbmodel.id;
                            statu.url        = "/admin/model/detail/" + dbmodel.id;
                            statu.id         = dbmodel.id;
                            File.Move(tempfullName, Path.Combine(HttpContext.Current.Server.MapPath("~/"), dbmodel.path));//移动刚才上传的临时文件
                        }
                        else
                        {
                            statu.error = "您无权上传模型文件,请与管理员联系。";
                            if (File.Exists(tempfullName))
                            {
                                File.Delete(tempfullName);
                            }
                        }
                    }
                }
            }

            return(statu);
        }
Example #12
0
        private void btnLoadModel_Click(object sender, EventArgs e)
        {
            OpenFileDialog myOpenFileDialog = new OpenFileDialog();

            myOpenFileDialog.Filter           = string.Format("{0} (*.{1})|*.{1}", FileExtensionEnum.PLSBind.GetDescription(), FileExtensionEnum.PLSBind);
            myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderBlendMod;
            if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
            {
                var m = BindModel.ReadModel <PLSModel>(myOpenFileDialog.FileName);
                if (m == null || lib == null)
                {
                    return;
                }
                if (m.SubModels.Count != this.lib.Components.Count)
                {
                    MessageBox.Show(string.Format("参与混兑计算的光谱数量为{0},加载的捆绑模型子模型数据为{1},不匹配。", this.lib.Components.Count, m.SubModels.Count));
                    return;
                }

                this.toolStrip2.Enabled   = false;
                this.btnLoadModel.Text    = "正在计算";
                this.progressBar1.Visible = true;
                Action a = () =>
                {
                    this.model          = Serialize.DeepClone <PLSModel>(m);
                    this.model.MixSpecs = new List <Spectrum>();
                    if (s1 != null)
                    {
                        this.model.MixSpecs.Add(s1);
                    }
                    if (s2 != null)
                    {
                        this.model.MixSpecs.Add(s2);
                    }
                    if (s3 != null)
                    {
                        this.model.MixSpecs.Add(s3);
                    }


                    int i = 0;
                    foreach (var sm in this.model.SubModels)
                    {
                        sm.Comp = this.lib.Components[i];
                        sm.Train(this.lib);
                        var cvlst = sm.CrossValidation(this.lib);
                        if (this.specGridView1.InvokeRequired)
                        {
                            ThreadStart s = () => { this.add(cvlst, i); };
                            this.specGridView1.Invoke(s);
                        }
                        else
                        {
                            this.add(cvlst, i);
                        }
                        i++;
                    }
                    if (this.toolStrip2.InvokeRequired)
                    {
                        ThreadStart s = () =>
                        {
                            this.progressBar1.Visible = false;
                            this.btnLoadModel.Text    = "应用模型";
                            this.toolStrip2.Enabled   = true;
                        };
                        this.toolStrip2.Invoke(s);
                    }
                    else
                    {
                        this.progressBar1.Visible = false;
                        this.btnLoadModel.Text    = "应用模型";
                        this.toolStrip2.Enabled   = true;
                    }
                };
                a.BeginInvoke(null, null);
            }
        }
Example #13
0
        private void btnModelLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = string.Format("所有方法文件 (*.{0};*.{2};*.{4};*.{6};*.{8};*.{10};*.{12})|*.{0};*.{2};*.{4};*.{6};*.{8};*.{10};*.{12}|{1} (*.{0})|*.{0}|{3} (*.{2})|*.{2}|{5} (*.{4})|*.{4}|{7} (*.{6})|*.{6}|{9} (*.{8})|*.{8}|{11} (*.{10})|*.{10}|{13} (*.{12})|*.{12}",
                                       FileExtensionEnum.Allmethods,
                                       FileExtensionEnum.Allmethods.GetDescription(),
                                       FileExtensionEnum.IdLib,
                                       FileExtensionEnum.IdLib.GetDescription(),
                                       FileExtensionEnum.FitLib,
                                       FileExtensionEnum.FitLib.GetDescription(),
                                       FileExtensionEnum.PLSBind,
                                       FileExtensionEnum.PLSBind.GetDescription(),
                                       FileExtensionEnum.PLS1,
                                       FileExtensionEnum.PLS1.GetDescription(),
                                       FileExtensionEnum.PLSANN,
                                       FileExtensionEnum.PLSANN.GetDescription(),
                                       FileExtensionEnum.ItgBind,
                                       FileExtensionEnum.ItgBind.GetDescription()

                                       );
            dlg.InitialDirectory = Busi.Common.Configuration.DefaultDirectory;
            dlg.Title            = "选择方法";
            if (dlg.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            var ftype = BindModel.CheckType(dlg.FileName);

            switch (ftype)
            {
            case FileExtensionEnum.Allmethods:
                this._mBind                    = BindModel.ReadModel <BindModel>(dlg.FileName);
                this._mBind.FullPath           = dlg.FileName;
                this.tabControl1.SelectedIndex = 0;
                break;

            case FileExtensionEnum.PLSBind:
                this._mPLS                     = BindModel.ReadModel <PLSModel>(dlg.FileName);
                this._mPLS.FullPath            = dlg.FileName;
                this.tabControl1.SelectedIndex = 1;
                break;

            case FileExtensionEnum.IdLib:
                this._mId                      = BindModel.ReadModel <IdentifyModel>(dlg.FileName);
                this._mId.FullPath             = dlg.FileName;
                this.tabControl1.SelectedIndex = 2;
                break;

            case FileExtensionEnum.FitLib:
                this._mFitting                 = BindModel.ReadModel <FittingModel>(dlg.FileName);
                this._mFitting.FullPath        = dlg.FileName;
                this.tabControl1.SelectedIndex = 3;
                break;

            case FileExtensionEnum.PLS1:
            case FileExtensionEnum.PLSANN:
                this._mPLS1                    = BindModel.ReadModel <PLSSubModel>(dlg.FileName);
                this._mPLS1.FullPath           = dlg.FileName;
                this.tabControl1.SelectedIndex = 4;
                break;

            case FileExtensionEnum.ItgBind:
                this._itgSub                   = BindModel.ReadModel <IntegrateModel>(dlg.FileName);
                this._itgSub.FullPath          = dlg.FileName;
                this.tabControl1.SelectedIndex = 5;
                break;

            default:
                break;
            }
            this.tabChange();
            var p = this.tabControl1.SelectedTab as Controls.IPanel;

            if (p != null)
            {
                p.Clear();
            }
        }