Пример #1
0
        virtual public void DispatchOpenSceToPath(string serverPath, object workspace)
        {
            /* In VS2013 (unlike VS2010) the Source Control Explorer opens asynchronously. This caused an issue that when
             * the SCE was not open and "Locate in TFS" was clicked we would not be able to open the SCE to the correct place
             * because it hadn't finished opening and connecting.
             *
             * There aren't any obvious events to which to subscribe, thus we do some polling in a separate thread via
             * the Dispatcher. It has to be a separate thread in order to not block the SCE from loading.
             * */

            // This will make sure the SCE window is open, or will open
            dynamic sccToolWindow = new AccessPrivateWrapper(HatterasPackage._wrapped.GetToolWindowSccExplorer(true));
            dynamic explorer      = new AccessPrivateWrapper(sccToolWindow.SccExplorer);

            // We don't want to loop infinitely, if we've tried a few times and it's still not connected then just give up
            // By default this will be about five seconds (10 attempts, 0.5 seconds interval)
            var poller = new DispatchedPoller(MaxDispatchAttempts, DispatchPollTime, () =>
            {
                return(!explorer.IsDisconnected);
            },
                                              () =>
            {
                // The explorer is connected, so we're ready to go
                OpenSceToPathWithPrecedingCall(serverPath, workspace, explorer);
            });

            poller.Go();
        }
        virtual public void DispatchScrollToSccExplorerSelection(TimeSpan interval, dynamic explorer)
        {
            dynamic listView = explorer.listViewExplorer;
            if (listView == null) return;

            Func<bool> condition = () => listView.SelectedIndices.Count > 0;
            Action todo = () =>
            {
                int selectedIndex = listView.SelectedIndices[0];
                listView.EnsureVisible(selectedIndex);
            };

            var poller = new DispatchedPoller(10, TimeSpan.FromSeconds(0.25), condition, todo);
            poller.Go();
        }
	    virtual public void DispatchOpenSceToPath(string serverPath, object workspace)
        {
            /* In VS2013 (unlike VS2010) the Source Control Explorer opens asynchronously. This caused an issue that when
             * the SCE was not open and "Locate in TFS" was clicked we would not be able to open the SCE to the correct place
             * because it hadn't finished opening and connecting.
             * 
             * There aren't any obvious events to which to subscribe, thus we do some polling in a separate thread via 
             * the Dispatcher. It has to be a separate thread in order to not block the SCE from loading.
             * */

            // This will make sure the SCE window is open, or will open
            dynamic sccToolWindow = new AccessPrivateWrapper(HatterasPackage._wrapped.GetToolWindowSccExplorer(true));
            dynamic explorer = new AccessPrivateWrapper(sccToolWindow.SccExplorer);
            
            // We don't want to loop infinitely, if we've tried a few times and it's still not connected then just give up
            // By default this will be about five seconds (10 attempts, 0.5 seconds interval)
            var poller = new DispatchedPoller(MaxDispatchAttempts, DispatchPollTime, () =>
            {
                return !explorer.IsDisconnected;
            },
            () =>
            {
                // The explorer is connected, so we're ready to go
                OpenSceToPathWithPrecedingCall(serverPath, workspace, explorer);
            });
            poller.Go();
        }