using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Drawing;
using DiagramUI.Utils;
using DataPerformer.Interfaces;
using DataPerformerUI.Interfaces;
namespace DataPerformerUI
{
/// <summary>
/// Performer of oprerations of this assembly
/// </summary>
static class StaticPerformer
{
/// <summary>
/// Shows error
/// </summary>
/// <param name="control">Control</param>
/// <param name="exception">Error exception</param>
static internal void ShowError(this Control control, Exception exception)
{
control.ShowError(exception, DataPerformerUI.Utils.ControlUtilites.Resources);
}
/// <summary>
/// Loads resources for control
/// </summary>
/// <param name="control"></param>
static internal void LoadResources(this Control control)
{
control.LoadControlResources(DataPerformerUI.Utils.ControlUtilites.Resources);
}
/// <summary>
/// Copies internal data
/// </summary>
/// <param name="source">Source</param>
/// <param name="target">Target</param>
static internal void Copy(this IGraphLabel source, IGraphLabel target)
{
target.Argument = source.Argument;
target.Colors = source.Colors;
target.StepChart = source.StepChart;
target.Condition = source.Condition;
target.SplitDistance = source.SplitDistance;
target.Start = source.Start;
target.StepCount = source.StepCount;
target.Texts = source.Texts;
target.Points = source.Points;
}
static internal object[] DefaultSeriesPaintingArray
{
get
{
return new object[] { (int)(-1), Color.Black, new ICollection[0], false };
}
}
static internal int GetDrawMode(this object[] array)
{
return (int)array[0];
}
static internal Color GetColor(this object[] array)
{
return (Color)array[1];
}
static internal ICollection[] GetComments(this object[] array)
{
return (ICollection[])array[2];
}
static internal bool GetShowTable(this object[] array)
{
return (bool)array[3];
}
static internal void SetDrawMode(this object[] array, int mode)
{
array[0] = mode;
}
static internal void SetColor(this object[] array, Color color)
{
array[1] = color;
}
static internal void SetComments(this object[] array, ICollection[] comments)
{
array[2] = comments; ;
}
static internal void SetShowTable(this object[] array, bool showTable)
{
array[3] = showTable;
}
static internal void Fill(this INamedCoordinates coord, ToolStripComboBox cx, ToolStripComboBox cy)
{
string x = coord.X;
string y = coord.Y;
cx.Text = "<X>";
cx.Items.Clear();
IList<string> l = coord.GetNames("x");
if (l != null)
{
cx.FillCombo(l);
if (x != null)
{
cx.SelectCombo(x);
}
}
cy.Text = "<Y>";
cy.Items.Clear();
l = coord.GetNames("y");
if (l != null)
{
cy.FillCombo(l);
if (y != null)
{
cy.SelectCombo(y);
}
}
}
}
}