コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SelectProjectsView"/> class.
        /// </summary>
        /// <param name="viewModel">
        /// The view Model.
        /// </param>
        /// <remarks>
        /// This constructor can be used to use view-model injection.
        /// </remarks>
        public SelectProjectsView(SelectProjectsViewModel viewModel)
            : base(viewModel)
        {
            StyleHelper.CreateStyleForwardersForDefaultStyles(Application.Current.Resources, Resources);

            InitializeComponent();
        }
コード例 #2
0
        /// <summary>
        /// Called when the link projects menu item is clicked.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e.</param>
        private void OnLinkProjects(object sender, EventArgs e)
        {
            Log.Info("Linking projects");

            if (!IsSolutionOpenend())
            {
                return;
            }

            var serviceLocator = ServiceLocator.Default;
            var uiVisualizerService = serviceLocator.ResolveType<IUIVisualizerService>();
            var configurationService = serviceLocator.ResolveType<IConfigurationService>();

            Log.Info("Loading configuration for current solution");

            var dte = GetVisualStudio();
            var configuration = configurationService.LoadConfigurationForCurrentSolution();

            var vm = new SelectProjectsViewModel(dte, dte.Solution.GetAllProjects());
            if (uiVisualizerService.ShowDialog(vm) ?? false)
            {
                Log.Info("Linking projects dialog returned success, linking projects");

                var pleaseWaitService = serviceLocator.ResolveType<IPleaseWaitService>();
                pleaseWaitService.Show("Linking projects, please be patient");

                var activeProject = vm.RootProject;
                var projectsToLink = (from selectableProject in vm.SelectableProjects where selectableProject.IsChecked select selectableProject.Project).ToArray();

                var linker = new Linker(activeProject, projectsToLink, configuration);
                linker.RemoveMissingFiles = vm.RemoveMissingFiles;
                linker.LinkFiles();

                Log.Info("Linked projects");

                pleaseWaitService.Hide();
            }
        }