Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// <summary>
- /// Defines a presenter.
- /// </summary>
- /// <typeparam name="TView">The type of the view the presenter uses.</typeparam>
- public interface IPresenter<TView>
- where TView : IView
- {
- /// <summary>
- /// Gets the view.
- /// </summary>
- TView View { get; }
- }
- /// <summary>
- /// Base implementation of a presenter.
- /// </summary>
- /// <typeparam name="TView">The type of view the presenter uses.</typeparam>
- public class Presenter<TView> : IPresenter<TView>
- where TView : IView
- {
- /// <summary>
- /// Gets the view.
- /// </summary>
- public TView View { get { return _view; } }
- private readonly TView _view;
- /// <summary>
- /// Creates a new <see cref="Presenter"/>.
- /// </summary>
- /// <param name="view">The view attached to the presenter.</param>
- public Presenter(TView view)
- {
- ThrowIf.Null(() => view);
- _view = view;
- }
- }
- /// <summary>
- /// Defines a view.
- /// </summary>
- public interface IView
- {
- }
- /// <summary>
- /// Event args that requires to invoke and action.
- /// </summary>
- public class ActionEventArgs : EventArgs
- {
- /// <summary>
- /// Defines an empty value.
- /// </summary>
- public static new ActionEventArgs Empty = new ActionEventArgs(null);
- /// <summary>
- /// Gets the action.
- /// </summary>
- /// <value>The action.</value>
- public Action Action { get { return _action; } }
- private readonly Action _action;
- /// <summary>
- /// Gets a value indicating whether this instance has an action.
- /// </summary>
- /// <value><c>true</c> if this instance has an action; otherwise, <c>false</c>.</value>
- public bool HasAction {get{ return _action != null; }}
- public ActionEventArgs (Action action)
- : base()
- {
- _action = action;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment