예제 #1
0
            public bool Synchronize()
            {
                bool changed = false;

                foreach (ICheckElem _elem in elems)
                {
                    if (_elem.HasChanged())
                    {
                        if (pPnts == null)
                        {
                            ChartPoints.Globals.processor.AddProjectChartPoints(projName, out pPnts);
                        }
                        if (fPnts == null)
                        {
                            fPnts = pPnts.AddFileChartPoints(fileName);
                        }
                        if (lPnts == null)
                        {
                            lPnts = fPnts.AddLineChartPoints(lineNum, linePos);
                        }
                        changed = lPnts.SyncChartPoint(_elem);
                    }
                }

                return(changed);
            }
예제 #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);
     }
 }