using System.Windows.Forms;
using FastReport.Forms;
using FastReport.Utils;
namespace FastReport
{
partial class DataBand : IHasEditor
{
#region Private Methods
private bool ShouldSerializeColumns()
{
return Columns.Count > 1;
}
#endregion
#region Public Methods
///
public override void Delete()
{
if (!CanDelete)
return;
// remove only this band, keep its subbands
if (Parent is ReportPage || Parent is DataBand)
{
Base parent = Parent;
int zOrder = ZOrder;
Parent = null;
while (Bands.Count > 0)
{
BandBase band = Bands[Bands.Count - 1];
band.Parent = parent;
band.ZOrder = zOrder;
}
Dispose();
}
}
///
public override SmartTagBase GetSmartTag()
{
return new DataBandSmartTag(this);
}
///
public override ContextMenuBase GetContextMenu()
{
return new DataBandMenu(Report.Designer);
}
internal override string GetInfoText()
{
return DataSource == null ? "" : DataSource.FullName;
}
///
public bool InvokeEditor()
{
using (DataBandEditorForm form = new DataBandEditorForm(this))
{
return form.ShowDialog() == DialogResult.OK;
}
}
///
/// Invokes column editor
///
public bool InvokeColumnsEditor()
{
using (DataBandColumnEditorForm form = new DataBandColumnEditorForm(this.Columns))
{
return form.ShowDialog() == DialogResult.OK;
}
}
#endregion
}
}