Beispiel #1
0
 protected void SetSerializableContentFromFlags()
 {
     SerializableContent    = "";
     NonSerializableContent = "";
     foreach (object value in Enum.GetValues(typeof(SerializationContents)))
     {
         if (!(value is SerializationContents))
         {
             continue;
         }
         SerializationContents serializationContents = (SerializationContents)value;
         if ((Content & serializationContents) == serializationContents && serializationContents != SerializationContents.All && Content != SerializationContents.All)
         {
             if (NonSerializableContent.Length != 0)
             {
                 NonSerializableContent += ", ";
             }
             NonSerializableContent += GetFlagContentString(serializationContents, serializable: false);
             NonSerializableContent  = NonSerializableContent.TrimStart(',');
             if (SerializableContent.Length != 0)
             {
                 SerializableContent += ", ";
             }
             SerializableContent += GetFlagContentString(serializationContents, serializable: true);
             SerializableContent  = SerializableContent.TrimStart(',');
         }
     }
 }
Beispiel #2
0
        protected string GetFlagContentString(SerializationContents flag, bool serializable)
        {
            switch (flag)
            {
            case SerializationContents.All:
                return("");

            case SerializationContents.Default:
                return("");

            case SerializationContents.Data:
                if (serializable)
                {
                    return("Chart.BuildNumber, Chart.Series, Series.Points, Series.Name, DataPoint.XValue, DataPoint.YValues,DataPoint.Label,DataPoint.AxisLabel,DataPoint.LabelFormat,DataPoint.Empty, Series.YValuesPerPoint, Series.XValueIndexed, Series.XValueType, Series.YValueType");
                }
                return("");

            case SerializationContents.Appearance:
                if (serializable)
                {
                    return("Chart.BuildNumber, *.Name, *.Back*, *.Border*, *.Line*, *.Frame*, *.PageColor*, *.SkinStyle*, *.Palette, *.PaletteCustomColors, *.Font*, *.*Font, *.Color, *.Shadow*, *.MarkerColor, *.MarkerStyle, *.MarkerSize, *.MarkerBorderColor, *.MarkerImage, *.MarkerImageTransparentColor, *.LabelBackColor, *.LabelBorder*, *.Enable3D, *.RightAngleAxes, *.Clustered, *.Light, *.Perspective, *.XAngle, *.YAngle, *.PointDepth, *.PointGapDepth, *.WallWidth");
                }
                return("");

            default:
                throw new InvalidOperationException(SR.ExceptionChartSerializerContentFlagUnsupported);
            }
        }
Beispiel #3
0
        protected void SetSerializableContentFromFlags()
        {
            this.SerializableContent    = "";
            this.NonSerializableContent = "";
            Array values = Enum.GetValues(typeof(SerializationContents));

            foreach (object item in values)
            {
                if (item is SerializationContents)
                {
                    SerializationContents serializationContents = (SerializationContents)item;
                    if ((this.Content & serializationContents) == serializationContents && serializationContents != SerializationContents.All && this.Content != SerializationContents.All)
                    {
                        if (this.NonSerializableContent.Length != 0)
                        {
                            this.NonSerializableContent += ", ";
                        }
                        this.NonSerializableContent += this.GetFlagContentString(serializationContents, false);
                        this.NonSerializableContent  = this.NonSerializableContent.TrimStart(',');
                        if (this.SerializableContent.Length != 0)
                        {
                            this.SerializableContent += ", ";
                        }
                        this.SerializableContent += this.GetFlagContentString(serializationContents, true);
                        this.SerializableContent  = this.SerializableContent.TrimStart(',');
                    }
                }
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // enable or disable the control based on the selection of the check box
            Persist.Enabled = EnableStateManagement.Checked;

            // if no state managment is desired, reset the listbox to persist both
            // appearance and data for when the enable SM checkbox is checked. This
            // will prevent an exception from being thrown.
            if (!Persist.Enabled)
            {
                Persist.SelectedIndex = 0;
            }

            if (Persist.SelectedItem.Value == "Default")
            {
                Content = SerializationContents.Default;
            }
            else
            {
                Content = SerializationContents.Data;
            }

            // if this is not a postback or if state management is not selected, then
            // add the source chart data to the chart.
            if (!EnableStateManagement.Checked || !IsPostBack)
            {
                // Generate random data.  This routine will add 50 points to the chart
                // and will have a 2 second delay to simulate a long data retrieval time.
                Data(Chart1.Series["Input"]);
            }
            else
            {
                // Read the persisted data from the browser.  Reading is only required when
                // data has been explicitly written.
                LoadChartState();
            }

            // Set chart types for input data series.  If this is not specified AND only
            // Data is selected to be state managed, there will be no chart type set
            // causing the default chart type, Column Chart, to be displayed.  When Data
            // and Appearance is set, this is unneccessary.
            if (Persist.SelectedItem.Value == "Data")
            {
                Chart1.Series["Input"].ChartType = SeriesChartType.Line;
            }

            // Add other series to the chart
            AddOtherSeries();
        }
Beispiel #5
0
        /// <summary>
        /// Sets SerializableContent and NonSerializableContent properties
        /// depending on the flags in the Content property.
        /// </summary>
        internal void SetSerializableContent()
        {
            // Reset content definition strings
            this.SerializableContent    = "";
            this.NonSerializableContent = "";

            // Loop through all enumeration flags
            Array enumValues = Enum.GetValues(typeof(SerializationContents));

            foreach (object flagObject in enumValues)
            {
                if (flagObject is SerializationContents)
                {
                    // Check if flag currently set
                    SerializationContents flag = (SerializationContents )flagObject;
                    if ((this.Content & flag) == flag &&
                        flag != SerializationContents.All &&
                        this.Content != SerializationContents.All)
                    {
                        // Add comma at the end of existing string
                        if (this.NonSerializableContent.Length != 0)
                        {
                            this.NonSerializableContent += ", ";
                        }

                        // Add serializable class/properties names
                        this.NonSerializableContent += GetContentString(flag, false);
                        this.NonSerializableContent  = this.NonSerializableContent.TrimStart(',');

                        // Add comma at the end of existing string
                        if (this.SerializableContent.Length != 0)
                        {
                            this.SerializableContent += ", ";
                        }

                        // Add serializable class/properties names
                        this.SerializableContent += GetContentString(flag, true);
                        this.SerializableContent  = this.SerializableContent.TrimStart(',');
                    }
                }
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // enable or disable the control based on the selection of the check box
            Persist.Enabled = EnableStateManagement.Checked;

            // if no state managment is desired, reset the listbox to persist both
            // appearance and data for when the enable SM checkbox is checked. This
            // will prevent an exception from being thrown.
            if(!Persist.Enabled)
                Persist.SelectedIndex = 0;

            if(Persist.SelectedItem.Value == "Default")
                Content = SerializationContents.Default;
            else
                Content = SerializationContents.Data;

            // if this is not a postback or if state management is not selected, then
            // add the source chart data to the chart.
            if(!EnableStateManagement.Checked || !IsPostBack)
            {
                // Generate random data.  This routine will add 50 points to the chart
                // and will have a 2 second delay to simulate a long data retrieval time.
                Data( Chart1.Series["Input"] );
            }
            else
            {
                // Read the persisted data from the browser.  Reading is only required when
                // data has been explicitly written.
                LoadChartState();
            }

            // Set chart types for input data series.  If this is not specified AND only
            // Data is selected to be state managed, there will be no chart type set
            // causing the default chart type, Column Chart, to be displayed.  When Data
            // and Appearance is set, this is unneccessary.
            if(Persist.SelectedItem.Value == "Data")
                Chart1.Series["Input"].ChartType = SeriesChartType.Line;

            // Add other series to the chart
            AddOtherSeries();
        }
Beispiel #7
0
 protected string GetContentString(SerializationContents content, bool serializable)
 {
     throw new NotImplementedException();
 }
Beispiel #8
0
        /// <summary>
        /// Return a serializable or non serializable class/properties names
        /// for the specific flag.
        /// </summary>
        /// <param name="content">Serializable content</param>
        /// <param name="serializable">True - get serializable string, False - non serializable.</param>
        /// <returns>Serializable or non serializable string with class/properties names.</returns>
        protected string GetContentString(SerializationContents content, bool serializable)
        {
            switch (content)
            {
            case (SerializationContents.All):
                return("");

            case (SerializationContents.Default):
                return("");

            case (SerializationContents.Data):
                if (serializable)
                {
                    return
                        ("Chart.BuildNumber, " +
                         "Chart.Series, " +
                         "Series.Points, " +
                         "Series.Name, " +
                         "DataPoint.XValue, " +
                         "DataPoint.YValues," +
                         "DataPoint.LabelStyle," +
                         "DataPoint.AxisLabel," +
                         "DataPoint.LabelFormat," +
                         "DataPoint.IsEmpty, " +
                         "Series.YValuesPerPoint, " +
                         "Series.IsXValueIndexed, " +
                         "Series.XValueType, " +
                         "Series.YValueType");
                }
                return("");

            case (SerializationContents.Appearance):
                if (serializable)
                {
                    return
                        ("Chart.BuildNumber, " +
                         "*.Name*, " +
                         "*.Fore*, " +
                         "*.Back*, " +
                         "*.Border*, " +
                         "*.Line*, " +
                         "*.Frame*, " +
                         "*.PageColor*, " +
                         "*.SkinStyle*, " +
                         "*.Palette, " +
                         "*.PaletteCustomColors, " +
                         "*.Font*, " +
                         "*.*Font, " +
                         "*.Color, " +
                         "*.Shadow*, " +
                         "*.MarkerColor, " +
                         "*.MarkerStyle, " +
                         "*.MarkerSize, " +
                         "*.MarkerBorderColor, " +
                         "*.MarkerImage, " +
                         "*.MarkerImageTransparentColor, " +
                         "*.LabelBackColor, " +
                         "*.LabelBorder*, " +
                         "*.Enable3D, " +
                         "*.IsRightAngleAxes, " +
                         "*.IsClustered, " +
                         "*.LightStyle, " +
                         "*.Perspective, " +
                         "*.Inclination, " +
                         "*.Rotation, " +
                         "*.PointDepth, " +
                         "*.PointGapDepth, " +
                         "*.WallWidth");
                }
                return("");

            default:
                throw (new InvalidOperationException(SR.ExceptionChartSerializerContentFlagUnsupported));
            }
        }
Beispiel #9
0
		protected string GetContentString (SerializationContents content, bool serializable)
		{
			throw new NotImplementedException ();
		}