Skip to content

Instantly share code, notes, and snippets.

@awrowse
Created November 29, 2012 14:39
Show Gist options
  • Save awrowse/4169496 to your computer and use it in GitHub Desktop.
Save awrowse/4169496 to your computer and use it in GitHub Desktop.
Auto Client RN
/**
* Author: Ryan McCullough
* Project Location: https://src.rightnow.com/spaces/ps_addins_library
* Blob Hash: $Id: bd91d4b076c661881199de313de1aa4dc44a41d9 $
* Description: IAutomationClient static singleton helper for Add-Ins
*
*/
using System.AddIn;
using System.Collections.Generic;
using RightNow.AddIns.AddInViews;
namespace PS.Utility {
/// <summary>
/// This class is used to provide static instances of the IGlobalContext and IAutomationContext interfaces.
/// </summary>
[AddIn("RightNow Professional Services AutomationClient AddIn", Version = "1.0.0.0")]
public partial class AutomationClient : IAutomationClient {
#region Members
/// <summary>
/// The global context provides several properties pertaining to the currently logged in users profile,
/// as well as methods for logging and retrieving OptLists.
/// </summary>
public static IGlobalContext GlobalContext { get; private set; }
/// <summary>
/// The automation context provides methods for working with records (create, edit, delete), content pane
/// controls, and executing reports.
/// </summary>
public static IAutomationContext AutomationContext { get; private set; }
#endregion
#region IAutomationClient Members
/// <summary>
/// Sets the automation context.
/// </summary>
/// <param name="context">The automation context.</param>
public void SetAutomationContext(IAutomationContext context) {
AutomationClient.AutomationContext = context;
}
#endregion
#region IAddInBase Members
/// <summary>
/// Initializes the add-in.
/// </summary>
/// <param name="context">The global context.</param>
/// <returns>True if the add-in successfully initialized and should be loaded, false to not load.</returns>
public bool Initialize(IGlobalContext context) {
AutomationClient.GlobalContext = context;
return true;
}
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment