/// <summary>
        /// Called by Loupe to have the configuration editor display itself and edit the provided configuration
        /// </summary>
        /// <param name="context">The Repository Context provides a connection to the hosting environment.</param><param name="configuration">The current configuration.</param><param name="initialConfiguration">Indicates if the configuration has ever completed in the current environment.</param>
        /// <returns>
        /// DialogResult.OK if the configuration is complete and should be accepted as the new configuration.  Any other result to cancel.  If this
        ///             is the initial configuration and it is not OK the Extension will not be enabled.
        /// </returns>
        public DialogResult EditConfiguration(IRepositoryContext context, IRepositoryConfiguration configuration, bool initialConfiguration)
        {
            m_Configuration = configuration.Common as SampleAddInConfiguration ?? new SampleAddInConfiguration();

            DisplayConfiguration();

            DialogResult result = ShowDialog();
            if (result == DialogResult.OK)
            {
                //copy back our changes.
                m_Configuration.AutoExportSessions = chkEnableAutoExport.Checked;
                m_Configuration.SessionExportPath = txtSessionExportPath.Text;
                configuration.Common = m_Configuration;
            }

            return result;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called by Loupe to have the configuration editor display itself and edit the provided configuration
        /// </summary>
        /// <param name="context">The Repository Context provides a connection to the hosting environment.</param><param name="configuration">The current configuration.</param><param name="initialConfiguration">Indicates if the configuration has ever completed in the current environment.</param>
        /// <returns>
        /// DialogResult.OK if the configuration is complete and should be accepted as the new configuration.  Any other result to cancel.  If this
        ///             is the initial configuration and it is not OK the Extension will not be enabled.
        /// </returns>
        public DialogResult EditConfiguration(IRepositoryContext context, IRepositoryConfiguration configuration, bool initialConfiguration)
        {
            m_Configuration = configuration.Common as SampleAddInConfiguration ?? new SampleAddInConfiguration();

            DisplayConfiguration();

            DialogResult result = ShowDialog();

            if (result == DialogResult.OK)
            {
                //copy back our changes.
                m_Configuration.AutoExportSessions = chkEnableAutoExport.Checked;
                m_Configuration.SessionExportPath  = txtSessionExportPath.Text;
                configuration.Common = m_Configuration;
            }

            return(result);
        }
        /// <summary>
        /// Called by Loupe to indicate the configuration of the add in has changed at runtime
        /// </summary>
        public void ConfigurationChanged()
        {
            //we're going to read the config here and save what we care about so we don't have to
            //deal with error handling during the process phase.

            SampleAddInConfiguration configuration = m_AddInContext.Configuration.Common as SampleAddInConfiguration;

            if (configuration == null)
            {
                //this should never happen.
                m_AddInContext.Log.Warning(LogCategory, "Invalid Configuration Data", "No configuration data could be loaded so the session analysis export will be disabled");

                m_Enabled    = false;
                m_OutputPath = null;
            }
            else
            {
                m_Enabled    = configuration.AutoExportSessions;
                m_OutputPath = configuration.SessionExportPath ?? SampleAddInConfiguration.DefaultOutputPath;
            }
        }