Exemplo n.º 1
0
        public MvvmToolsSettings GetCurrentSettings()
        {
            if (ProjectsOptions == null || ViewSuffixes == null)
            {
                return(null);
            }

            // Extracts settings from view model properties.  These are the
            // 'current' settings, while the unmodified settings values are stored in
            // _unmodifiedSettings.
            var settings = new MvvmToolsSettings
            {
                GoToViewOrViewModelOption         = SelectedGoToViewOrViewModelOption,
                GoToViewOrViewModelSearchSolution = GoToViewOrViewModelSearchSolution,
                ViewSuffixes        = ViewSuffixes.Select(vs => vs.Value).ToArray(),
                LocalTemplateFolder = LocalTemplateFolder
            };

            for (int index = 0; index < ProjectsOptions.Count; index++)
            {
                // First item is the solution, subsequent items are the projects.
                if (index == 0)
                {
                    settings.SolutionOptions = ConvertToProjectOptions(ProjectsOptions[0]);
                }
                else
                {
                    var po = ProjectsOptions[index];
                    settings.ProjectOptions.Add(ConvertToProjectOptions(po));
                }
            }

            return(settings);
        }
Exemplo n.º 2
0
        public void ExecuteEditViewSuffixCommand()
        {
            try
            {
                var cur = ViewSuffixesView.CurrentItem as StringViewModel;
                Debug.Assert(cur != null);

                var vm = Kernel.Get <StringDialogViewModel>();
                vm.Edit(true, "Edit View Suffix", "View Suffix:", cur.Value, ViewSuffixes.Select(s => s.Value),
                        SuffixRegex, SuffixRegexErrorMessage);
                if (DialogService.ShowDialog(vm))
                {
                    cur.Value = vm.Value;
                }
            }
            catch
            {
                // ignored
            }
        }
Exemplo n.º 3
0
        public void ExecuteAddViewSuffixCommand()
        {
            try
            {
                var vm = Kernel.Get <StringDialogViewModel>();
                vm.Add(true, "Add View Suffix", "View Suffix:", ViewSuffixes?.Select(s => s.Value),
                       SuffixRegex, SuffixRegexErrorMessage);

                if (DialogService.ShowDialog(vm))
                {
                    var newItem = StringViewModel.CreateFromString(Kernel, vm.Value);
                    ViewSuffixesView.AddNewItem(newItem);
                    // ReSharper disable once PossibleNullReferenceException
                    ViewSuffixesView.MoveCurrentTo(newItem);
                }
            }
            catch
            {
                // ignored
            }
        }