/// <summary> /// Gets a description performed by possible actions /// </summary> /// <param name="function">The IButtonFunction action to evaluate</param> /// <returns>A string describing the action, null if not found</returns> private string GetButtonAction(IButtonFunction function) { if (function is MenuCommand) { MenuCommand mc = function as MenuCommand; return(mc.FullCommand); } else if (function is LastCommand) { if (m_LastCommand != null) { return(m_LastCommand.FullCommand); } else { return(null); } } else if (function is MenuDef) { return(Pandora.Localization.TextProvider["Buttons.MenuDesc"]); } return(null); }
/// <summary> /// Verifies if adding an item as right button will function properly /// </summary> /// <param name="right">The right button candidate</param> /// <returns>True if the combination is valid, false otherwise</returns> public bool TryRight(IButtonFunction right) { if (m_Left == null) { if (right.RequiresSecondButton) { return(false); } else { return(true); } } else { if (m_Left.AllowsSecondButton && right.AllowsSecondButton) { return(true); } else { return(false); } } }
/// <summary> /// Verifies if adding an item as left button will function properly /// </summary> /// <param name="left">The left button candidate</param> /// <returns>True if the combination is valid, false otherwise</returns> public bool TryLeft(IButtonFunction left) { if (m_Right == null) { if (left.RequiresSecondButton) { return(false); } else { return(true); } } else { if (m_Right.AllowsSecondButton && left.AllowsSecondButton) { return(true); } else { return(false); } } }
/// <summary> /// Gets a description performed by possible actions /// </summary> /// <param name="function">The IButtonFunction action to evaluate</param> /// <returns>A string describing the action, null if not found</returns> private string GetButtonAction( IButtonFunction function ) { if ( function is MenuCommand ) { MenuCommand mc = function as MenuCommand; return mc.FullCommand; } else if ( function is LastCommand ) { if ( m_LastCommand != null ) return m_LastCommand.FullCommand; else return null; } else if ( function is MenuDef ) { return Pandora.Localization.TextProvider[ "Buttons.MenuDesc" ]; } return null; }
/// <summary> /// Verifies if adding an item as right button will function properly /// </summary> /// <param name="right">The right button candidate</param> /// <returns>True if the combination is valid, false otherwise</returns> public bool TryRight( IButtonFunction right ) { if ( m_Left == null ) { if ( right.RequiresSecondButton ) return false; else return true; } else { if ( m_Left.AllowsSecondButton && right.AllowsSecondButton ) return true; else return false; } }
/// <summary> /// Verifies if adding an item as left button will function properly /// </summary> /// <param name="left">The left button candidate</param> /// <returns>True if the combination is valid, false otherwise</returns> public bool TryLeft( IButtonFunction left ) { if ( m_Right == null ) { if ( left.RequiresSecondButton ) return false; else return true; } else { if ( m_Right.AllowsSecondButton && left.AllowsSecondButton ) return true; else return false; } }
/// <summary> /// Edits the existing item on a button slot /// </summary> private void EditDef() { IButtonFunction function = null; if (m_EditLeft) { function = m_Def.Left; } else { function = m_Def.Right; } if (function is MenuCommand) { MenuCommand mc = function as MenuCommand; // Single command SimpleCommand sc = new SimpleCommand(); sc.Command = mc.Command; sc.UsePrefix = mc.UsePrefix; if (sc.ShowDialog() == DialogResult.OK) { mc.Command = sc.Command; mc.UsePrefix = sc.UsePrefix; } } else if (function is ModifierCommand) { ModifierCommand mc = function as ModifierCommand; SimpleCommand sc = new SimpleCommand(true); sc.Command = mc.Command; if (sc.ShowDialog() == DialogResult.OK) { mc.Command = sc.Command; } } else if (function is MenuDef) { MenuDef md = function as MenuDef; // Menu BoxMenuEditor me = new BoxMenuEditor(); me.MenuDefinition = md; if (me.ShowDialog() == DialogResult.OK) { if (m_EditLeft) { m_Def.Left = me.MenuDefinition; } else { m_Def.Right = me.MenuDefinition; } } } else if (function is MultiCommandDef) { MultiCommandDef mcd = function as MultiCommandDef; // Multi Command MultiCommandEditor mce = new MultiCommandEditor(); mce.MultiDef = mcd; if (mce.ShowDialog() == DialogResult.OK) { if (m_EditLeft) { m_Def.Left = mce.MultiDef; } else { m_Def.Right = mce.MultiDef; } } } }