using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Serialization;
using System.Collections;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using CategoryTheory;
using DiagramUI;
using DiagramUI.Labels;
using DiagramUI.Interfaces;
using Diagram.UI.Interfaces;
using DataPerformer;
using Chart;
using Chart.Interfaces;
using ToolBox;
using Chart.Drawing.Interfaces;
using Chart.Drawing.Painters;
using Chart.Panels;
using DataPerformerUI.UserControls;
namespace DataPerformerUI.Labels
{
/// <summary>
/// Label of series
/// </summary>
[Serializable()]
public class SeriesLabel : UserControlBaseLabel
{
#region Fields
DataPerformer.Series series;
UserControlSeries ucs;
private object[] array = StaticPerformerDataPerformerUI.DefaultSeriesPaintingArray;
/// <summary>
/// Formula
/// </summary>
private string formula = "";
Forms.FormSeries form;
#endregion
#region Ctor
/// <summary>
/// Default constructor
/// </summary>
public SeriesLabel()
: base(typeof(DataPerformer.Series), "", ResourceImage.Series.ToBitmap())
{
}
/// <summary>
/// Deserialization constructor
/// </summary>
/// <param name="info">Serialization info</param>
/// <param name="context">Streaming context</param>
protected SeriesLabel(SerializationInfo info, StreamingContext context)
: base(info, context)
{
try
{
formula = info.GetString("Formula");
}
catch (Exception)
{
}
}
#endregion
#region ISerializable Members
/// <summary>
/// ISerializable interface implementation
/// </summary>
/// <param name="info">Serialization info</param>
/// <param name="context">Streaming context</param>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue("Array", array, typeof(object[]));
info.AddValue("Formula", formula);
}
#endregion
#region IObjectLabel Members
/// <summary>
/// Object
/// </summary>
public override ICategoryObject Object
{
get
{
return series;
}
set
{
if (!(value is Series))
{
CategoryException.ThrowIllegalSourceException();
}
series = value as Series;
value.Object = this;
ucs.Series = series;
}
}
#endregion
#region Overriden Members
/// <summary>
/// Post operation
/// </summary>
public override void Post()
{
base.Post();
ucs.ShowAll();
}
/// <summary>
/// Associated form
/// </summary>
public override object Form
{
get
{
form = new Forms.FormSeries(this, array);
return form;
}
}
/// <summary>
/// Load operation
/// </summary>
/// <param name="info">Serialization info</param>
/// <param name="context">Streaming context</param>
protected override void Load(SerializationInfo info, StreamingContext context)
{
base.Load(info, context);
array = info.GetValue("Array", typeof(object[])) as object[];
}
/// <summary>
/// Internal control
/// </summary>
protected override UserControl Control
{
get
{
ucs = new UserControlSeries();
ucs.ShowStrip(true);
ucs.Array = array;
return ucs;
}
}
#endregion
#region Specific Members
internal string Formula
{
get
{
if (formula.Length == 0)
{
return ResourceFormula.ZeroFormula;
}
return formula;
}
set
{
this.formula = value;
}
}
#endregion
}
}