using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DataPerformer;
using DiagramUI;
using CategoryTheory;
using DiagramUI.Labels;
using Diagram.UI.Interfaces;
namespace DataPerformerUI.Forms
{
/// <summary>
/// Editor of properties of Graph component
/// </summary>
public partial class FormGraph : Form, IUpdatableForm, IStartStop
{
#region Fields
Labels.GraphLabel label;
UserControls.UserControlGraph uc = new UserControls.UserControlGraph(false);
IObjectLabel l;
#endregion
#region Ctor
private FormGraph()
{
InitializeComponent();
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="lab">Parent graph label</param>
public FormGraph(Labels.GraphLabel lab)
: this()
{
this.LoadResources();
this.label = lab;
l = lab;
UpdateFormUI();
uc.Dock = DockStyle.Fill;
panelGraph.Controls.Add(uc);
}
#endregion
#region IUpdatableForm Members
/// <summary>
/// Updates form UI
/// </summary>
public void UpdateFormUI()
{
Text = l.RootName;
}
#endregion
#region IStartStop Members
void IStartStop.Action(object type, bool start)
{
IStartStop ss = label;
ss.Action(type, start);
}
#endregion
private void FormGraph_Load(object sender, EventArgs e)
{
DataConsumer dc = label.Object as DataConsumer;
uc.Consumer = dc;
uc.ParentLabel = label;
label.Copy(uc);
uc.Post();
//label.Enabled = false;
}
}
}