private static ConnectionResolverViewModel CreateViewModel()
        {
            var container = new UnityContainer();

            var viewsContainer = new ViewsContainer(container);

            MabadoViewBootLoader viewBootLoader = new MabadoViewBootLoader(container, viewsContainer);

            viewBootLoader.RegisterConnectionResolverModule();

            OverrideMockedDependencies(container);

            ConnectionResolverView view = viewsContainer.ResolveWindow<ConnectionResolverView>();

            var viewModel = view.DataContext as ConnectionResolverViewModel;
            return viewModel;
        }
Beispiel #2
0
        /// <summary>Implements the Exec method of the IDTCommandTarget interface. This is called when the command is invoked.</summary>
        /// <param term='commandName'>The name of the command to execute.</param>
        /// <param term='executeOption'>Describes how the command should be run.</param>
        /// <param term='varIn'>Parameters passed from the caller to the command handler.</param>
        /// <param term='varOut'>Parameters passed from the command handler to the caller.</param>
        /// <param term='handled'>Informs the caller if the command was handled or not.</param>
        /// <seealso class='Exec' />
        public void Exec(string commandName, vsCommandExecOption executeOption, ref object varIn, ref object varOut, ref bool handled)
        {
            handled = false;
            if(executeOption == vsCommandExecOption.vsCommandExecOptionDoDefault)
            {
                IPathProvider serverPathProvider = new BranchPathProvider(_applicationObject);

                MabadoViewBootLoader viewBootLoader = new MabadoViewBootLoader(serverPathProvider, _applicationObject.SourceControl, new OutputWindowLogger(_applicationObject));

                if(commandName == "Mabado.Connect.ConnectToLab")
                {
                    if(_applicationObject.Solution.IsOpen)
                    {
                        viewBootLoader.ConnectToLab();
                    }
                    else
                    {
                        MessageBox.Show("Open solution first.", "MabaDo", MessageBoxButtons.OK);
                    }

                    handled = true;
                }

                if (commandName == "Mabado.Connect.OpenSolution")
                {
                    if(_applicationObject.Solution.IsOpen)
                    {
                        viewBootLoader.LaunchSolution();
                    }
                    else
                    {
                        MessageBox.Show("Open solution first.", "MabaDo", MessageBoxButtons.OK);
                    }

                    handled = true;
                }
            }
        }