Exemplo n.º 1
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            MyLog.DebugEnter(this, "Initialize()");

            base.Initialize();

            // TODO:(pv) Since crawling starts post-reviewing in the background, we may need to test for post-review
            // and notify user if we cannot find it in the path...or if there is any other error while crawling.
            // This may not be necessary if the crawler properly reports error back to VS

            // solutionTracker constructor subscribes to Solution events and starts crawling a solution after it is opened
            solutionTracker = new MySolutionTracker(this, BackgroundInitialSolutionCrawl_RunWorkerCompleted);

            OleMenuCommandService mcs = GetService <IMenuCommandService>() as OleMenuCommandService;

            if (null != mcs)
            {
                // Define commands ids as unique Guid/integer pairs...
                CommandID idReviewBoard = new CommandID(MyPackageConstants.CommandSetIdGuid, MyPackageCommandIds.cmdIdReviewBoard);

                // Define the menu command callbacks...
                OleMenuCommand commandReviewBoard = new OleMenuCommand(new EventHandler(ReviewBoardCommand), idReviewBoard);

                // TODO:(pv) Only display ReviewBoard if svn status says selected item(s) have been changed
                commandReviewBoard.BeforeQueryStatus += new EventHandler(commandReviewBoard_BeforeQueryStatus);

                // Add the menu commands to the command service...
                mcs.AddCommand(commandReviewBoard);
            }

            MyLog.DebugLeave(this, "Initialize()");
        }
Exemplo n.º 2
0
        void BackgroundInitialSolutionCrawl_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {
                MyLog.DebugEnter(this, "BackgroundInitialSolutionCrawl_RunWorkerCompleted(...)");

                //
                // Reference:
                //  http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.runworkercompleted.aspx
                //
                //  "Your RunWorkerCompleted event handler should always check the
                //  AsyncCompletedEventArgs.Error and AsyncCompletedEventArgs.Cancelled
                //  properties before accessing the RunWorkerCompletedEventArgs.Result property.
                //  If an exception was raised or if the operation was canceled, accessing the
                //  RunWorkerCompletedEventArgs.Result property raises an exception."
                //
                // See also:
                //  http://www.developerdotstar.com/community/node/671
                //

                Exception error = e.Error;
                if (error == null)
                {
                    Debug.WriteLine("BackgroundInitialSolutionCrawl completed successfully with no errors");
                    return;
                }

                Debug.WriteLine("BackgroundInitialSolutionCrawl encountered error");

                StringBuilder message = new StringBuilder();

                message.AppendLine("Error finding solution changes:");
                message.AppendLine();
                if (error is PostReview.PostReviewException)
                {
                    message.Append(error.ToString());
                    message.AppendLine();
                    message.Append("Make sure ").Append(PostReview.PostReviewExe).AppendLine(" is in your PATH!");
                }
                else
                {
                    message.Append(error.Message);
                }
                message.AppendLine();
                message.Append("Click \"OK\" to return to Visual Studio.");

                MessageBox.Show(message.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                MyLog.DebugLeave(this, "BackgroundInitialSolutionCrawl_RunWorkerCompleted(...)");
            }
        }
Exemplo n.º 3
0
 void commandReviewBoard_BeforeQueryStatus(object sender, EventArgs e)
 {
     MyLog.DebugEnter(this, "commandReviewBoard_BeforeQueryStatus(...)");
     MyLog.DebugLeave(this, "commandReviewBoard_BeforeQueryStatus(...)");
 }
Exemplo n.º 4
0
 /// <summary>
 /// Default constructor of the package.
 /// Inside this method you can place any initialization code that does not require
 /// any Visual Studio service because at this point the package object is created but
 /// not sited yet inside Visual Studio environment. The place to do all the other
 /// initialization is the Initialize method.
 /// </summary>
 public ReviewBoardVsPackage()
 {
     MyLog.DebugEnter(this, "()");
     MyLog.DebugLeave(this, "()");
 }