public static DimTemplates AddNewTemplateToPublicGroup(String TemplateName, List <DimTemplates> TemplatesCMD) { DimTemplates oTmp = new DimTemplates(); try { if (CsConst.myDimTemplates == null) { CsConst.myDimTemplates = new List <DimTemplates>(); } //添加到结构体 #region oTmp.sProjectName = CsConst.MyUnnamed; oTmp.arrDimProfiles = new List <DimTemplate>(); DimTemplate dimTmp = new DimTemplate(); dimTmp.iID = 1; dimTmp.sName = "Dim Cuver " + dimTmp.iID.ToString(); dimTmp.arrChannelLevel = new Int16[100]; for (Byte i = 0; i < 100; i++) { dimTmp.arrChannelLevel[i] = i; } oTmp.arrDimProfiles.Add(dimTmp); #endregion CsConst.myDimTemplates.Add(oTmp); } catch { } return(oTmp); }
private void btnSure_Click(object sender, EventArgs e) { if (tbTemplates.Text == null || tbTemplates.Text == "") { return; } if (arrCurrentCurve == null || arrCurrentCurve.Length == 0) { return; } if (tvTemplates.Nodes == null || tvTemplates.Nodes.Count == 0) { return; } TreeNode oNode = tvTemplates.SelectedNode; if (oNode == null) { return; } if (oNode.Level == 1) { oNode = oNode.Parent; } if (CsConst.myDimTemplates == null || CsConst.myDimTemplates.Count == 0) { return; } Cursor.Current = Cursors.WaitCursor; try { DimTemplate oDimCurve = new DimTemplate(); oDimCurve.iID = DimTemplates.GetNewIDForGroup(oNode.Text); oDimCurve.sName = tbTemplates.Text.ToString(); oDimCurve.arrChannelLevel = arrCurrentCurve; if (CsConst.myDimTemplates[oNode.Index].arrDimProfiles == null) { CsConst.myDimTemplates[oNode.Index].arrDimProfiles = new List <DimTemplate>(); } CsConst.myDimTemplates[oNode.Index].arrDimProfiles.Add(oDimCurve); oNode.Nodes.Add(tbTemplates.Text); } catch { } Cursor.Current = Cursors.Default; }