public void OnLabelEditing(LabelEditingEventArgs args)
 {
     if (node.Labels.Count == 0)
     {
         OnLabelAdding(args);
         return;
     }
     args.Label   = node.Labels[0];
     args.Handled = true;
 }
 /// <summary>
 /// This method is only called when a label should be added to <see cref="owner" />.
 /// </summary>
 /// <remarks>This implementation prevents adding of more than two labels</remarks>
 public override void OnLabelAdding(LabelEditingEventArgs args)
 {
     args.TextEditorInputModeConfigurator = ConfigureTextEditorInputMode;
     // Prevent adding more than two labels...
     if (owner.Labels.Count >= 2)
     {
         args.Cancel = true;
         return;
     }
     base.OnLabelAdding(args);
 }
        /// <summary>This method is called when label should be edited.</summary>
        /// <remarks>
        /// If a label is edited directly, we either return it (if it is the second label) or prevent editing.
        /// </remarks>
        public override void OnLabelEditing(LabelEditingEventArgs args)
        {
            args.TextEditorInputModeConfigurator = ConfigureTextEditorInputMode;
            if (label != null)
            {
                // We are directly editing the label
                if (label.Owner != null && label == label.Owner.Labels[0])
                {
                    // The first label is never editable
                    args.Label  = null;
                    args.Cancel = true;
                    return;
                }

                //We are a dummy label or not the first label
                //return the label and disallow editing
                //If we are editing the first label, the framework will then try to add label by calling AddLabel
                args.Label   = label;
                args.Handled = true;
                return;
            }

            // Implicit editing - this is only reached if we are trying to edit labels for an owner which does not yet have any labels
            if (owner == null)
            {
                base.OnLabelEditing(args);
                return;
            }
            if (owner.Labels.Count <= 1)
            {
                // Add a second label instead (since we'll never edit the first one)
                OnLabelAdding(args);
                return;
            }

            // If more than one label, edit the second one
            args.Label   = owner.Labels[1];
            args.Handled = true;
        }
            public void OnLabelAdding(LabelEditingEventArgs args)
            {
                var         parameter = ChoreographyLabelModel.Instance.FindNextParameter(node);
                ILabelStyle labelStyle;

                if (parameter == ChoreographyLabelModel.NorthMessage || parameter == ChoreographyLabelModel.SouthMessage)
                {
                    labelStyle = new ChoreographyMessageLabelStyle();
                }
                else
                {
                    labelStyle = ((GraphControl)args.Context.CanvasControl).Graph.NodeDefaults.Labels.Style;
                }
                if (parameter == null)
                {
                    parameter = ExteriorLabelModel.West;
                }

                args.LayoutParameter = parameter;
                args.Owner           = node;
                args.Style           = labelStyle;
                args.Handled         = true;
            }
 public void OnLabelEditing(LabelEditingEventArgs args)
 {
     args.TextEditorInputModeConfigurator = ConfigureTextEditorInputMode;
     args.Label   = label;
     args.Handled = true;
 }
 public void OnLabelAdding(LabelEditingEventArgs args)
 {
     args.Cancel = true;
 }