Esempio 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 EmailPluginContext");

            EmailPluginContext newContext = new EmailPluginContext(this);

            m_ActiveContexts.Add(newContext);
            return(newContext);
        }
Esempio 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)
        {
            EmailPluginContext emailPluginContext = context as EmailPluginContext;

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