示例#1
0
        internal static void PerformDeploymentOperation(DTE dte, List <Project> projects, string operation)
        {
            List <SharePointDeploymentJob> wspFiles = new List <SharePointDeploymentJob>();

            foreach (Project project in projects)
            {
                SharePointDeploymentJob job = new SharePointDeploymentJob();
                job.WSPName             = GetWSPName(dte, project);
                job.WSPFilename         = GetWSPFilePath(dte, project);
                job.TargetSiteUrl       = GetSiteUrl(dte, project);
                job.IsSandBoxedSolution = Helpers.GetIsSandboxedSolution(project);

                if (!File.Exists(job.WSPFilename))
                {
                    Helpers.LogMessage(dte, dte, "Error: WSP file not found for project '" + project.Name + "' finished (using '" + job.WSPFilename + "')");
                }
                else
                {
                    wspFiles.Add(job);
                }
            }
            if (wspFiles.Count > 0)
            {
                WorkerObject workerObject = new WorkerObject();
                workerObject.DTE       = dte;
                workerObject.Operation = operation;
                workerObject.WSPFiles  = wspFiles;

                worker = new BackgroundWorker();
                worker.ProgressChanged    += new ProgressChangedEventHandler(worker_ProgressChanged);
                worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
                worker.DoWork             += new DoWorkEventHandler(worker_DoWork);
                worker.RunWorkerAsync(workerObject);
            }
        }
示例#2
0
 internal static void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     if (e.Argument is WorkerObject)
     {
         WorkerObject workerObject = e.Argument as WorkerObject;
         new SharePointBrigdeHelper(workerObject.DTE).PerformDeploymentOperation(workerObject.Operation, workerObject.WSPFiles);
     }
 }
        internal static void PerformDeploymentOperation(DTE dte, List<Project> projects, string operation)
        {
            List<SharePointDeploymentJob> wspFiles = new List<SharePointDeploymentJob>();
            foreach (Project project in projects)
            {
                SharePointDeploymentJob job = new SharePointDeploymentJob();
                job.WSPName = GetWSPName(dte, project);
                job.WSPFilename = GetWSPFilePath(dte, project);
                job.TargetSiteUrl = GetSiteUrl(dte, project);
                job.IsSandBoxedSolution = Helpers.GetIsSandboxedSolution(project);

                if (!File.Exists(job.WSPFilename))
                {
                    Helpers.LogMessage(dte, dte, "Error: WSP file not found for project '" + project.Name + "' finished (using '" + job.WSPFilename + "')");
                }
                else
                {
                    wspFiles.Add(job);
                }
            }
            if (wspFiles.Count > 0)
            {
                WorkerObject workerObject = new WorkerObject();
                workerObject.DTE = dte;
                workerObject.Operation = operation;
                workerObject.WSPFiles = wspFiles;

                worker = new BackgroundWorker();
                worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
                worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);
                worker.DoWork += new DoWorkEventHandler(worker_DoWork);
                worker.RunWorkerAsync(workerObject);                             
            }
        }