コード例 #1
0
        public bool RemoveChartPoints(string projName)
        {
            IProjectChartPoints pcp = GetProjectChartPoints(projName);

            if (pcp != null)
            {
                IFileChartPoints fCPs = null;
                while ((fCPs = pcp.filePoints.FirstOrDefault()) != null)
                {
                    if (fCPs.linePoints.Count == 0)
                    {
                        pcp.filePoints.Remove(fCPs);
                    }
                    else
                    {
                        ILineChartPoints lCPs = null;
                        while ((lCPs = fCPs.linePoints.FirstOrDefault()) != null)
                        {
                            if (lCPs.chartPoints.Count == 0)
                            {
                                fCPs.RemoveLineChartPoints(lCPs);
                            }
                            else
                            {
                                IChartPoint cp = null;
                                while ((cp = lCPs.chartPoints.FirstOrDefault()) != null)
                                {
                                    lCPs.RemoveChartPoint(cp);
                                }
                            }
                        }
                    }
                }
                data.projPoints.Remove(pcp);
            }

            return(true);
        }
コード例 #2
0
 protected CPPropsDeSerializator(SerializationInfo info, StreamingContext context)
 {
     try
     {
         UInt32 projsCount = info.GetUInt32("projPoints.Count");
         for (uint p = 0; p < projsCount; ++p)
         {
             string projName = info.GetString("projName_" + p.ToString());
             Globals.processor.RemoveChartPoints(projName);
             UInt32 filesCount = info.GetUInt32("filePoints.Count_" + p.ToString());
             if (filesCount > 0)
             {
                 IProjectChartPoints projCPs = Globals.processor.GetProjectChartPoints(projName);
                 if (projCPs == null)
                 {
                     Globals.processor.AddProjectChartPoints(projName, out projCPs);
                 }
                 if (projCPs != null)
                 {
                     for (uint f = 0; f < filesCount; ++f)
                     {
                         string           fileName = info.GetString("fileName_" + p.ToString() + f.ToString());
                         IFileChartPoints fPnts    = projCPs.AddFileChartPoints(fileName);
                         if (fPnts != null)
                         {
                             UInt32 linesCount = info.GetUInt32("linePoints.Count_" + p.ToString() + f.ToString());
                             for (uint l = 0; l < linesCount; ++l)
                             {
                                 UInt32           lineNum = info.GetUInt32("lineNum_" + p.ToString() + f.ToString() + l.ToString());
                                 UInt32           linePos = info.GetUInt32("linePos_" + p.ToString() + f.ToString() + l.ToString());
                                 ILineChartPoints lPnts   = fPnts.AddLineChartPoints((int)lineNum, (int)linePos);
                                 if (lPnts != null)
                                 {
                                     UInt32 cpsCount = info.GetUInt32("cpsPoints.Count_" + p.ToString() + f.ToString() + l.ToString());
                                     for (uint cp = 0; cp < cpsCount; ++cp)
                                     {
                                         IChartPoint chartPnt   = null;
                                         string      uniqueName = info.GetString("uniqueName_" + p.ToString() + f.ToString() + l.ToString() + cp.ToString());
                                         bool        enabled    = info.GetBoolean("enabled_" + p.ToString() + f.ToString() + l.ToString() + cp.ToString());
                                         if (lPnts.AddChartPoint(uniqueName, out chartPnt))
                                         {
                                             chartPnt.SetStatus(enabled ? EChartPointStatus.SwitchedOn : EChartPointStatus.SwitchedOff);
                                         }
                                     }
                                 }
                                 if (lPnts.Count == 0)
                                 {
                                     fPnts.RemoveLineChartPoints(lPnts);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
 }