Esempio n. 1
0
        /// <summary>
        /// Standard constructor for the tool window.
        /// </summary>
        public MyToolWindow() :
            base(null)
        {
            // Set the window title reading it from the resources.
            this.Caption = Resources.ToolWindowTitle;
            // Set the image that will appear on the tab of the window frame
            // when docked with an other window
            // The resource ID correspond to the one defined in the resx file
            // while the Index is the offset in the bitmap strip. Each image in
            // the strip being 16x16.
            this.BitmapResourceID = 301;
            this.BitmapIndex      = 1;

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            //base.Content = new MyControl();

            var content = new ChangesetViewerMainWindow();

            var extensibility = ChangesetViewerPackage.GetGlobalService(typeof(EnvDTE.IVsExtensibility)) as EnvDTE.IVsExtensibility;

            content.UIController.DTE = extensibility.GetGlobalsObject(null).DTE as EnvDTE80.DTE2;
            ChangesetViewerUIController.TeamExplorer = (ITeamExplorer)ChangesetViewerPackage.GetGlobalService(typeof(ITeamExplorer));

            content.InitializeWindow();

            base.Content = content;
        }
        private object CreateContent()
        {
            var extensibility = ChangesetViewerPackage.GetGlobalService(typeof(EnvDTE.IVsExtensibility)) as EnvDTE.IVsExtensibility;
            var content       = new ChangesetViewerMainWindow();

            content.UIController.DTE = extensibility.GetGlobalsObject(null).DTE as EnvDTE80.DTE2;
            ChangesetViewerUIController.TeamExplorer = (ITeamExplorer)ChangesetViewerPackage.GetGlobalService(typeof(ITeamExplorer));
            content.InitializeWindow();
            content.UIController.VisualStudioColors = GetVisualStudioFilteredColors();
            content.ApplyTheme();

            return(content);
        }
Esempio n. 3
0
        private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
        {
            //ITfsServer tfs = new TfsServer();
            //tfs.GetCollection();

            //var _changesets = new Changesets(tfs);
            //var c = _changesets.Get(23969);

            EnvDTE.IVsExtensibility extensibility = ChangesetViewerPackage.GetGlobalService(typeof(EnvDTE.IVsExtensibility)) as EnvDTE.IVsExtensibility;
            //DTE = extensibility.GetGlobalsObject(null).DTE as EnvDTE80.DTE2;

            VersionControlExt vce;
            //vce = DTE.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as VersionControlExt;
            //vce.ViewChangesetDetails(c.ChangesetId);
        }
        private List <Color> GetVisualStudioBasicColorList()
        {
            IVsUIShell uiShell = (IVsUIShell)ChangesetViewerPackage.GetGlobalService(typeof(IVsUIShell));

            List <Color> result = new List <Color>();

            foreach (VSSYSCOLOR vsSysColor in Enum.GetValues(typeof(VSSYSCOLOR)))
            {
                uint win32Color;
                uiShell.GetVSSysColor(vsSysColor, out win32Color);
                Color color = ColorTranslator.FromWin32((int)win32Color);
                result.Add(color);
            }

            return(result);
        }
        private Dictionary <string, Color> GetVisualStudioDetailedColorList()
        {
            IVsUIShell2 uiShell = (IVsUIShell2)ChangesetViewerPackage.GetGlobalService(typeof(IVsUIShell));

            Dictionary <string, Color> result = new Dictionary <string, Color>();

            foreach (__VSSYSCOLOREX vsSysColor in Enum.GetValues(typeof(__VSSYSCOLOREX)))
            {
                uint win32Color;
                uiShell.GetVSSysColorEx((int)vsSysColor, out win32Color);
                Color color = ColorTranslator.FromWin32((int)win32Color);

                if (!result.Any(c => c.Key == vsSysColor.ToString()))
                {
                    result.Add(vsSysColor.ToString(), color);
                }
            }

            return(result);
        }
Esempio n. 6
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());

            //Trying to show in the team explorer window
            var service = (ITeamExplorer)ChangesetViewerPackage.GetGlobalService(typeof(ITeamExplorer));

            if (service == null)
            {
                return;
            }
            service.NavigateToPage(new Guid(GuidList.guidchangesetviewerTeamExplorerPage), null);
        }