Ejemplo n.º 1
0
        /// <summary>
        /// This function is called when the user clicks the menu item that shows the
        /// tool window. See the Initialize method to see how the menu item is associated to
        /// this function using the OleMenuCommandService service and the MenuCommand class.
        /// </summary>
        private void ShowToolWindow(object sender, EventArgs e)
        {
            // Get the instance number 0 of this tool window. This window is single instance so this instance
            // is actually the only one.
            // The last flag is set to true so that if the tool window does not exists it will be created.

            //ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true);
            //if ((null == window) || (null == window.Frame))
            //{
            //    throw new NotSupportedException(Resources.CanNotCreateWindow);
            //}
            //IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
            //Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
            ControlForm frmConfig = new ControlForm(ref m_oDB, ref _MyDTE);

            frmConfig.ShowDialog();
        }
Ejemplo n.º 2
0
        // This is where we look through our Dictionary and check it against our database. If we have entries, we're tracking.. if
        // we don't, ask the user if we SHOULD track these. If they say yes, bring up our configuration window so they can add
        // the local/remote filesystems that need to be kept in sync. Once that's done, we'll need to verify things are currently
        // in sync. If they are, we're done.. if not, we'll need to find out if we should push or pull for syncing.
        //
        // We will also create our File System Watcher object here, and hook it up to the Solution directory.
        private void vValidateProjects()
        {
            string SolutionFullName  = _MyDTE.Solution.FullName;
            string SolutionName      = Path.GetFileName(SolutionFullName);
            string SolutionDirectory = Path.GetDirectoryName(SolutionFullName);
            string ProjectName       = null;
            string LocalStoredPath   = null;
            string RemoteStoredPath  = null;
            bool   bOverride         = false;
            bool   bMissingSolution  = false;

            foreach (Project oItems in _MyDTE.Solution.Projects)
            {
                ProjectName = oItems.Name;

                // Now that we have the Local Solution name and Project Name, we can see if they are in our database.
                m_oDB.getTrackingState(SolutionName, ProjectName, ref LocalStoredPath, ref RemoteStoredPath, ref bOverride);

                // not currently tracked, doesn't appear it's ever been noticed.
                if (LocalStoredPath == null)
                {
                    MessageBox.Show("Solution/Project is not currently tracked.. Use the interface window and set this" + Environment.NewLine +
                                    "Solution/Project to either track or to be manually overridden so it is not tracked." + Environment.NewLine + Environment.NewLine +
                                    "Solution: " + SolutionName + Environment.NewLine + "Project: " + ProjectName);
                    bMissingSolution = true;
                    continue;
                }

                if (SolutionDirectory.ToLower() != LocalStoredPath)
                {
                    // Solution not in the same place as last we tracked data for it. Prompt user to update our working info; if they
                    // say no, mark this solution as MANUALLY not tracked by the user in our database.
                }
            }

            if (bMissingSolution)
            {
                if (MessageBox.Show("Found one or more Solution/Project pairs missing from our tracking" + Environment.NewLine +
                                    "system.. would you like to open the configuration window now?", "Missing Tracking Info", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    ControlForm frmTemp = new ControlForm(ref m_oDB, ref _MyDTE);
                    frmTemp.ShowDialog();
                }
            }
        }