public void ValidateNewFileOpenedWithEditor() { UIThreadInvoker.Invoke((ThreadInvoker) delegate() { TestUtils testUtils = new TestUtils(); testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave); testUtils.CreateEmptySolution(TestContext.TestDir, "CreateEmptySolution"); //Add new file to the solution and save all string name = "mynewfile"; EnvDTE.DTE dte = VsIdeTestHostContext.Dte; EnvDTE.Window win = dte.ItemOperations.NewFile(@"Haskell editor Files\Haskell editor", name, EnvDTE.Constants.vsViewKindPrimary); Assert.IsNotNull(win); dte.ExecuteCommand("File.SaveAll", string.Empty); //get the currect misc files state object OriginalValueMiscFilesSavesLastNItems = dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value; if ((int)OriginalValueMiscFilesSavesLastNItems == 0) { dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value = 5; } //get a handle to the project item in the solution explorer EnvDTE.ProjectItem item = win.Document.ProjectItem; Assert.IsNotNull(item); //close window win.Close(EnvDTE.vsSaveChanges.vsSaveChangesNo); //reset the miscfiles property if it was modified if (OriginalValueMiscFilesSavesLastNItems != dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value) { dte.get_Properties("Environment", "Documents").Item("MiscFilesProjectSavesLastNItems").Value = OriginalValueMiscFilesSavesLastNItems; } }); }
/// <summary> /// This function is the callback used to handle the cmdidSetParamDescription command. /// </summary> private void OnSetParamDescription(object sender, EventArgs e) { OleMenuCmdEventArgs eventArgs = (OleMenuCmdEventArgs)e; string strCommandArg = eventArgs.InValue.ToString(); if (strCommandArg.Length > 0) { // Retrieve the command and set it's ParametersDescription property OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { CommandID testCommandId = new CommandID(GuidList.guidAllowParamsCmdSet, (int)PkgCmdIDList.cmdidTestCommand); OleMenuCommand testCommand = mcs.FindCommand(testCommandId) as OleMenuCommand; if (testCommand != null) { // Set the ParametersDescription testCommand.ParametersDescription = strCommandArg; // Update the AllowParams Options Dialog as well EnvDTE.DTE dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); dte.get_Properties("AllowParams Package", "Settings").Item("ParametersDescription").Value = strCommandArg; } } } else // invoke options dialog when command invoked with no parameters { EnvDTE.DTE dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); dte.ExecuteCommand("Tools.Options", typeof(OptionsPage).GUID.ToString()); } }
private string getConfigValueByKey(string key) { var props = DTE.get_Properties(@"CodeStats", "General"); var pathProperty = props.Item(key); return(pathProperty.Value as string); }
private int GetMSBuildVerbosityLevel() { var properties = _dte.get_Properties(DTEEnvironmentCategory, DTEProjectPage); var value = properties.Item(MSBuildVerbosityKey).Value; if (value is int) { return((int)value); } return(DefaultVerbosityLevel); }
private async Task <int> GetMSBuildVerbosityLevelAsync() { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var properties = _dte.get_Properties(DTEEnvironmentCategory, DTEProjectPage); var value = properties.Item(MSBuildVerbosityKey).Value; if (value is int) { return((int)value); } return(DefaultVerbosityLevel); }
//string[] GetScriptLines() //{ // string debuggerScript = env.DebugConfig.DebuggerScript; // if (String.IsNullOrEmpty(debuggerScript)) // return new string[0]; // return debuggerScript.Split(new[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); //} private T GetDebuggingConfigProperty <T>(EnvDTE.DTE env, string key) { return((T)env.get_Properties("Visual Rust", "Debugging").Item(key).Value); }
EnvDTE.Properties EnvDTE._DTE.get_Properties(string Category, string Page) { return(dte.get_Properties(Category, Page)); }
public static bool GetOptOutStatsSetting(this EnvDTE.DTE dte) { var props = dte?.get_Properties(CategoryName, PageName); return(props?.Item(OptOutPropertyName)?.Value is bool b && b); }
public static bool GetOptOutStatsSetting(this EnvDTE.DTE dte) { var props = dte.get_Properties(CategoryName, PageName); return((bool)props.Item(OptOutPropertyName).Value); }