public static IVisualStudioInstance ToMockVs(this SolutionFile self) { MockVs vs = new MockVs(); vs.Invoke(() => ErrorHandler.ThrowOnFailure(vs.Solution.OpenSolutionFile(0, self.Filename))); return(vs); }
public static IVisualStudioInstance ToMockVs(this SolutionFile self) { MockVs vs = new MockVs(); vs.Invoke(() => { // HACK: The default targets files require a function that we don't provide // The tests are mostly still broken, but they get further now. We should probably // move them into UI tests, as we can't emulate the MSBuild environment well enough // to open projects from here. Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.SetGlobalProperty("NugetRestoreTargets", "false"); ErrorHandler.ThrowOnFailure(vs.Solution.OpenSolutionFile(0, self.Filename)); }); return(vs); }
public int ShowMessageBox(uint dwCompRole, ref Guid rclsidComp, string pszTitle, string pszText, string pszHelpFile, uint dwHelpContextID, OLEMSGBUTTON msgbtn, OLEMSGDEFBUTTON msgdefbtn, OLEMSGICON msgicon, int fSysAlert, out int pnResult) { pnResult = (int)_instance.Invoke( () => { _title = pszTitle; _text = pszText; _dismiss.WaitOne(); _title = null; _text = null; _dismiss = null; return(_buttonPressed); } ); return(VSConstants.S_OK); }
public int ShowMessageBox(uint dwCompRole, ref Guid rclsidComp, string pszTitle, string pszText, string pszHelpFile, uint dwHelpContextID, OLEMSGBUTTON msgbtn, OLEMSGDEFBUTTON msgdefbtn, OLEMSGICON msgicon, int fSysAlert, out int pnResult) { pnResult = (int)_instance.Invoke( () => { MockDialog dialog = new MockMessageBox(_instance, pszTitle, pszText); lock (Dialogs) { Dialogs.Push(dialog); } dialog.Run(); lock (Dialogs) { Dialogs.Pop(); } return(dialog.DialogResult); } ); return(VSConstants.S_OK); }
public int FindAndLockDocument(uint dwRDTLockType, string pszMkDocument, out IVsHierarchy ppHier, out uint pitemid, out IntPtr ppunkDocData, out uint pdwCookie) { IVsHierarchy pHier = null; uint itemid = 0; IntPtr punkDocData = IntPtr.Zero; uint dwCookie = 0; int res = _vs.Invoke(() => { uint id; if (_ids.TryGetValue(pszMkDocument, out id)) { var docInfo = _table[id]; var lockType = (_VSRDTFLAGS)dwRDTLockType; pHier = docInfo.Hierarchy; itemid = docInfo.ItemId; if (docInfo.DocData != IntPtr.Zero) { Marshal.AddRef(docInfo.DocData); } punkDocData = docInfo.DocData; dwCookie = id; docInfo.Flags = (_VSRDTFLAGS)dwRDTLockType; if (lockType.HasFlag(_VSRDTFLAGS.RDT_ReadLock)) { docInfo.ReadLockCount++; } if (lockType.HasFlag(_VSRDTFLAGS.RDT_EditLock)) { docInfo.EditLockCount++; } return(VSConstants.S_OK); } return(VSConstants.S_FALSE); }); ppHier = pHier; pitemid = itemid; ppunkDocData = punkDocData; pdwCookie = dwCookie; return(res); }
public void DragOntoThis(Key modifier, params ITreeNode[] source) { _mockVs.Invoke(() => DragOntoThisUIThread(modifier, source)); }
public override void Post(SendOrPostCallback d, object state) { _vs.Invoke(() => d(state)); }
public CaretPosition MoveCaret(SnapshotPoint newPoint) { return(_vs.Invoke(() => _view.Caret.MoveTo(newPoint.TranslateTo(newPoint.Snapshot.TextBuffer.CurrentSnapshot, PointTrackingMode.Positive)))); }
public void Invoke(Action action) { _vs.Invoke(action); }