コード例 #1
0
ファイル: Component.cs プロジェクト: Geinome/Gwen.Net
        /// <summary>
        /// Get a child control or component of this component.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <returns>Control or component.</returns>
        public object GetControl(string name)
        {
            if (m_View == null)
            {
                throw new NullReferenceException("Unable to get a control. Component contains no view.");
            }

            Gwen.Net.Control.ControlBase control = null;
            if (m_View.Name == name)
            {
                control = m_View;
            }
            else
            {
                control = m_View.FindChildByName(name, true);
            }

            if (control == null)
            {
                return(null);
            }

            if (control.Component != null)
            {
                if (control.Component != this)
                {
                    return(control.Component);
                }
                else
                {
                    return(control);
                }
            }
            else
            {
                return(control);
            }
        }
コード例 #2
0
ファイル: Component.cs プロジェクト: Geinome/Gwen.Net
 /// <summary>
 /// Override this function if you want to handle all XML based events in the same function.
 /// </summary>
 /// <param name="eventName">Name of the event.</param>
 /// <param name="handlerName">Element handler defined in the XML.</param>
 /// <param name="sender">Event sender control.</param>
 /// <param name="args">Event arguments.</param>
 /// <returns>True if the event was handled, false otherwise.</returns>
 /// <remarks>No need to call the base implementation.</remarks>
 public virtual bool HandleEvent(string eventName, string handlerName, Gwen.Net.Control.ControlBase sender, System.EventArgs args)
 {
     return(false);
 }