Esempio n. 1
0
        private void LoadSettings(TModel model)
        {
            Contract.Assert(model != null);

            // Some models persist settings, this is an optional feature
            IScaffoldingSettings modelSettings = model as IScaffoldingSettings;

            if (modelSettings != null && VisualStudioIntegration != null)
            {
                // The project settings will be null if the project doesn't implement settings (project systems are
                // extensible).
                IProjectSettings projectSettings = VisualStudioIntegration.GetProjectSettings(Context.ActiveProject);
                if (projectSettings != null)
                {
                    try
                    {
                        modelSettings.LoadSettings(projectSettings);
                    }
                    catch (Exception ex)
                    {
                        // We don't want to make it a blocking issue if we're unable to load settings.
                        Debug.Fail("Failed to load settings\r\n" + ex.Message);
                    }
                }
            }
        }
Esempio n. 2
0
        private void SaveSettings(TModel model)
        {
            Contract.Assert(model != null);

            IScaffoldingSettings modelSettings = model as IScaffoldingSettings;

            if (modelSettings != null && VisualStudioIntegration != null)
            {
                // The project settings will be null if the project doesn't implement settings (project systems are
                // extensible).
                IProjectSettings projectSettings = VisualStudioIntegration.GetProjectSettings(Context.ActiveProject);
                if (projectSettings != null)
                {
                    try
                    {
                        modelSettings.SaveSettings(projectSettings);
                    }
                    catch (Exception ex)
                    {
                        // We don't want to make it a blocking issue if we're unable to save settings.
                        Debug.Fail("Failed to save settings", ex.Message);
                    }
                }
            }
        }
Esempio n. 3
0
        private void SaveSettings(TModel model)
        {
            IScaffoldingSettings scaffoldingSetting = (object)model as IScaffoldingSettings;

            if (scaffoldingSetting != null && this.VisualStudioIntegration != null)
            {
                IProjectSettings projectSettings = this.VisualStudioIntegration.GetProjectSettings(base.Context.ActiveProject);
                if (projectSettings != null)
                {
                    try
                    {
                        scaffoldingSetting.SaveSettings(projectSettings);
                    }
                    catch (Exception exception)
                    {
                    }
                }
            }
        }