Esempio n. 1
0
        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());
            }
        }
Esempio n. 3
0
        private string getConfigValueByKey(string key)
        {
            var props        = DTE.get_Properties(@"CodeStats", "General");
            var pathProperty = props.Item(key);

            return(pathProperty.Value as string);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        //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);
        }
Esempio n. 7
0
 EnvDTE.Properties EnvDTE._DTE.get_Properties(string Category, string Page)
 {
     return(dte.get_Properties(Category, Page));
 }
Esempio n. 8
0
        public static bool GetOptOutStatsSetting(this EnvDTE.DTE dte)
        {
            var props = dte?.get_Properties(CategoryName, PageName);

            return(props?.Item(OptOutPropertyName)?.Value is bool b && b);
        }
Esempio n. 9
0
        public static bool GetOptOutStatsSetting(this EnvDTE.DTE dte)
        {
            var props = dte.get_Properties(CategoryName, PageName);

            return((bool)props.Item(OptOutPropertyName).Value);
        }