Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TaskService"/> class.
        /// </summary>
        /// <param name="scheduledTaskStorage">The scheduled task storage.</param>
        /// <param name="taskCreatorManager">The task creator manager.</param>
        /// <param name="taskManagerFactory">The task manager factory.</param>
        /// <exception cref="System.ArgumentNullException">
        /// scheduledTaskStorage
        /// or
        /// taskCreatorManager
        /// or
        /// taskManagerFactory
        /// </exception>
        public TaskService(IScheduledTaskStorage scheduledTaskStorage, ITaskCreatorManager taskCreatorManager, ITaskManagerFactory taskManagerFactory)
        {
            if (scheduledTaskStorage == null)
            {
                throw new ArgumentNullException("scheduledTaskStorage");
            }

            if (taskCreatorManager == null)
            {
                throw new ArgumentNullException("taskCreatorManager");
            }

            if (taskManagerFactory == null)
            {
                throw new ArgumentNullException("taskManagerFactory");
            }

            m_ScheduledTaskStorage = scheduledTaskStorage;
            m_TaskCreatorManager   = taskCreatorManager;
            m_TaskManagerFactory   = taskManagerFactory;
        }
Beispiel #2
0
        protected override void Initialize()
        {
            Common.Trace("Package intialize");
            base.Initialize();
            Common.Trace("Task manager.Initialize()");

            // Initialize common functionality
            Common.Initialize(this);
            taskListMenu = new RootMenu();

            // Initialize fields
            tools = new Tools();
            sharedTaskManagers = new List <TaskManager>();

            // Attach to solution events
            solution = GetService(typeof(SVsSolution)) as IVsSolution;
            if (solution == null)
            {
                Common.Log("Could not get solution");
            }
            solution.AdviseSolutionEvents(this as IVsSolutionEvents, out solutionEventsCookie);

            // Attach to build events
            buildManager = GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager;
            if (buildManager == null)
            {
                Common.Log("Could not get build manager");
            }
            buildManager.AdviseUpdateSolutionEvents(this, out buildManagerCookie);

            // Add a TaskManagerFactory service
            ITaskManagerFactory factory = this as ITaskManagerFactory;

            (this as System.ComponentModel.Design.IServiceContainer).AddService(typeof(ITaskManagerFactory), factory, true);

            // Set PID for msbuild tasks
            Environment.SetEnvironmentVariable("VSPID", System.Diagnostics.Process.GetCurrentProcess().Id.ToString());
        }