internal async Task SendIdentifyAsync() { await _identifyLock.WaitAsync().ConfigureAwait(false); var model = new IdentifyModel { Token = Client.Token, LargeThreshold = 250, Presence = new UpdateStatusModel { Status = _status, Game = _activity ?? Optional <ActivityModel> .Empty }, Shard = _shard, GuildSubscriptions = true }; if (Library.Debug.MobileIndicator) { model.Properties.Os = "android"; model.Properties.Browser = "Discord Android"; } await SendAsync(new PayloadModel { Op = GatewayOperationCode.Identify, D = Serializer.GetJsonElement(model) }).ConfigureAwait(false); }
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; } }
/// <summary> /// Gets the info to be displayed about the identified features /// </summary> /// <param name="identifyResults">List of results returned from the Map View</param> private void GetIdentifyInfoAsync(IReadOnlyList <IdentifyLayerResult> identifyResults) { // Current IdentifyCommand only handles FeatureLayer identified results (under GeoElements) // Developers to handle other types of identified results // ArcGISMapImageLayer would have results in SublayerResults. if (identifyResults != null) { // Get each result and put them in the IdentifyModelsList this.IdentifyModelsList = new ObservableCollection <IdentifyModel>(); foreach (var result in identifyResults) { foreach (var geoelement in result.GeoElements) { if (geoelement is Feature) { // Set the layer name var identifyModel = new IdentifyModel(); identifyModel.LayerName = result.LayerContent.Name; identifyModel.IdentifiedFeature = (Feature)geoelement; // Add new value to the list this.IdentifyModelsList.Add(identifyModel); } } // Set first feature as the current feature and set the index to use in the UI if (this.IdentifyModelsList.Count > 0) { this.CurrentIdentifiedFeature = this.IdentifyModelsList[0]; this.CurrentIdentifiedFeatureIndex = 1; } } } }
private void btnModelExtent_Click(object sender, EventArgs e) { if (this._lib == null || this._baseModel == null) { return; } bool needcv = false; if (MessageBox.Show("是否进行交互验证和外部验证?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { needcv = true; } this._model = Serialize.DeepClone <IdentifyModel>(this._baseModel); this._model.Name = this._lib.Name; this.btnModelExtent.Text = "正在计算"; this.btnRebuild.Enabled = false; this.btnModelExtent.Enabled = false; this.btnLoadModel.Enabled = false; this.btnLoadSpec.Enabled = false; this.toolStripProgressBar1.Visible = true; int num = int.Parse(this.textBox1.Text); int numofId = int.Parse(this.txbnumofId.Text); Action a = () => { this._model.Train(this._lib); var lib = this._model.SpecLib.Clone(); lib.Merger(this._baseModel.SpecLib); if (needcv) { this._cvLst = this._model.CrossValidation(lib, false); this._vLst = this._model.Validation(lib, false); } else { this._vLst = null; this._cvLst = null; } this._model.Train(lib, false); //显示 this.showdata(num, numofId); if (this.InvokeRequired) { ThreadStart s = () => { MessageBox.Show("建模完成"); }; this.Invoke(s); } else { MessageBox.Show("建模完成"); } }; a.BeginInvoke(null, null); }
public override void Predict(List <string> files, object model, int numofId) { IdentifyModel m = model as IdentifyModel; if (m == null || files == null) { throw new ArgumentNullException(""); } this._model = m; if (!this._inited) { if (this.treeGridView1.InvokeRequired) { ThreadStart s = () => { this.init(this._model); }; this.treeGridView1.Invoke(s); } else { this.init(this._model); } } var error_filelst = new List <string>(); int rowNum = 1; foreach (var f in files) { try { var spec = new Spectrum(f); var robj = this._model.Predict(spec, true, numofId); if (this.treeGridView1.InvokeRequired) { ThreadStart s = () => { this.addRow(robj, spec, rowNum, numofId); }; this.treeGridView1.Invoke(s); } else { this.addRow(robj, spec, rowNum, numofId); } } catch (Exception ex) { log.Error(ex); error_filelst.Add(new FileInfo(f).Name); } rowNum++; } if (error_filelst.Count > 0) { MessageBox.Show(string.Format("以下{1}条光谱未正确预测:\n{0}", string.Join(";", error_filelst), error_filelst.Count )); } }
public void ModelNew() { if (this.cheakSave()) { return; } OpenFileDialog myOpenFileDialog = new OpenFileDialog(); myOpenFileDialog.Filter = string.Format("{1} (*.{0})|*.{0}", FileExtensionEnum.Lib, FileExtensionEnum.Lib.GetDescription()); myOpenFileDialog.Title = "选择光谱库"; myOpenFileDialog.InitialDirectory = Busi.Common.Configuration.FolderSpecLib; if (myOpenFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } this._model = new IdentifyModel(); //初始化模型默认参数 this._model.Wind = Busi.Common.Configuration.IdWinNum; this._model.TQ = Busi.Common.Configuration.IdTQ; this._model.MinSQ = Busi.Common.Configuration.IdSQ; this._model.LibBase = new SpecBase(myOpenFileDialog.FileName); if (this._model.LibBase == null) { MessageBox.Show("光谱库加载失败!", "信息提示"); return; } // 检查性质个数并给出提示 if (_model.LibBase.Components.Count < 1) { MessageBox.Show("您导入的光谱库没有性质,请先添加性质!", "信息提示"); } this.specGridView1.Specs = this._model.LibBase; this.setTQ1.Model = this._model; this.resultForm1.Model = this._model; this.calibResultForm1.Model = this._model; this.preprocessControl1.Processors = new List <NIR.Data.Preprocesser>(); this.flowControl1.UnFinish(2); this.flowControl1.UnFinish(3); this.flowControl1.UnFinish(4); this.flowControl1.UnFinish(5); this.flowControl1.Active(1); this.flowControl1.Enabled = true; this.setTitle(); }
public void Post([FromBody] IdentifyModel model) { string userId = UserIdentityProvider.Identify(); var profile = new UserProfile() { UserId = userId, HostAddress = HttpContext.Current.Request.UserHostAddress, Name = model.Name }; UserProfileStore.Instance.SaveProfile(userId, profile); }
private void init(IdentifyModel m) { this._model = m; this.treeGridView1.Nodes.Clear(); this.treeGridView1.Columns.Clear(); this.treeGridView1.Columns.Add(new TreeGridColumn() { HeaderText = "名称", ReadOnly = true, ToolTipText = "样本名称", Frozen = true }); this.treeGridView1.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "TQ", ReadOnly = true, ToolTipText = "移动相关系数", Width = 60, Frozen = true }); this.treeGridView1.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "SQ", ReadOnly = true, ToolTipText = "识别参数", Width = 60, Frozen = true }); this.treeGridView1.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "结果", ReadOnly = true, ToolTipText = "识别结果", Width = 50, Frozen = true }); //添加性质 foreach (var c in _model.SpecLib.Components) { this.treeGridView1.Columns.Add(new DataGridViewTextBoxColumn() { Width = 60, ReadOnly = true, Name = c.Name }); } this._inited = true; this.treeGridView1.CellDoubleClick += treeGridView1_CellDoubleClick; }
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(); }
private void clear() { this.identifyGridViewCV.Clear(); this.identifyGridViewV.Clear(); this._model = null; this._cvLst = null; this._vLst = null; this.btnModelExtent.Enabled = this._lib != null && this._baseModel != null; this.btnRebuild.Enabled = this._lib != null && this._baseModel != null; this.btnSaveToBind.Enabled = false; this.btnSaveToItg.Enabled = false; this.lblInfo.Text = string.Format("光谱库{0},识别库{1}", this._lib == null ? "未加载" : this._lib.ToString(), this._baseModel == null ? "未加载" : this._baseModel.ToString()); }
private void addIdModel(IdentifyModel model, int idx) { if (model == null) { return; } this.gridModel.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = string.Format("识别_{0}", model.Name), ToolTipText = model.FullPath, Tag = model.FullPath, SortMode = DataGridViewColumnSortMode.NotSortable }); int colIdx = this.gridModel.Columns.Count - 1; for (int i = 0; i < this.gridModel.Rows.Count; i++) { if (this.gridModel.Rows[i].Tag == null) { continue; } var cname = this.gridModel.Rows[i].Tag.ToString(); if (model.SpecLib.Components.Contains(cname)) { this.gridModel[colIdx, i] = new DataGridViewCheckBoxCell(); if (this._model.IDSelectMatrix == null) { this.gridModel[colIdx, i].Value = true; } else { var ddd = (this._model.IDSelectMatrix[this._model.Comps.GetIndex(cname)] & ((int)Math.Pow(2, idx))) == (int)Math.Pow(2, idx); this.gridModel[colIdx, i].Value = ddd; } } else { this.gridModel[colIdx, i] = new DataGridViewTextBoxCell(); this.gridModel[colIdx, i].Value = null; } } //给 }
private void btnOpen_Click(object sender, EventArgs e) { if (this.cheakSave()) { return; } 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) { this._model = BindModel.ReadModel <IdentifyModel>(myOpenFileDialog.FileName); if (this._model != null) { this.specGridView1.Specs = this._model.LibBase; this.preprocessControl1.Processors = this._model.Filters.Select(f => new RIPP.NIR.Data.Preprocesser() { Filter = f, Statu = WorkStatu.NotSet }).ToList(); 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(5); } else { this.flowControl1.Active(1); this.flowControl1.Enabled = true; } this._model.Edited = false; } } this.setTitle(); }
public void ShowGrid(IList <IdentifyResult> lst, int num, int numOfId, bool isTree = true, IdentifyModel model = null) { this._isTree = isTree; this._model = model; if (this._isTree) { this.Init(); if (lst == null) { return; } foreach (var r in lst) { this.AddResult(r, num, numOfId); } } else { this.ShowGrid2(lst, num, numOfId); } }
private void init() { //加载模型 var fullpath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, this._baseModelName); this._model = Serialize.Read <IdentifyModel>(fullpath); if (this._model == null) { return; } this._model.FullPath = fullpath; if (this._model.LibBase == null || this._model.LibBase.Count == 0) { this._model.SpecLib.Clear(); } if (this._model.LibBase == null) { this._model.LibBase = new SpecBase(); } if (this._model.LibBase.Components == null || this._model.LibBase.Components.Count == 0) { this._model.LibBase.Comp_Add(new Component() { Name = "ID" }); } else { this._model.LibBase.Components[0].Name = "ID"; } for (int i = this._model.LibBase.Components.Count - 1; i > 0; i--) { this._model.LibBase.Comp_RemoveAt(i); } this._model.Save(); }
protected override void addRow(object robj, NIR.Spectrum s, int rowNum, int numofId) { var r = (IdentifyResult)robj; int num = 5; var rtmp = IdentifyModel.GetPredictValue(r, num, numofId); var objs = new List <object>(); objs.Add(rtmp.Spec.Name); objs.Add(""); objs.Add(""); objs.Add(rtmp.IsId); foreach (var c in rtmp.Components) { objs.Add(double.IsNaN(c.PredictedValue) ? "" : c.PredictedValue.ToString(c.EpsFormatString)); } var node = this.treeGridView1.Nodes.Add(objs.ToArray()); node.HeaderCell.Value = rowNum.ToString(); for (int i = 0; i < num; i++) { if (rtmp.Items.Length > i) { var row = new nodeRow(rtmp.Items[i]); node.Nodes.Add(row); row.Cells[0].Value = rtmp.Items[i].Spec.Name; row.Cells[1].Value = rtmp.Items[i].TQ.ToString("F4"); row.Cells[2].Value = rtmp.Items[i].SQ.ToString("F4"); row.Cells[3].Value = rtmp.Items[i].Result ? "Yes" : "No"; var cidx = 4; foreach (var c in rtmp.Items[i].Spec.Components) { row.Cells[cidx].Value = double.IsNaN(c.ActualValue) ? "" : c.ActualValue.ToString(string.Format("F{0}", c.Eps)); cidx++; } } } }
private void ShowIdGrid(IdentifyResult result, int num, int numOfId) { this.gridId.Rows.Clear(); this.gridId.Visible = true; this.gridFit.Visible = false; this.gridPLS.Visible = false; this.gridItg.Visible = false; if (result == null || result.Items.Length == 0) { return; } result = IdentifyModel.GetPredictValue(result, num, numOfId); int k = 1; foreach (var r in result.Items) { if (k > num) { break; } var cell = new DataGridViewRowHeaderCell() { Value = k.ToString() }; var row = new MyDataIdRow() { Item = r, HeaderCell = cell }; row.CreateCells(this.gridId, r.Spec.UUID, r.TQ.ToString("F4"), r.SQ.ToString("F4"), r.Result); this.gridId.Rows.Add(row); k++; } }
// [TestMethod] public void Identify() { var specbase = new SpecBase(@"F:\3506\15chemometrics\RIPP_DEMO\algorithm\原油测试数据\crude.Lib"); var model = new IdentifyModel() { Wind = 11, MinSQ = 0.98, TQ = 0.998 }; model.Filters = new List <IFilter>(); model.Filters.Add(new Sgdiff(21, 2, 2)); model.Filters.Add(new SavitzkyGolay(5)); var xidx = new List <RegionPoint>(); xidx.Add(new RegionPoint(4002, 4702)); xidx.Add(new RegionPoint(5302, 6102)); var varregion = new VarRegionManu(); var argu = varregion.Argus; argu["XaxisRegion"].Value = xidx; argu["Xaxis"].Value = specbase.First().Data.X; varregion.Argus = argu; model.Filters.Add(varregion); model.Filters.Add(new NormPathLength()); var vspecbase = specbase.Clone(); vspecbase.Clear(); foreach (var s in specbase) { if (s.Usage == UsageTypeEnum.Calibrate) { vspecbase.Add(s.Clone()); } } var dd = RIPP.NIR.Data.Preprocesser.Process(model.Filters, vspecbase); var writer = new MatlabMatrixWriter(@"F:\3506\15chemometrics\RIPP_DEMO\src\RIPP\testdata\id\filterd.mat"); writer.WriteMatrix <double>(dd.GetX(), "filterd"); writer.Close(); var cv = new CrossValidation <IdentifyResult>(model); var lst = cv.CV(specbase); var allTQ = new DenseMatrix(5, specbase.Where(d => d.Usage == UsageTypeEnum.Calibrate).Count()); var allSQ = new DenseMatrix(5, specbase.Where(d => d.Usage == UsageTypeEnum.Calibrate).Count()); var allResult = allSQ.Clone(); for (int i = 0; i < lst.Count; i++) { var tq = new DenseVector(lst[i].Items.Select(d => d.TQ).ToArray()); var sq = new DenseVector(lst[i].Items.Select(d => d.SQ).ToArray()); var resulttt = new DenseVector(lst[i].Items.Select(d => Convert.ToDouble(d.Result)).ToArray()); allTQ.SetColumn(i, tq.SubVector(0, 5)); allSQ.SetColumn(i, sq.SubVector(0, 5)); allResult.SetColumn(i, resulttt.SubVector(0, 5)); } writer = new MatlabMatrixWriter(@"F:\3506\15chemometrics\RIPP_DEMO\src\RIPP\testdata\id\tq.mat"); writer.WriteMatrix <double>(allTQ, "TQ"); writer.Close(); writer = new MatlabMatrixWriter(@"F:\3506\15chemometrics\RIPP_DEMO\src\RIPP\testdata\id\sq.mat"); writer.WriteMatrix <double>(allSQ, "SQ"); writer.Close(); writer = new MatlabMatrixWriter(@"F:\3506\15chemometrics\RIPP_DEMO\src\RIPP\testdata\id\result.mat"); writer.WriteMatrix <double>(allResult, "result"); writer.Close(); }
private void ShowGrid2(IList <IdentifyResult> lst, int num, int numOfId) { this._isTree = false; this.Nodes.Clear(); this.Columns.Clear(); //this.SelectionMode = DataGridViewSelectionMode.FullColumnSelect; if (lst == null || lst.Count == 0) { return; } //添加列头 this.Columns.Add(new TreeGridColumn() { HeaderText = "样本名称", ReadOnly = true, ToolTipText = "样本名称", Width = 60, Frozen = true }); this.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "结果", ReadOnly = true, ToolTipText = "识别结果", Width = 50, SortMode = DataGridViewColumnSortMode.Automatic, Frozen = true }); //添加性质列 foreach (var c in lst.First().Spec.Components) { this.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = c.Name, ReadOnly = true, Width = 60 }); this.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "预测值", ReadOnly = true, Width = 60 }); this.Columns.Add(new DataGridViewTextBoxColumn() { HeaderText = "偏差", ReadOnly = true, Width = 60 }); } //添加数据 foreach (var r in lst) { var objs = new List <object>(); objs.Add(r.Spec.Name); objs.Add(r.IsId); var rtmp = IdentifyModel.GetPredictValue(r, num, numOfId); foreach (var c in rtmp.Components) { var actual = c.ActualValue; var predict = c.PredictedValue; var error = actual - predict; objs.Add(double.IsNaN(actual) ? "" : actual.ToString(c.EpsFormatString)); objs.Add(double.IsNaN(predict) ? "" : predict.ToString(c.EpsFormatString)); objs.Add(double.IsNaN(error) ? "" : error.ToString(c.EpsFormatString)); } this.Nodes.Add(objs.ToArray()); } }
private void AddResult(IdentifyResult r, int num, int numOfId) { if (!this._inited) { this.Init(); } if (r == null || num < 1) { return; } this._results.Add(r); if (!this._compShow) { var names = r.Components.Select(c => c.Name).ToArray(); for (int i = 0; i < names.Length; i++) { if (i < this._dColnum - 4 && this.Columns.Count > (4 + i)) { this.Columns[4 + i].HeaderText = names[i]; } else { this.Columns.Add(new DataGridViewTextBoxColumn() { Width = 60, HeaderText = names[i], ReadOnly = true, }); } } this._compShow = true; } var rtmp = IdentifyModel.GetPredictValue(r, num, numOfId); var objs = new List <object>(); objs.Add(rtmp.Spec.Name); objs.Add(""); objs.Add(""); objs.Add(rtmp.IsId); foreach (var c in rtmp.Components) { objs.Add(double.IsNaN(c.ActualValue) ? "" : c.ActualValue.ToString(string.Format("F{0}", c.Eps))); } TreeGridNode node; if (this.Nodes.Count <= (this._results.Count - 1) * 3) { node = this.Nodes.Add(objs.ToArray()); } else { node = this.Nodes[(this._results.Count - 1) * 3]; for (int i = 0; i < objs.Count; i++) { if (node.Cells.Count > i) { node.Cells[i].Value = objs[i]; } } } for (int i = 0; i < num; i++) { if (rtmp.Items.Length > i) { var row = new nodeRow(rtmp.Items[i]); node.Nodes.Add(row); row.Cells[0].Value = rtmp.Items[i].Spec.Name; row.Cells[1].Value = rtmp.Items[i].TQ.ToString("F4"); row.Cells[2].Value = rtmp.Items[i].SQ.ToString("F4"); row.Cells[3].Value = rtmp.Items[i].Result ? "Yes" : "No"; var cidx = 4; foreach (var c in rtmp.Items[i].Spec.Components) { row.Cells[cidx].Value = double.IsNaN(c.ActualValue) ? "" : c.ActualValue.ToString(string.Format("F{0}", c.Eps)); cidx++; } } } //预测值 objs = new List <object>(); objs.Add("预测值"); objs.Add(""); objs.Add(""); objs.Add(""); foreach (var c in rtmp.Components) { objs.Add(double.IsNaN(c.PredictedValue) ? "" : c.PredictedValue.ToString(string.Format("F{0}", c.Eps))); } if (this.Nodes.Count <= (this._results.Count - 1) * 3 + 1) { this.Nodes.Add(objs.ToArray()); } else { var tn = this.Nodes[(this._results.Count - 1) * 3 + 1]; for (int i = 0; i < objs.Count; i++) { if (tn.Cells.Count > i) { tn.Cells[i].Value = objs[i]; } } } //偏差 objs = new List <object>(); objs.Add("偏差"); objs.Add(""); objs.Add(""); objs.Add(""); if (rtmp.Components != null && rtmp.Components.Count > 0) { foreach (var c in rtmp.Components) { objs.Add(double.IsNaN(c.Error) ? "" : c.Error.ToString(string.Format("F{0}", c.Eps))); } } if (this.Nodes.Count <= (this._results.Count - 1) * 3 + 2) { this.Nodes.Add(objs.ToArray()); } else { var tn = this.Nodes[(this._results.Count - 1) * 3 + 2]; for (int i = 0; i < objs.Count; i++) { if (tn.Cells.Count > i) { tn.Cells[i].Value = objs[i]; } } } }
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(); } }