/// <summary> /// Provides the name or default string for "this" Macro. /// </summary> /// <returns>Formatted string containing either the name or a default name.</returns> public string DisplayName() { if (this.Name == String.Empty) { return(CMacro.DisplayName(this.m_MacroNumber)); } return(this.Name); }
public override string ToString() { if (this.Name == String.Empty) { return(CMacro.DisplayName(this.MacroNumber)); } return(this.Name); // return base.ToString(); }
/// <summary> /// Provides the name of a Macro or default string if none found. /// </summary> /// <param name="cm">Macro file to get the displayable name for.</param> /// <returns>Formatted string containing either the name or a default name.</returns> public string DisplayName(CMacro cm) { if (cm == null) { return("<ERROR>"); } if (cm.Name == String.Empty) { return(CMacro.DisplayName(cm.MacroNumber)); } return(cm.Name); }
private void Modify(ref CMacro cm_drag, ref CMacro cm_drop, DragEventArgs e) { if (cm_drag == cm_drop) // No effect, but just in case return; #region Swap/Copy Drag & Drop Macros and update if ((cm_drag != null) && (cm_drop != null)) { LogMessage.Log("..DragDrop START:{0} Macro src:{1} dest:{2}", e.Effect, cm_drag.Name, cm_drop.Name); if (e.Effect == DragDropEffects.Link) { if (Swap(ref cm_drop, ref cm_drag)) { // if Swap is successful // update node names cm_drag.thisNode.Text = cm_drag.DisplayName(); cm_drop.thisNode.Text = cm_drop.DisplayName(); } } else if (e.Effect == DragDropEffects.Copy) { if (cm_drop.CopyFrom(cm_drag)) { // if Copy is successful // Update node name // and set Changed true on the Drops macrofile (not handled by copy) cm_drop.thisNode.Text = cm_drop.DisplayName(); CMacroFile cmf_drop = FindMacroFileByNode(cm_drop.thisNode); if (cmf_drop != null) cmf_drop.Changed = true; } } LogMessage.Log("..DragDrop END:{0} Macro src:{1} dest:{2}", e.Effect, cm_drag.Name, cm_drop.Name); } else LogMessage.Log("....Modify(): Swap Macro, one of the two is null"); #endregion }
private void BuildMacroNode(ref CMacro cm, TreeNode parent) { string cmName = cm.DisplayName(); cm.thisNode = parent.Nodes.Add(CMacro.DisplayName(cm.MacroNumber) + "<" + cmName + ">", cmName, "Macro", "EditMacro"); TagInfo xTag = new TagInfo("macro"); cm.thisNode.Tag = xTag; }