Пример #1
0
        public static ConfigurationFrame Deserialize(XElement elm)
        {
            ConfigurationFrame frame = new ConfigurationFrame();

            frame.m_nDataIndex               = SerializeToXml.LoadInt(elm, "DataIndex").Value;
            frame.m_nFrameHeight             = SerializeToXml.LoadInt(elm, "FrameHeight").Value;
            frame.m_clrTitle                 = SerializeToXml.LoadColor(elm, "TitleColor").Value;
            frame.m_fontTitle                = SerializeToXml.LoadFont(elm, "TitleFont");
            frame.Name                       = SerializeToXml.LoadText(elm, "Name");
            frame.Visible                    = SerializeToXml.LoadBool(elm, "Visible").Value;
            frame.MinMaxTarget               = (PlotCollection.MINMAX_TARGET)SerializeToXml.LoadInt(elm, "MinMaxTarget");
            frame.ScaleToVisibleWhenRelative = SerializeToXml.LoadBool(elm, "ScaleToVisible").Value;
            frame.m_rgPlots                  = ConfigurationPlot.Deserialize(elm.Descendants());
            frame.m_rgLines                  = ConfigurationTargetLine.Deserialize(elm.Descendants());
            frame.m_configPlotArea           = ConfigurationPlotArea.Deserialize(elm);
            frame.m_configXAxis              = ConfigurationAxis.Deserialize(elm, "X");
            frame.m_configYAxis              = ConfigurationAxis.Deserialize(elm, "Y");

            double?dfVal = SerializeToXml.LoadDouble(elm, "MinYRange");

            if (dfVal.HasValue)
            {
                frame.MinimumYRange = dfVal.Value;
            }

            return(frame);
        }
Пример #2
0
        public ConfigurationFrame(SerializationInfo info, StreamingContext context)
        {
            int nCount = info.GetInt32("plotCount");

            for (int i = 0; i < nCount; i++)
            {
                ConfigurationPlot plot = (ConfigurationPlot)info.GetValue("plot_" + i.ToString(), typeof(ConfigurationPlot));
                m_rgPlots.Add(plot);
            }

            nCount = info.GetInt32("targetLineCount");

            for (int i = 0; i < nCount; i++)
            {
                ConfigurationTargetLine line = (ConfigurationTargetLine)info.GetValue("targetline_" + i.ToString(), typeof(ConfigurationTargetLine));
                m_rgLines.Add(line);
            }

            m_configPlotArea = (ConfigurationPlotArea)info.GetValue("plotArea", typeof(ConfigurationPlotArea));
            m_configXAxis    = (ConfigurationAxis)info.GetValue("axisX", typeof(ConfigurationAxis));
            m_configYAxis    = (ConfigurationAxis)info.GetValue("axisY", typeof(ConfigurationAxis));
            m_nDataIndex     = info.GetInt32("plotCollectionIdx");
            m_nFrameHeight   = info.GetInt32("frameHeight");
            m_clrTitle       = (Color)info.GetValue("clrTitle", typeof(Color));
            m_fontTitle      = (Font)info.GetValue("fontTitle", typeof(Font));
            m_strName        = info.GetString("name");
            m_bVisible       = info.GetBoolean("visible");

            try
            {
                m_minmaxTarget = (PlotCollection.MINMAX_TARGET)info.GetInt32("minmax_target");
            }
            catch (Exception)
            {
            }

            try
            {
                m_bScaleToVisibleWhenRelative = info.GetBoolean("scale_to_visible");
            }
            catch (Exception)
            {
            }

            try
            {
                m_dfMinYRange = info.GetDouble("min_y_range");
            }
            catch (Exception)
            {
            }
        }
Пример #3
0
        public bool Compare(ConfigurationPlotArea c)
        {
            if (m_clrGrid != c.m_clrGrid)
            {
                return(false);
            }

            if (m_clrBack != c.m_clrBack)
            {
                return(false);
            }

            if (m_clrZeroLine != c.m_clrZeroLine)
            {
                return(false);
            }

            if (m_clrSeparator != c.m_clrSeparator)
            {
                return(false);
            }

            if (m_fontLabels.Name != c.m_fontLabels.Name || m_fontLabels.Size != c.m_fontLabels.Size || m_fontLabels.Style != c.m_fontLabels.Style)
            {
                return(false);
            }

            if (m_rgTimeZones == null && c.m_rgTimeZones != null || m_rgTimeZones != null && c.m_rgTimeZones == null)
            {
                return(false);
            }

            if (m_rgTimeZones != null && c.m_rgTimeZones != null)
            {
                if (m_rgTimeZones.Count != c.m_rgTimeZones.Count)
                {
                    return(false);
                }

                for (int i = 0; i < m_rgTimeZones.Count; i++)
                {
                    if (!m_rgTimeZones[i].Compare(c.m_rgTimeZones[i]))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Пример #4
0
        public ConfigurationPlotArea(ConfigurationPlotArea pa)
        {
            foreach (ConfigurationTimeZone zone in pa.TimeZones)
            {
                m_rgTimeZones.Add(new ConfigurationTimeZone(zone));
            }

            m_clrGrid               = pa.m_clrGrid;
            m_clrBack               = pa.m_clrBack;
            m_clrZeroLine           = pa.m_clrZeroLine;
            m_clrSeparator          = pa.m_clrSeparator;
            m_fontLabels            = new Font(pa.m_fontLabels, FontStyle.Regular);
            m_nLookahead            = pa.m_nLookahead;
            m_nCalculationLookahead = pa.m_nCalculationLookahead;
        }
Пример #5
0
 public ConfigurationFrame(ConfigurationFrame f)
 {
     m_configPlotArea              = new ConfigurationPlotArea(f.m_configPlotArea);
     m_configXAxis                 = f.m_configXAxis.Clone();
     m_configYAxis                 = f.m_configYAxis.Clone();
     m_nDataIndex                  = f.m_nDataIndex;
     m_nFrameHeight                = f.m_nFrameHeight;
     m_clrTitle                    = f.m_clrTitle;
     m_fontTitle                   = new Font(f.m_fontTitle, FontStyle.Bold);
     m_strName                     = f.m_strName;
     m_bVisible                    = f.m_bVisible;
     m_dfMarginPercent             = f.m_dfMarginPercent;
     m_minmaxTarget                = f.m_minmaxTarget;
     m_bScaleToVisibleWhenRelative = f.m_bScaleToVisibleWhenRelative;
     m_dfMinYRange                 = f.m_dfMinYRange;
     m_rcActivePlotAreaBounds      = f.m_rcActivePlotAreaBounds;
     m_bUseExistingDataMinMax      = f.m_bUseExistingDataMinMax;
 }
Пример #6
0
        public static ConfigurationPlotArea Deserialize(XElement elm)
        {
            ConfigurationPlotArea plotArea = new ConfigurationPlotArea();

            XElement child = SerializeToXml.GetElement(elm.Descendants(), "PlotArea");

            plotArea.GridColor = SerializeToXml.LoadColor(child, "GridColor").Value;
            plotArea.BackColor = SerializeToXml.LoadColor(child, "BackColor").Value;
            plotArea.ZeroLine  = SerializeToXml.LoadColor(child, "ZeroLineColor").Value;
            plotArea.LabelFont = SerializeToXml.LoadFont(child, "LabelFont");

            Color?clr = SerializeToXml.LoadColor(child, "SeparatorColor");

            if (clr.HasValue)
            {
                plotArea.m_clrSeparator = clr.Value;
            }

            plotArea.m_rgTimeZones = ConfigurationTimeZone.Deserialize(elm.Descendants());

            return(plotArea);
        }