Esempio n. 1
0
        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();
        }
Esempio 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);
        }
Esempio 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 = Container.Resolve <ProjectOptionsUserControlViewModel>();

            await rval.Initialize(
                projectOptions,
                isProject,
                inherited,
                projectOptions.ViewModelSuffix,
                Container.Resolve <LocationDescriptorUserControlViewModel>(),
                Container.Resolve <LocationDescriptorUserControlViewModel>());

            return(rval);
        }