示例#1
0
        /// <summary>
        /// Gets the interactor associated with a given control, if there is one.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="interactor">The interactor.</param>
        /// <returns>True if an interactor exists.</returns>
        public bool TryGetInteractor(Control control, out FormsInteractor interactor)
        {
            interactor = _interactors
                         .FirstOrDefault(x => control.Equals(x.Control));

            return(interactor != null);
        }
示例#2
0
        /// <summary>
        /// Gets the interactor associated with a given control. Creates a new interactor if none was found.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <returns>The interactor.</returns>
        public FormsInteractor GetInteractor(Control control)
        {
            FormsInteractor interactor;

            if (!TryGetInteractor(control, out interactor))
            {
                interactor = new FormsInteractor(control);
                _interactors.Add(interactor);
                IsModified = true;
            }

            return(interactor);
        }
示例#3
0
        /// <summary>
        /// Gets the interactor associated with a given control, if there is one.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="interactor">The interactor.</param>
        /// <returns>True if an interactor exists.</returns>
        public bool TryGetInteractor(Control control, out FormsInteractor interactor)
        {
            interactor = _interactors
                .FirstOrDefault(x => control.Equals(x.Control));

            return interactor != null;
        }
示例#4
0
        /// <summary>
        /// Gets the interactor associated with a given control. Creates a new interactor if none was found.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <returns>The interactor.</returns>
        public FormsInteractor GetInteractor(Control control)
        {
            FormsInteractor interactor;
            if (!TryGetInteractor(control, out interactor))
            {
                interactor = new FormsInteractor(control);
                _interactors.Add(interactor);
                IsModified = true;
            }

            return interactor;
        }