Exemplo n.º 1
0
        /// <summary>
        /// Called by the StackHash client to create a context. The StackHash client will not directly
        /// instantiate an instance of the Context class. This gives the plug-in the opportunity to
        /// reject instance creation.
        /// A context will have its own settings.
        /// The context will be created by StackHash when the StackHash profile is activated. This will be
        /// on service startup or may happen when the user manually activates the profile at the StackHash
        /// client.
        /// </summary>
        /// <returns>Reference to the created instance.</returns>
        public IBugTrackerV1Context CreateContext()
        {
            BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Creating CommandLinePluginContext");

            CommandLinePluginContext newContext = new CommandLinePluginContext(this);

            m_ActiveContexts.Add(newContext);
            return(newContext);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Releases a context that is no longer required.
        /// The context will be released by StackHash when the StackHash profile is deactivated. This will be
        /// on service closedown or may happen when the user manually deactivates the profile at the StackHash
        /// client.
        /// Once a context has been released, StackHash will no longer attempt to invoke it.
        /// </summary>
        /// <param name="context">The context to release.</param>
        public void ReleaseContext(IBugTrackerV1Context context)
        {
            CommandLinePluginContext commandLinePluginContext = context as CommandLinePluginContext;

            if (context != null)
            {
                BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Information, s_PlugInName, "Releasing CommandLinePluginContext");
                m_ActiveContexts.Remove(commandLinePluginContext);
            }
            else
            {
                BugTrackerTrace.LogMessage(BugTrackerTraceSeverity.Warning, s_PlugInName, "Null or invalid context passed to ReleaseContext");
            }
        }