public static void print(ISolutionEvents data)
        {
            Func<ISolutionEvent[], string, string> about = delegate(ISolutionEvent[] evt, string caption)
            {
                if(evt == null) {
                    return String.Format("\n\t-- /--] {0} :: Not Initialized", caption);
                }

                System.Text.StringBuilder info = new System.Text.StringBuilder();
                info.Append(String.Format("\n\t{0,2} /{1,2}] {2} :: ", evt.Where(i => i.Enabled).Count(), evt.Length, caption));
                foreach(ISolutionEvent item in evt) {
                    info.Append(String.Format("[{0}]", (item.Enabled) ? "!" : "X"));
                }
                return info.ToString();
            };
            Log._.rawLn("\nReady:");

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(about(data.PreBuild,      "Pre-Build     "));
            sb.Append(about(data.PostBuild,     "Post-Build    "));
            sb.Append(about(data.CancelBuild,   "Cancel-Build  "));
            sb.Append(about(data.CommandEvent,  "CommandEvent  "));
            sb.Append(about(data.WarningsBuild, "Warnings-Build"));
            sb.Append(about(data.ErrorsBuild,   "Errors-Build  "));
            sb.Append(about(data.OWPBuild,      "Output-Build  "));
            sb.Append(about(data.Transmitter,   "Transmitter   "));
            sb.Append(about(data.Logging,       "Logging       "));
            sb.Append("\n---\n");
            Log._.raw(sb.ToString());
        }
 public SolutionExplorerNodeFactory(
     [Named(DefaultHierarchyFactory.RegisterKey)] Lazy <ITreeNodeFactory <IVsSolutionHierarchyNode> > nodeFactory,
     ISolutionEvents solutionEvents)
 {
     this.nodeFactory = nodeFactory;
     solutionEvents.SolutionClosed += (sender, args) => nodeCache.Clear();
 }
Exemple #3
0
 public ToolWindowContentViewer(ISolutionEvents solutionEvents, Func <Type, int, bool, ToolWindowPane> findToolWindow)
 {
     solutionEvents.SolutionClosing += (sender, args) => ClearWindows();
     solutionEvents.SolutionClosed  += (sender, args) => ClearWindows();
     solutionEvents.SolutionOpened  += (sender, args) => ClearWindows();
     this.findToolWindow             = findToolWindow;
 }
 public SolutionExplorerNodeFactory(
     [Named(DefaultHierarchyFactory.RegisterKey)] Lazy<ITreeNodeFactory<IVsSolutionHierarchyNode>> nodeFactory,
     ISolutionEvents solutionEvents)
 {
     this.nodeFactory = nodeFactory;
     solutionEvents.SolutionClosed += (sender, args) => nodeCache.Clear();
 }
Exemple #5
0
        public PatternManager(
            [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider,
            ISolution solution,
            IShellEvents shellEvents,
            ISolutionEvents solutionEvents,
            IItemEvents itemEvents,
            IEnumerable <IInstalledToolkitInfo> installedToolkits,
            IUserMessageService messageService)
        {
            Guard.NotNull(() => serviceProvider, serviceProvider);
            Guard.NotNull(() => solution, solution);
            Guard.NotNull(() => shellEvents, shellEvents);
            Guard.NotNull(() => solutionEvents, solutionEvents);
            Guard.NotNull(() => itemEvents, itemEvents);
            Guard.NotNull(() => installedToolkits, installedToolkits);
            Guard.NotNull(() => messageService, messageService);

            this.serviceProvider   = serviceProvider;
            this.solution          = solution;
            this.solutionEvents    = solutionEvents;
            this.shellEvents       = shellEvents;
            this.itemEvents        = itemEvents;
            this.installedToolkits = installedToolkits.ToArray();
            this.messageService    = messageService;

            this.solutionEvents.SolutionOpened  += this.OnSolutionOpened;
            this.solutionEvents.SolutionClosing += this.OnSolutionClosing;
            this.itemEvents.ItemRemoved         += OnItemRemoved;
        }
 public FCCEngine(
     ICoverageUtilManager coverageUtilManager,
     ICoberturaUtil coberturaUtil,
     IMsTestPlatformUtil msTestPlatformUtil,
     IReportGeneratorUtil reportGeneratorUtil,
     ILogger logger,
     IAppDataFolder appDataFolder,
     ICoverageToolOutputManager coverageOutputManager,
     IMsCodeCoverageRunSettingsService msCodeCoverageRunSettingsService,
     ISolutionEvents solutionEvents,
     IAppOptionsProvider appOptionsProvider,
     IEventAggregator eventAggregator,
     IDisposeAwareTaskRunner disposeAwareTaskRunner
     )
 {
     this.solutionEvents                = solutionEvents;
     this.eventAggregator               = eventAggregator;
     this.disposeAwareTaskRunner        = disposeAwareTaskRunner;
     solutionEvents.AfterClosing       += (s, args) => ClearOutputWindow(false);
     appOptionsProvider.OptionsChanged += (appOptions) =>
     {
         if (!appOptions.Enabled)
         {
             ClearUI();
         }
     };
     this.coverageOutputManager = coverageOutputManager;
     this.coverageUtilManager   = coverageUtilManager;
     this.coberturaUtil         = coberturaUtil;
     this.msTestPlatformUtil    = msTestPlatformUtil;
     this.reportGeneratorUtil   = reportGeneratorUtil;
     this.logger        = logger;
     this.appDataFolder = appDataFolder;
     this.msCodeCoverageRunSettingsService = msCodeCoverageRunSettingsService;
 }
 public ToolWindowContentViewer(ISolutionEvents solutionEvents, Func<Type, int, bool, ToolWindowPane> findToolWindow)
 {
     solutionEvents.SolutionClosing += (sender, args) => ClearWindows();
     solutionEvents.SolutionClosed += (sender, args) => ClearWindows();
     solutionEvents.SolutionOpened += (sender, args) => ClearWindows();
     this.findToolWindow = findToolWindow;
 }
Exemple #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SolutionBuilderViewModel"/> class.
        /// </summary>
        /// <param name="context">The pattern explorer context.</param>
        /// <param name="serviceProvider">The service provider.</param>
        public SolutionBuilderViewModel(ISolutionBuilderContext context, IServiceProvider serviceProvider)
        {
            Guard.NotNull(() => context, context);
            Guard.NotNull(() => serviceProvider, serviceProvider);

            this.context           = context;
            this.context.ViewModel = this;
            this.serviceProvider   = serviceProvider;

            this.context.SetSelected = p => this.CurrentNode = p;

            this.solutionListener = this.GetService <ISolutionEvents>();

            this.isSolutionOpened = this.solutionListener.IsSolutionOpened;
            this.isStateOpened    = this.context.PatternManager.IsOpen || this.isSolutionOpened;

            this.TopLevelNodes = new ObservableCollection <IProductElementViewModel>();
            if (this.IsStateOpened)
            {
                this.Refresh();
            }

            this.solutionListener.SolutionOpened += this.OnSolutionOpened;
            this.solutionListener.SolutionClosed += this.OnSolutionClosed;

            context.PatternManager.IsOpenChanged  += this.OnIsOpenChanged;
            context.PatternManager.ElementDeleted += this.OnElementDeleted;
            context.PatternManager.ElementCreated += this.OnElementCreated;

            this.InitializeCommands();
        }
Exemple #9
0
        public static void Print(ISolutionEvents data)
        {
            Func <ISolutionEvent[], string, string> about = delegate(ISolutionEvent[] evt, string caption)
            {
                if (evt == null)
                {
                    return(String.Format("\n    -- /--] {0} :: Not Initialized", caption));
                }

                System.Text.StringBuilder info = new System.Text.StringBuilder();
                info.Append(String.Format("\n    {0,2} /{1,2}] {2} :: ", evt.Where(i => i.Enabled).Count(), evt.Length, caption));
                foreach (ISolutionEvent item in evt)
                {
                    info.Append(String.Format("[{0}]", (item.Enabled) ? "!" : "X"));
                }
                return(info.ToString());
            };

            Log._.rawLn("\nReady:");

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append(about(data.PreBuild, "Pre-Build     "));
            sb.Append(about(data.PostBuild, "Post-Build    "));
            sb.Append(about(data.CancelBuild, "Cancel-Build  "));
            sb.Append(about(data.CommandEvent, "CommandEvent  "));
            sb.Append(about(data.WarningsBuild, "Warnings-Build"));
            sb.Append(about(data.ErrorsBuild, "Errors-Build  "));
            sb.Append(about(data.OWPBuild, "Output-Build  "));
            sb.Append(about(data.SlnOpened, "Sln-Opened    "));
            sb.Append(about(data.SlnClosed, "Sln-Closed    "));
            sb.Append(about(data.Transmitter, "Transmitter   "));
            sb.Append(about(data.Logging, "Logging       "));
            sb.Append("\n---\n");
            Log._.raw(sb.ToString());
        }
        /// <summary>
        /// Activation of components with ISolutionEvents.
        /// </summary>
        /// <param name="data"></param>
        public void updateActivation(ISolutionEvents data)
        {
            if (data == null)
            {
                Log.Debug("Bootloader: Changing of activation has been ignored.");
                return;
            }

            foreach (IComponent c in Registered)
            {
                if (data.Components == null || data.Components.Length < 1)
                {
                    //c.Enabled = true;
                    continue;
                }

                Configuration.Component found = data.Components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault();
                if (found == null)
                {
                    continue;
                }

#if DEBUG
                if (c.Enabled != found.Enabled)
                {
                    Log.Trace("Bootloader - Component '{0}': Changing of activation status '{1}' -> '{2}'", found.ClassName, c.Enabled, found.Enabled);
                }
#endif
                c.Enabled = found.Enabled;
            }
        }
Exemple #11
0
        /// <summary>
        /// Unsubscribes from the solution events.
        /// </summary>
        /// <param name="subscriber"></param>
        public void UnsubscribeSolutionEvents(ISolutionEvents subscriber)
        {
            if (subscriber == null)
            {
                throw new ArgumentNullException(nameof(subscriber));
            }

            if (_solutionEventSubscribers.Contains(subscriber))
            {
                _solutionEventSubscribers.Remove(subscriber);
            }
        }
Exemple #12
0
 public MainViewModel(IProjectsCollection projects, ISolutionEvents solutionEvents)
 {
     _projects         = projects;
     _solutionEvents   = solutionEvents;
     CommentsViewModel = new List <CommentViewModel>();
     ReloadProjects();
     _solutionEvents.SolutionOpened  += OnAnySolutionEvent;
     _solutionEvents.SolutionClosing += OnAnySolutionEvent;
     _solutionEvents.ProjectAdded    += OnAnySolutionEvent;
     _solutionEvents.ProjectRemoved  += OnAnySolutionEvent;
     _solutionEvents.ProjectRenamed  += OnAnySolutionEvent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SolutionNodeFactory"/> class.
 /// </summary>
 /// <param name="serviceLocator">The service locator.</param>
 /// <param name="childNodeFactory">The factory for nodes, used to construct child nodes automatically.</param>
 /// <param name="looseNodeFactory">The explorer node factory used to create "loose" nodes from solution explorer.</param>
 /// <param name="solutionEvents">The solution events.</param>
 /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
 /// <param name="uiThread">The UI thread.</param>
 public SolutionNodeFactory(
     IServiceLocator serviceLocator,
     [Named(DefaultHierarchyFactory.RegisterKey)] Lazy <ITreeNodeFactory <IVsSolutionHierarchyNode> > childNodeFactory,
     ISolutionExplorerNodeFactory looseNodeFactory,
     ISolutionEvents solutionEvents,
     IAdapterService adapter,
     IUIThread uiThread)
 {
     this.locator          = serviceLocator;
     this.childNodeFactory = childNodeFactory;
     this.looseNodeFactory = looseNodeFactory;
     this.solutionEvents   = solutionEvents;
     this.adapter          = adapter;
     this.uiThread         = uiThread;
 }
        public ProjectManager(IServiceProvider serviceProvider, ISolutionEvents solutionEvents)
        {
            this.serviceProvider = serviceProvider;
            solution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));
            BuildProjectList();
            solutionEvents.OnAfterOpenSolution += new EventHandler(solutionEvents_OnAfterOpenSolution);
            solutionEvents.OnAfterCloseSolution += new EventHandler(solutionEvents_OnAfterCloseSolution);

            OleMenuCommandService commandService = serviceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
            // Create the command for the convert to Bistro command
            commandService.AddCommand(
                new MenuCommand(
                    convertCommand_Click,
                    new CommandID(Guids.guidCoreCmdSet, (int)PkgCmdIDList.cmdidConvertProjects)
                    )
                );
        }
Exemple #15
0
        /// <summary>
        /// Subscribes to the solution events.
        /// </summary>
        /// <param name="subscriber">Subscriber.</param>
        public void SubscribeSolutionEvents(ISolutionEvents subscriber)
        {
            if (subscriber == null)
            {
                throw new ArgumentNullException(nameof(subscriber));
            }

            ThreadHelper.ThrowIfNotOnUIThread();

            if (!_initialized)
            {
                Initialize();
            }

            if (!_solutionEventSubscribers.Contains(subscriber))
            {
                _solutionEventSubscribers.Add(subscriber);
            }
        }
Exemple #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SolutionNode"/> class.
 /// </summary>
 /// <param name="hierarchyNode">The underlying hierarchy represented by this node.</param>
 /// <param name="childNodeFactory">The factory for child nodes.</param>
 /// <param name="looseNodeFactory">The explorer node factory used to create "loose" nodes from solution explorer.</param>
 /// <param name="locator">The service locator.</param>
 /// <param name="adapter">The adapter service that implements the smart cast <see cref="ITreeNode.As{T}"/>.</param>
 /// <param name="solutionEvents">The solution events.</param>
 /// <param name="uiThread">The UI thread.</param>
 public SolutionNode(
     IVsSolutionHierarchyNode hierarchyNode,
     // This is the regular node factory for trees, that receives a lazy
     // pointer to the parent tree node.
     ITreeNodeFactory <IVsSolutionHierarchyNode> childNodeFactory,
     // This factory is used to create "loose" nodes from solution explorer
     ISolutionExplorerNodeFactory looseNodeFactory,
     IServiceLocator locator,
     IAdapterService adapter,
     ISolutionEvents solutionEvents,
     // Retrieving current selection must be done on the UI thread.
     IUIThread uiThread)
     : base(SolutionNodeKind.Solution, hierarchyNode, null, childNodeFactory, adapter)
 {
     this.Solution            = new Lazy <EnvDTE.Solution>(() => hierarchyNode.ServiceProvider.GetService <EnvDTE.DTE>().Solution);
     this.nodeFactory         = childNodeFactory;
     this.explorerNodeFactory = looseNodeFactory;
     this.events    = solutionEvents;
     this.selection = new Lazy <IVsMonitorSelection>(() => locator.GetService <SVsShellMonitorSelection, IVsMonitorSelection>());
     this.uiThread  = uiThread;
 }
Exemple #17
0
 /// <summary>
 /// Update Configuration data for specific context.
 /// </summary>
 /// <param name="data">Configuration data.</param>
 /// <param name="context">Specific context.</param>
 public void update(ISolutionEvents data, ContextType context)
 {
     configs[context] = data;
 }
        /// <summary>
        /// Activation of components with ISolutionEvents.
        /// </summary>
        /// <param name="ISolutionEvents"></param>
        public void updateActivation(ISolutionEvents data)
        {
            if(data == null) {
                Log.Debug("Configuration: activation with IBootloader has been ignored.");
                return;
            }

            foreach(IComponent c in Registered)
            {
                if(data.Components == null || data.Components.Length < 1) {
                    //c.Enabled = true;
                    continue;
                }

                Configuration.Component found = data.Components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault();
                if(found != null) {
                    c.Enabled = found.Enabled;
                }
            }
        }
 public SolutionExplorerNodeFactory(
     [Named(DefaultHierarchyFactory.RegisterKey)] Lazy<ITreeNodeFactory<IVsSolutionHierarchyNode>> nodeFactory,
     ISolutionEvents solutionEvents)
 {
     this.nodeFactory = nodeFactory;
 }
 public TestPatternManager(IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable<IInstalledToolkitInfo> installedFactories, IUserMessageService messageService)
     : base(serviceProvider, solution, shellEvents, solutionEvents, itemEvents, installedFactories, messageService)
 {
 }
Exemple #21
0
 /// <summary>
 /// Update Configuration data for specific context.
 /// </summary>
 /// <param name="data">Configuration data.</param>
 /// <param name="context">Specific context.</param>
 public void update(ISolutionEvents data, ContextType context)
 {
     configs[context] = data;
 }
Exemple #22
0
        /// <summary>
        /// Activation of components with ISolutionEvents.
        /// </summary>
        /// <param name="data"></param>
        public void updateActivation(ISolutionEvents data)
        {
            if(data == null) {
                Log.Debug("Bootloader: Changing of activation has been ignored.");
                return;
            }

            foreach(IComponent c in Registered)
            {
                if(data.Components == null || data.Components.Length < 1) {
                    //c.Enabled = true;
                    continue;
                }

                Configuration.Component found = data.Components.Where(p => p.ClassName == c.GetType().Name).FirstOrDefault();
                if(found == null) {
                    continue;
                }

            #if DEBUG
                if(c.Enabled != found.Enabled) {
                    Log.Trace("Bootloader - Component '{0}': Changing of activation status '{1}' -> '{2}'", found.ClassName, c.Enabled, found.Enabled);
                }
            #endif
                c.Enabled = found.Enabled;
            }
        }
 public TestPatternManager(IServiceProvider serviceProvider, ISolution solution, IShellEvents shellEvents, ISolutionEvents solutionEvents, IItemEvents itemEvents, IEnumerable <IInstalledToolkitInfo> installedFactories, IUserMessageService messageService)
     : base(serviceProvider, solution, shellEvents, solutionEvents, itemEvents, installedFactories, messageService)
 {
 }