using System.Windows.Forms; using HeuristicLab.Core; using HeuristicLab.Core.Views; using HeuristicLab.MainForm; namespace HeuristicLab.EvolutionTracking.Views { [View("GenealogyGraphView")] [Content(typeof(IGenealogyGraph<>), IsDefaultView = false)] public partial class GenealogyGraphView : ItemView where T : class,IItem { public new IGenealogyGraph Content { get { return (IGenealogyGraph)base.Content; } set { base.Content = value; } } public GenealogyGraphView() { InitializeComponent(); } protected override void DeregisterContentEvents() { // TODO: Deregister your event handlers here genealogyGraphChart.GenealogyGraphNodeClicked -= graphChart_GenealogyGraphNodeClicked; genealogyGraphChart.GenealogyGraphNodeDoubleClicked -= graphChart_GenealogyGraphNodeDoubleClicked; base.DeregisterContentEvents(); } protected override void RegisterContentEvents() { base.RegisterContentEvents(); // TODO: Register your event handlers here genealogyGraphChart.GenealogyGraphNodeClicked += graphChart_GenealogyGraphNodeClicked; genealogyGraphChart.GenealogyGraphNodeDoubleClicked += graphChart_GenealogyGraphNodeDoubleClicked; } #region Event Handlers (Content) // TODO: Put event handlers of the content here protected override void OnContentChanged() { base.OnContentChanged(); if (Content != null && Content != genealogyGraphChart.GenealogyGraph) { genealogyGraphChart.GenealogyGraph = Content; } } #endregion protected override void SetEnabledStateOfControls() { base.SetEnabledStateOfControls(); // TODO: Enable or disable controls based on whether the content is null or the view is set readonly } #region Event Handlers (child controls) // TODO: Put event handlers of child controls here. public virtual void graphChart_GenealogyGraphNodeClicked(object sender, MouseEventArgs args) { var visualNode = (VisualGenealogyGraphNode)sender; var graphNode = (IGenealogyGraphNode)visualNode.Data; if (graphNode == null) return; var content = graphNode.Data; if (content == null) return; viewHost.Content = content; } public virtual void graphChart_GenealogyGraphNodeDoubleClicked(object sender, MouseEventArgs arcs) { } #endregion #region events for configuring the behavior of the genealogy chart (trace/match, simple lineages, etc) private void trace_checkBox_CheckedChanged(object sender, System.EventArgs e) { genealogyGraphChart.TraceFragments = trace_checkBox.Checked; } private void simpleLineages_checkBox_CheckedChanged(object sender, System.EventArgs e) { genealogyGraphChart.SimpleLineages = simpleLineages_checkBox.Checked; } private void lockGraph_checkBox_CheckedChanged(object sender, System.EventArgs e) { genealogyGraphChart.LockGenealogy = lockGraph_checkBox.Checked; } #endregion } }