protected override int ExecCommandOnNode(Guid cmdGroup, uint cmd, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (cmdGroup == VsMenus.guidStandardCommandSet97) { switch ((VsCommands)cmd) { case VsCommands.Delete: case VsCommands.Remove: string message = string.Format( DynamicProjectSR.GetString(DynamicProjectSR.SearchPathRemoveConfirmation), this.Caption); string title = string.Empty; OLEMSGICON icon = OLEMSGICON.OLEMSGICON_WARNING; OLEMSGBUTTON buttons = OLEMSGBUTTON.OLEMSGBUTTON_OK | OLEMSGBUTTON.OLEMSGBUTTON_OKCANCEL; OLEMSGDEFBUTTON defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST; int res = Microsoft.VisualStudio.Shell.VsShellUtilities.ShowMessageBox(this.ProjectMgr.Site, title, message, icon, buttons, defaultButton); if (res == 1) { Remove(false); } return(VSConstants.S_OK); } } return(base.ExecCommandOnNode(cmdGroup, cmd, nCmdexecopt, pvaIn, pvaOut)); }
public static object GetObject(string name) { DynamicProjectSR sys = GetLoader(); if (sys == null) { return(null); } return(sys._resources.GetObject(name, DynamicProjectSR.Culture)); }
/// <summary> /// Shows Visual Studio message box with error message regarding project to project reference. Target Project must be built before /// adding the the project to project reference. /// The message box is not show in case the method has been called from automation /// </summary> private void ShowProjectReferenceErrorMessage2() { if (!Utilities.IsInAutomationFunction(this.ProjectMgr.Site)) { string message = DynamicProjectSR.GetString(DynamicProjectSR.ProjectReferenceError2, CultureInfo.CurrentUICulture); string title = string.Empty; OLEMSGICON icon = OLEMSGICON.OLEMSGICON_CRITICAL; OLEMSGBUTTON buttons = OLEMSGBUTTON.OLEMSGBUTTON_OK; OLEMSGDEFBUTTON defaultButton = OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST; VsShellUtilities.ShowMessageBox(this.ProjectMgr.Site, title, message, icon, buttons, defaultButton); } }
private static DynamicProjectSR GetLoader() { if (_loader == null) { lock (InternalSyncObject) { if (_loader == null) { _loader = new DynamicProjectSR(); } } } return(_loader); }
/// <summary> /// This overrides the base class method to show the VS 2005 style Add reference dialog. The ProjectNode implementation /// shows the VS 2003 style Add Reference dialog. /// </summary> /// <returns>S_OK if succeeded. Failure other wise</returns> public override int AddProjectReference() { IVsComponentSelectorDlg2 componentDialog; Guid guidEmpty = Guid.Empty; VSCOMPONENTSELECTORTABINIT[] tabInit = new VSCOMPONENTSELECTORTABINIT[1]; string strBrowseLocations = Path.GetDirectoryName(BaseURI.Uri.LocalPath); //Add the Project page tabInit[0].dwSize = (uint)Marshal.SizeOf(typeof(VSCOMPONENTSELECTORTABINIT)); // Tell the Add Reference dialog to call hierarchies GetProperty with the following // propID to enable filtering out ourself from the Project to Project reference tabInit[0].varTabInitInfo = (int)__VSHPROPID.VSHPROPID_ShowProjInSolutionPage; tabInit[0].guidTab = VSConstants.GUID_SolutionPage; uint pX = 0, pY = 0; componentDialog = GetService(typeof(SVsComponentSelectorDlg)) as IVsComponentSelectorDlg2; try { // call the container to open the add reference dialog. if (componentDialog != null) { // Let the project know not to show itself in the Add Project Reference Dialog page ShowProjectInSolutionPage = false; // call the container to open the add reference dialog. ErrorHandler.ThrowOnFailure(componentDialog.ComponentSelectorDlg2( (System.UInt32)(__VSCOMPSELFLAGS.VSCOMSEL_MultiSelectMode | __VSCOMPSELFLAGS.VSCOMSEL_IgnoreMachineName), (IVsComponentUser)this, 0, null, DynamicProjectSR.GetString(Microsoft.VisualStudio.Project.SR.AddReferenceDialogTitle), // Title "VS.AddReference", // Help topic ref pX, ref pY, (uint)tabInit.Length, tabInit, ref guidEmpty, "*.dll", ref strBrowseLocations)); } } catch (COMException e) { Trace.WriteLine("Exception : " + e.Message); return(e.ErrorCode); } finally { // Let the project know it can show itself in the Add Project Reference Dialog page ShowProjectInSolutionPage = true; } return(VSConstants.S_OK); }
/// <summary> /// Executes Add Search Path menu command. /// </summary> internal int AddSearchPath() { // Get a reference to the UIShell. IVsUIShell uiShell = GetService(typeof(SVsUIShell)) as IVsUIShell; if (null == uiShell) { return(VSConstants.S_FALSE); } //Create a fill in a structure that defines Browse for folder dialog VSBROWSEINFOW[] browseInfo = new VSBROWSEINFOW[1]; //Dialog title browseInfo[0].pwzDlgTitle = DynamicProjectSR.GetString(DynamicProjectSR.SelectFolderForSearchPath); //Initial directory - project directory browseInfo[0].pwzInitialDir = _projectDir; //Parent window uiShell.GetDialogOwnerHwnd(out browseInfo[0].hwndOwner); //Max path length browseInfo[0].nMaxDirName = NativeMethods.MAX_PATH; //This struct size browseInfo[0].lStructSize = (uint)Marshal.SizeOf(typeof(VSBROWSEINFOW)); //Memory to write selected directory to. //Note: this one allocates unmanaged memory, which must be freed later IntPtr pDirName = Marshal.AllocCoTaskMem(NativeMethods.MAX_PATH); browseInfo[0].pwzDirName = pDirName; try { //Show the dialog int hr = uiShell.GetDirectoryViaBrowseDlg(browseInfo); if (hr == VSConstants.OLE_E_PROMPTSAVECANCELLED) { //User cancelled the dialog return(VSConstants.S_OK); } //Check for any failures ErrorHandler.ThrowOnFailure(hr); //Get selected directory string dirName = Marshal.PtrToStringAuto(browseInfo[0].pwzDirName); AddSearchPathEntry(dirName); } finally { //Free allocated unmanaged memory if (pDirName != IntPtr.Zero) { Marshal.FreeCoTaskMem(pDirName); } } return(VSConstants.S_OK); }
public static string GetString(string name, params object[] args) { DynamicProjectSR sys = GetLoader(); if (sys == null) { return(null); } string res = sys._resources.GetString(name, DynamicProjectSR.Culture); if (args != null && args.Length > 0) { return(String.Format(CultureInfo.CurrentCulture, res, args)); } else { return(res); } }
protected override string GetLocalizedString(string value) { return(DynamicProjectSR.GetString(value)); }
private static DynamicProjectSR GetLoader() { if (_loader == null) { lock (InternalSyncObject) { if (_loader == null) { _loader = new DynamicProjectSR(); } } } return _loader; }
public CommonGeneralPropertyPage() { this.Name = DynamicProjectSR.GetString(DynamicProjectSR.GeneralCaption); }