Exemple #1
0
        /// <summary>
        /// Sets given object as a source provide of 'Properties Window' inside Visual Studio IDE.
        /// </summary>
        /// <param name="currentWindow">Source window, that requests set.</param>
        /// <param name="sourceObject">Object, which properties will be edited.</param>
        public void SelectAtProperties(Window2 currentWindow, object sourceObject)
        {
            //IVsUIShell shell = parent.GetService(typeof(SVsUIShell)) as IVsUIShell;
            //Guid guidPropertyBrowser = new Guid(ToolWindowGuids.PropertyBrowser);
            //IVsWindowFrame frame = null;

            //if (shell != null)
            //    shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref guidPropertyBrowser, out frame);

            //if (frame != null)
            //    frame.ShowNoActivate();

            ITrackSelection trackSelection = GetService(typeof(STrackSelection)) as ITrackSelection;

            if (trackSelection != null)
            {
                selectedItems.Clear();
                if (sourceObject != null)
                {
                    selectedItems.Add(sourceObject);
                }

                selectionContainer.SelectedObjects = selectedItems;
                trackSelection.OnSelectChange(selectionContainer);
            }
            else
            {
                if (sourceObject != null && currentWindow != null)
                {
                    selectedElements[0] = sourceObject;
                    currentWindow.SetSelectionContainer(ref selectedElements);
                    currentWindow.Activate();
                }
            }
        }
        /// <summary>
        /// Get VisualStudio GridView PendingChanges
        /// </summary>
        /// <param name="_appObject">DTE2 application object</param>
        /// <returns>DataGridView </returns>
        public static System.Windows.Forms.DataGridView GetVisualStudioGridViewPendingChanges(DTE2 _appObject)
        {
            _applicationObject = _appObject;

            var windows = _applicationObject.Windows.GetEnumerator();

            while (windows.MoveNext())
            {
                Window2 tmp = (Window2)windows.Current;
                System.Diagnostics.Trace.WriteLine("Test : " + tmp.Caption);

                if (tmp.Caption.Contains("Pending Changes"))
                {
                    windowPendingChanges = (Window2)tmp;
                }
            }

            if (windowPendingChanges != null)
            {
                windowPendingChanges.Activate();
                IntPtr        windowIntPtr = Buisness.ManageWindows.GetActiveWindow();
                List <IntPtr> listChild    = Buisness.ManageWindows.GetChildWindows(windowIntPtr);

                if (listChild.Count > 0)
                {
                    IntPtr hWnd = IntPtr.Zero;
                    foreach (IntPtr handle in listChild)
                    {
                        System.Windows.Forms.Control tmpHandle = System.Windows.Forms.Control.FromHandle(handle);

                        if (tmpHandle is System.Windows.Forms.DataGridView)
                        {
                            dataGridWorkItem = (System.Windows.Forms.DataGridView)System.Windows.Forms.DataGridView.FromHandle(handle);
                            break;
                        }
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Pending Changes tab not open");
                }
            }
            return(dataGridWorkItem);
        }
 public IEnumerable <object> InvokeItem(IContext context, string path)
 {
     _window.Activate();
     return(null);
 }
Exemple #4
0
 public void Activate()
 {
     _window.Activate();
 }