public ODataConnectedServiceWizard(ConnectedServiceProviderContext context)
        {
            this.Context = context;
            this.Project = ProjectHelper.GetProjectFromHierarchy(this.Context.ProjectHierarchy);

            ConfigODataEndpointViewModel = new ConfigODataEndpointViewModel();

            AdvancedSettingsViewModel = new AdvancedSettingsViewModel();
            AdvancedSettingsViewModel.NamespacePrefix = ProjectHelper.GetProjectNamespace(this.Project);
            this.Pages.Add(ConfigODataEndpointViewModel);
            this.Pages.Add(AdvancedSettingsViewModel);

            this.IsFinishEnabled = true;
        }
        public ODataConnectedServiceWizard(ConnectedServiceProviderContext context)
        {
            this.Context = context;
            this.Project = ProjectHelper.GetProjectFromHierarchy(this.Context.ProjectHierarchy);
            this.userSettings = UserSettings.Load(context.Logger);

            ConfigODataEndpointViewModel = new ConfigODataEndpointViewModel(this.userSettings);
            AdvancedSettingsViewModel = new AdvancedSettingsViewModel();

            if (this.Context.IsUpdating)
            {
                //Since ServiceConfigurationV4 is a derived type of ServiceConfiguration. So we can deserialize a ServiceConfiguration into a ServiceConfigurationV4.
                ServiceConfigurationV4 serviceConfig = this.Context.GetExtendedDesignerData<ServiceConfigurationV4>();
                ConfigODataEndpointViewModel.Endpoint = serviceConfig.Endpoint;
                ConfigODataEndpointViewModel.EdmxVersion = serviceConfig.EdmxVersion;
                ConfigODataEndpointViewModel.ServiceName = serviceConfig.ServiceName;
                var configODataEndpoint = (ConfigODataEndpointViewModel.View as ConfigODataEndpoint);
                configODataEndpoint.IsEnabled = false;

                //Restore the advanced settings to UI elements.
                AdvancedSettingsViewModel.PageEntering += (sender, args) =>
                {
                    var advancedSettingsViewModel = sender as AdvancedSettingsViewModel;
                    if (advancedSettingsViewModel != null)
                    {
                        AdvancedSettings advancedSettings = advancedSettingsViewModel.View as AdvancedSettings;

                        advancedSettingsViewModel.GeneratedFileName = serviceConfig.GeneratedFileNamePrefix;
                        advancedSettings.ReferenceFileName.IsEnabled = false;
                        advancedSettingsViewModel.UseNamespacePrefix = serviceConfig.UseNameSpacePrefix;
                        advancedSettingsViewModel.NamespacePrefix = serviceConfig.NamespacePrefix;
                        advancedSettingsViewModel.UseDataServiceCollection = serviceConfig.UseDataServiceCollection;

                        if (serviceConfig.EdmxVersion == Common.Constants.EdmxVersion4)
                        {
                            advancedSettingsViewModel.IgnoreUnexpectedElementsAndAttributes = serviceConfig.IgnoreUnexpectedElementsAndAttributes;
                            advancedSettingsViewModel.EnableNamingAlias = serviceConfig.EnableNamingAlias;
                            advancedSettingsViewModel.IncludeT4File = serviceConfig.IncludeT4File;
                            advancedSettings.IncludeT4File.IsEnabled = false;
                        }
                    }
                };
            }

            this.Pages.Add(ConfigODataEndpointViewModel);
            this.Pages.Add(AdvancedSettingsViewModel);
            this.IsFinishEnabled = true;
        }