The ActionOperations desktop UI class
|
||
using System;
using System.Collections.Generic;
using System.Text;
using Persistate;
using Library.Model;
namespace Library.Desktop
{
/// <summary>
/// This static class contains user interface methods for the
/// Action operation group.
/// </summary>
/// <remarks>
/// These will include IsEnabled methods, and also Execute
/// methods for any operations defined as user interface
/// operations.
/// </remarks>
public static class ActionOperations
{
/// <summary>
/// Determines whether the Receive books operation should be enabled and/or
/// visible for a particular potential target Library.
/// </summary>
/// <param name="session">The session requesting whether the operation
/// should be enabled and/or visible.</param>
/// <param name="target">The Library on which any Execute call
/// would be made.</param>
/// <param name="collection">Any collection involved with this
/// operation.</param>
/// <returns>An OperationPresence containing the operation visibility and
/// a tooltip.</returns>
public static OperationPresence ReceiveBooksPresence(Session session, Persistent target,
IPersistateList collection)
{
return target != null
? OperationPresence.Enabled("Execute the Receive books operation")
: OperationPresence.Disabled("No object is selected");
}
/// <summary>
/// Determines whether the New borrower operation should be enabled and/or
/// visible for a particular potential target Library.
/// </summary>
/// <param name="session">The session requesting whether the operation
/// should be enabled and/or visible.</param>
/// <param name="target">The Library on which any Execute call
/// would be made.</param>
/// <param name="collection">Any collection involved with this
/// operation.</param>
/// <returns>An OperationPresence containing the operation visibility and
/// a tooltip.</returns>
public static OperationPresence NewBorrowerPresence(Session session, Persistent target,
IPersistateList collection)
{
return target != null
? OperationPresence.Enabled("Execute the New borrower operation")
: OperationPresence.Disabled("No object is selected");
}
/// <summary>
/// Determines whether the Create test data operation should be enabled and/or
/// visible for a particular potential target Library.
/// </summary>
/// <param name="session">The session requesting whether the operation
/// should be enabled and/or visible.</param>
/// <param name="target">The Library on which any Execute call
/// would be made.</param>
/// <param name="collection">Any collection involved with this
/// operation.</param>
/// <returns>An OperationPresence containing the operation visibility and
/// a tooltip.</returns>
public static OperationPresence CreateTestDataPresence(Session session, Persistent target,
IPersistateList collection)
{
return target != null
? OperationPresence.Enabled("Execute the Create test data operation")
: OperationPresence.Disabled("No object is selected");
}
/// <summary>
/// Determines whether the Blacklist author operation should be enabled and/or
/// visible for a particular potential target Library.
/// </summary>
/// <param name="session">The session requesting whether the operation
/// should be enabled and/or visible.</param>
/// <param name="target">The Library on which any Execute call
/// would be made.</param>
/// <param name="collection">Any collection involved with this
/// operation.</param>
/// <returns>An OperationPresence containing the operation visibility and
/// a tooltip.</returns>
public static OperationPresence BlacklistAuthorPresence(Session session, Persistent target,
IPersistateList collection)
{
return target != null
? OperationPresence.Enabled("Execute the Blacklist author operation")
: OperationPresence.Disabled("No object is selected");
}
}
}