Exemple #1
0
        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);
        }
Exemple #2
0
 private void frmUpgrade_FormClosing(object sender, FormClosingEventArgs e)
 {
     try
     {
         DimTemplates.SaveAllGroupCommandsFrmDatabase();
         this.Dispose();
     }
     catch
     {
     }
 }
Exemple #3
0
        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;
        }
Exemple #4
0
        public static int GetNewIDForGroup(String sProjectName)
        {
            // 添加到缓存
            if (CsConst.myDimTemplates == null)
            {
                CsConst.myDimTemplates = new List <DimTemplates>();
                return(1);
            }

            DimTemplates dimSelectedCurve = new DimTemplates();

            foreach (DimTemplates oTmp in CsConst.myDimTemplates)
            {
                if (oTmp.sProjectName == sProjectName)
                {
                    dimSelectedCurve = oTmp; break;
                }
            }

            if (dimSelectedCurve.arrDimProfiles == null || dimSelectedCurve.arrDimProfiles.Count == 0)
            {
                return(1);
            }
            if (dimSelectedCurve.arrDimProfiles.Count == 4)
            {
                return(-1);
            }
            //查找位置,替换buffer
            int intAreaID = 1;

            try
            {
                List <int> oTmpIdList = new List <int>(); //取出所有已用的场景号
                for (int i = 0; i < dimSelectedCurve.arrDimProfiles.Count; i++)
                {
                    oTmpIdList.Add(dimSelectedCurve.arrDimProfiles[i].iID);
                }

                while (oTmpIdList.Contains(intAreaID))
                {
                    intAreaID++;
                }
            }
            catch
            { }

            return(intAreaID);
        }
Exemple #5
0
        private void Newtemplates_Click(object sender, EventArgs e)
        {
            try
            {
                Boolean isOpen = HDLSysPF.IsAlreadyOpenedForm("frmAdd");

                if (isOpen == false)
                {
                    frmAdd frmNew = new frmAdd(4, CsConst.MyUnnamed, CsConst.MyUnnamed);
                    frmNew.ShowDialog();

                    if (frmNew.DialogResult == DialogResult.OK)
                    {
                        if (CsConst.MyTmpName == null || CsConst.MyTmpName.Count == 0)
                        {
                            return;
                        }

                        if (CsConst.MyTmpName != null && CsConst.MyTmpName.Count != 0)
                        {
                            tvTemplates.Nodes.Add(CsConst.MyTmpName[0]);

                            if (CsConst.myDimTemplates == null)
                            {
                                CsConst.myDimTemplates = new List <DimTemplates>();
                            }
                            DimTemplates oTmp = new DimTemplates();
                            oTmp.sProjectName   = CsConst.MyTmpName[0];
                            oTmp.arrDimProfiles = new List <DimTemplate>();
                            CsConst.myDimTemplates.Add(oTmp);
                        }
                    }
                }
            }
            catch
            { }
        }
Exemple #6
0
 void InitialFormCtrlsTextOrItems()
 {
     DimTemplates.ReadAllGroupCommandsFrmDatabase();
     DimTemplates.ShowGroupCommandsToTreetview(tvTemplates);
 }