public async Task Initialize(ProjectOptions projectOptions,
                                     bool isProject,
                                     ProjectOptionsUserControlViewModel inherited,
                                     string viewModelSuffix,
                                     LocationDescriptorUserControlViewModel locationDescriptorForViewModel,
                                     LocationDescriptorUserControlViewModel locationDescriptorForView)
        {
            IsProject       = isProject;
            ResetButtonText = isProject ? "Reset Project to Solution Defaults" : "Reset Solution to Defaults";

            ProjectModel = projectOptions.ProjectModel;
            InheritedProjectOptionsViewModel = inherited;

            LocationDescriptorForViewModel           = locationDescriptorForViewModel;
            LocationDescriptorForViewModel.Inherited = inherited?.LocationDescriptorForViewModel;
            await LocationDescriptorForViewModel.InitializeFromSolution();

            locationDescriptorForViewModel.PropertyChanged += LocationDescriptorOnPropertyChanged;

            LocationDescriptorForView           = locationDescriptorForView;
            LocationDescriptorForView.Inherited = inherited?.LocationDescriptorForView;
            await LocationDescriptorForView.InitializeFromSolution();

            locationDescriptorForView.PropertyChanged += LocationDescriptorOnPropertyChanged;

            // Now set initial property values.
            ViewModelSuffix = viewModelSuffix;
            LocationDescriptorForViewModel.SetFromDescriptor(projectOptions.ViewModelLocation);
            LocationDescriptorForView.SetFromDescriptor(projectOptions.ViewLocation);

            ResetToInheritedCommand.RaiseCanExecuteChanged();
        }
Exemplo n.º 2
0
        private static ProjectOptions ConvertToProjectOptions(ProjectOptionsUserControlViewModel projectOptionsVm)
        {
            var rval = new ProjectOptions
            {
                ProjectModel      = projectOptionsVm.ProjectModel,
                ViewModelSuffix   = projectOptionsVm.ViewModelSuffix,
                ViewLocation      = projectOptionsVm.LocationDescriptorForView.GetDescriptor(),
                ViewModelLocation = projectOptionsVm.LocationDescriptorForViewModel.GetDescriptor()
            };

            return(rval);
        }
Exemplo n.º 3
0
        // Passed in inherited view model could be from SettingsService (for the solution),
        // or from the solution (for the projects) (mutable).
        private async Task <ProjectOptionsUserControlViewModel> CreateProjectOptionsUserControlViewModel(ProjectOptions projectOptions, ProjectOptionsUserControlViewModel inherited,
                                                                                                         bool isProject)
        {
            var rval = Kernel.Get <ProjectOptionsUserControlViewModel>();

            await rval.Initialize(
                projectOptions,
                isProject,
                inherited,
                projectOptions.ViewModelSuffix,
                Kernel.Get <LocationDescriptorUserControlViewModel>(),
                Kernel.Get <LocationDescriptorUserControlViewModel>());

            return(rval);
        }