当前位置: 首页>>代码示例>>C#>>正文


C# VisualStudioApp.OpenSolutionExplorer方法代码示例

本文整理汇总了C#中VisualStudioApp.OpenSolutionExplorer方法的典型用法代码示例。如果您正苦于以下问题:C# VisualStudioApp.OpenSolutionExplorer方法的具体用法?C# VisualStudioApp.OpenSolutionExplorer怎么用?C# VisualStudioApp.OpenSolutionExplorer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VisualStudioApp的用法示例。


在下文中一共展示了VisualStudioApp.OpenSolutionExplorer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisualStudioInstance

        public VisualStudioInstance(SolutionFile solution) {
            _solution = solution;
            _app = new VisualStudioApp();
            Project = _app.OpenProject(solution.Filename);

            ThreadHelper.Generic.Invoke(Keyboard.Reset);
            _solutionExplorer = _app.OpenSolutionExplorer();
            SelectSolutionNode();
        }
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:9,代码来源:VisualStudioInstance.cs

示例2: MoveFolderWithItem

        // Currently Fails: https://pytools.codeplex.com/workitem/2609
        public void MoveFolderWithItem() {
            using (var app = new VisualStudioApp()) {

                // close any projects before switching source control...
                app.Dte.Solution.Close();

                app.SelectSourceControlProvider("Test Source Provider");

                ExpectSourceControl();

                foreach (var projectType in ProjectTypes) {
                    var testDef = new ProjectDefinition("SourceControl", projectType,
                        PropertyGroup(
                            Property("SccProjectName", "HelloWorld"),
                            Property("SccLocalPath", "LocalPath"),
                            Property("SccAuxPath", "AuxPath"),
                            Property("SccProvider", "TestProvider")
                        ),
                        ItemGroup(
                            Folder("Fob"),
                            Folder("Fob\\Oar"),
                            Compile("Program"),
                            Compile("Fob\\Oar\\Quox")
                        )
                    );

                    using (var solution = testDef.Generate()) {
                        TestSccProvider.DocumentEvents.Clear();

                        var project = app.OpenProject(solution.Filename);
                        var window = app.OpenSolutionExplorer();
                        
                        var folder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl", "Fob", "Oar");
                        var point = folder.GetClickablePoint();
                        Mouse.MoveTo(point);
                        Mouse.Down(MouseButton.Left);

                        var destFolder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl");
                        Mouse.MoveTo(destFolder.GetClickablePoint());
                        Mouse.Up(MouseButton.Left);

                        window.AssertFileExists(Path.GetDirectoryName(solution.Filename), "Solution 'SourceControl' (1 project)", "SourceControl", "Oar", "Quox" + projectType.CodeExtension);
                        var projectDir = Path.GetDirectoryName(project.FullName);
                        AssertDocumentEvents(projectDir,
                            OnQueryRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSQUERYRENAMEFILEFLAGS_NoFlags),
                            OnQueryRenameFiles("Fob\\Oar\\", "Oar", VSQUERYRENAMEFILEFLAGS_Directory),
                            OnAfterRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSRENAMEFILEFLAGS_NoFlags),
                            OnAfterRenameFiles("Fob\\Oar\\", "Oar", VSRENAMEFILEFLAGS_Directory)
                        );
                    }
                }
            }
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:54,代码来源:SourceControl.cs

示例3: CreateNewScript

		public void CreateNewScript() {
			using (var app = new VisualStudioApp()) {
				var project = app.CreateProject(
					RConstants.TemplateLanguageName, RConstants.ProjectTemplate_EmptyProject,
					System.IO.Path.GetTempPath(), "RTestProject");
				app.OpenSolutionExplorer().SelectProject(project);
				using (var newItem = NewItemDialog.FromDte(app)) {
					AutomationWrapper.Select(newItem.ProjectTypes.FindItem("R Script"));
					newItem.FileName = "my-script.r";
					newItem.OK();
				}

				var document = app.GetDocument("my-script.r");
				document.SetFocus();
				document.Type("2 -> a");
				document.Text.Should().Be("2 -> a# R Script");
			}
		}
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:18,代码来源:UITests.cs

示例4: CreateProject

        internal static void CreateProject(VisualStudioApp app, string languageName, string templateName, string location, string projectName, string expectedProjectItem) {
            using (var newProjDialog = app.FileNewProject()) {
                newProjDialog.FocusLanguageNode(languageName);
                newProjDialog.Location = location;
                newProjDialog.ProjectName = projectName;

                var djangoApp = newProjDialog.ProjectTypes.FindItem(templateName);
                djangoApp.Select();
                newProjDialog.OK();
            }

            // wait for new solution to load...
            for (int i = 0; i < 40 && app.Dte.Solution.Projects.Count == 0; i++) {
                System.Threading.Thread.Sleep(250);
            }

            app.OpenSolutionExplorer().WaitForItem(
                "Solution '" + app.Dte.Solution.Projects.Item(1).Name + "' (1 project)",
                app.Dte.Solution.Projects.Item(1).Name,
                expectedProjectItem
            );
        }
开发者ID:lioaphy,项目名称:nodejstools,代码行数:22,代码来源:AzureWebSiteTests.cs

示例5: TestPublishFtp

        public void TestPublishFtp() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\HelloWorld.sln");
                string subDir = Guid.NewGuid().ToString();
                string url = TestFtpUrl + "/" + subDir;
                project.Properties.Item("PublishUrl").Value = url;
                app.OnDispose(() => project.Properties.Item("PublishUrl").Value = "");
                string dir = Path.Combine(FtpValidateDir, subDir);
                Debug.WriteLine(dir);

                app.OpenSolutionExplorer().SelectProject(project);

                app.ExecuteCommand("Build.PublishSelection");
                System.Threading.Thread.Sleep(2000);
                var files = WaitForFiles(dir);
                Assert.AreEqual(1, files.Length);
                Assert.AreEqual("Program.py", Path.GetFileName(files[0]));

                // do it again w/ the directories already existing
                File.Delete(files[0]);

                app.OpenSolutionExplorer().SelectProject(project);
                app.ExecuteCommand("Build.PublishSelection");
                files = WaitForFiles(dir);
                Assert.AreEqual(1, files.Length);
                Assert.AreEqual("Program.py", Path.GetFileName(files[0]));

                Directory.Delete(dir, true);
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:30,代码来源:PublishTest.cs

示例6: TestPublishFilesImpersonateNoMachineName

        public void TestPublishFilesImpersonateNoMachineName() {
            WNetCancelConnection2(TestSharePrivate, 0, true);
            using (var app = new VisualStudioApp()) {
                try {
                    var project = app.OpenProject(@"TestData\HelloWorld.sln");
                    string subDir = Guid.NewGuid().ToString();
                    project.Properties.Item("PublishUrl").Value = Path.Combine(TestSharePrivate, subDir);
                    app.OnDispose(() => project.Properties.Item("PublishUrl").Value = "");

                    app.OpenSolutionExplorer().SelectProject(project);

                    using (var creds = CredentialsDialog.PublishSelection(app)) {
                        creds.UserName = PrivateShareUserWithoutMachine;
                        creds.Password = PrivateSharePassword;
                        creds.OK();
                    }

                    System.Threading.Thread.Sleep(2000);

                    using (var helper = new NetUseHelper()) {
                        string dir = Path.Combine(helper.Drive + "\\", subDir);
                        var files = WaitForFiles(dir);
                        Assert.AreEqual(1, files.Length);
                        Assert.AreEqual("Program.py", Path.GetFileName(files[0]));

                        Directory.Delete(dir, true);
                    }
                } finally {
                    WNetCancelConnection2(TestSharePrivate, 0, true);
                }
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:32,代码来源:PublishTest.cs

示例7: TestPublishReadOnlyFiles

        public void TestPublishReadOnlyFiles() {
            var sourceFile = TestData.GetPath(@"TestData\HelloWorld\Program.py");
            Assert.IsTrue(File.Exists(sourceFile), sourceFile + " not found");
            var attributes = File.GetAttributes(sourceFile);

            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\HelloWorld.sln");
                try {
                    string subDir = Guid.NewGuid().ToString();
                    project.Properties.Item("PublishUrl").Value = Path.Combine(TestSharePublic, subDir);
                    app.OnDispose(() => project.Properties.Item("PublishUrl").Value = "");
                    string dir = Path.Combine(TestSharePublic, subDir);

                    File.SetAttributes(sourceFile, attributes | FileAttributes.ReadOnly);

                    app.OpenSolutionExplorer().SelectProject(project);

                    var files = PublishAndWaitForFiles(app, "Build.PublishSelection", dir);
                    
                    Assert.IsNotNull(files, "Timed out waiting for files to publish");
                    Assert.AreEqual(1, files.Length);
                    Assert.AreEqual("Program.py", Path.GetFileName(files[0]));
                    Assert.IsTrue(File.GetAttributes(sourceFile).HasFlag(FileAttributes.ReadOnly), "Source file should be read-only");
                    Assert.IsFalse(File.GetAttributes(files[0]).HasFlag(FileAttributes.ReadOnly), "Published file should not be read-only");

                    Directory.Delete(dir, true);
                } finally {
                    WNetCancelConnection2(TestSharePublic, 0, true);
                    File.SetAttributes(sourceFile, attributes);
                }
            }
        }
开发者ID:wenh123,项目名称:PTVS,代码行数:32,代码来源:PublishTest.cs

示例8: TransferItem

        public void TransferItem() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\HelloWorld.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    string filename, basename;
                    int i = 0;
                    do {
                        i++;
                        basename = "test" + i + " .js";
                        filename = Path.Combine(Path.GetTempPath(), basename);
                    } while (System.IO.File.Exists(filename));

                    System.IO.File.WriteAllText(filename, "function f() { }");

                    var fileWindow = app.Dte.ItemOperations.OpenFile(filename);

                    using (var dlg = ChooseLocationDialog.FromDte(app)) {
                        dlg.SelectProject("HelloWorld");
                        dlg.OK();
                    }

                    var window = app.OpenSolutionExplorer();
                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", basename));

                    Assert.AreEqual(fileWindow.Caption, basename);

                    System.IO.File.Delete(filename);
                }
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:31,代码来源:UITests.cs

示例9: AbsolutePaths

        public void AbsolutePaths() {
            var proj = File.ReadAllText(TestData.GetPath(@"TestData\NodejsProjectData\AbsolutePath\AbsolutePath.njsproj"));
            proj = proj.Replace("[ABSPATH]", TestData.GetPath(@"TestData\NodejsProjectData\AbsolutePath"));
            File.WriteAllText(TestData.GetPath(@"TestData\NodejsProjectData\AbsolutePath\AbsolutePath.njsproj"), proj);


            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\AbsolutePath.sln");

                var window = app.OpenSolutionExplorer();

                // find server.js, send copy & paste, verify copy of file is there
                var programPy = window.WaitForItem("Solution 'AbsolutePath' (1 project)", "AbsolutePath", "server.js");
                Assert.AreNotEqual(null, programPy);
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:16,代码来源:UITests.cs

示例10: CopyFolderOnToSelf

        public void CopyFolderOnToSelf() {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\NodejsProjectData\HelloWorld2.sln", expectedProjects: 2);
                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    var folder = window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder");
                    AutomationWrapper.Select(folder);

                    Keyboard.ControlC();
                    AutomationWrapper.Select(folder);
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder - Copy"));
                }
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:17,代码来源:UITests.cs

示例11: AddNewFolder

        public void AddNewFolder() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\HelloWorld.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var projectNode = window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld");
                    AutomationWrapper.Select(projectNode);

                    var startingDirs = new HashSet<string>(Directory.GetDirectories(@"TestData\NodejsProjectData\HelloWorld"), StringComparer.OrdinalIgnoreCase);
                    Keyboard.PressAndRelease(Key.F10, Key.LeftCtrl, Key.LeftShift);
                    Keyboard.PressAndRelease(Key.D);
                    Keyboard.PressAndRelease(Key.Right);
                    Keyboard.PressAndRelease(Key.D);
                    Keyboard.Type("MyNewFolder");
                    var curDirs = new HashSet<string>(Directory.GetDirectories(@"TestData\NodejsProjectData\HelloWorld"), StringComparer.OrdinalIgnoreCase);
                    Assert.IsTrue(curDirs.IsSubsetOf(startingDirs) && startingDirs.IsSubsetOf(curDirs), "new directory created" + String.Join(", ", curDirs) + " vs. " + String.Join(", ", startingDirs));

                    Keyboard.PressAndRelease(Key.Enter);

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "MyNewFolder"));

                    Assert.IsTrue(Directory.Exists(@"TestData\NodejsProjectData\HelloWorld\MyNewFolder"));
                }
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:28,代码来源:UITests.cs

示例12: DeleteFile

        public void DeleteFile() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\DeleteFile.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var programPy = window.WaitForItem("Solution 'DeleteFile' (1 project)", "HelloWorld", "server.js");
                    Assert.IsTrue(File.Exists(@"TestData\NodejsProjectData\DeleteFile\server.js"));
                    AutomationWrapper.Select(programPy);

                    Keyboard.Type(Key.Delete);
                    app.WaitForDialog();
                    VisualStudioApp.CheckMessageBox(MessageBoxButton.Ok, "will be deleted permanently");
                    app.WaitForDialogDismissed();

                    window.WaitForItemRemoved("Solution 'DeleteFile' (1 project)", "HelloWorld", "server.js");

                    Assert.IsFalse(File.Exists(@"TestData\NodejsProjectData\DeleteFile\server.js"));
                }
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:23,代码来源:UITests.cs

示例13: CopyPasteRenameFile

        public void CopyPasteRenameFile() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\CopyPasteRenameProject\CopyPasteRenameProject.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    var jsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "app.js");

                    AutomationWrapper.Select(jsFile);

                    Keyboard.ControlC();
                    Keyboard.ControlV();
                    var copiedJsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "app - Copy.js");
                    Assert.AreNotEqual(null, copiedJsFile);

                    AutomationWrapper.Select(copiedJsFile);

                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

                    Keyboard.Type("renamed");
                    Keyboard.PressAndRelease(Key.Enter);

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "renamed.js"));


                    var tsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "app.ts");

                    AutomationWrapper.Select(tsFile);

                    Keyboard.ControlC();
                    Keyboard.ControlV();
                    var copiedTsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "app - Copy.ts");
                    Assert.AreNotEqual(null, copiedTsFile);

                    AutomationWrapper.Select(copiedTsFile);

                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

                    Keyboard.Type("renamed");
                    Keyboard.PressAndRelease(Key.Enter);

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "renamed.ts"));
                }
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:48,代码来源:UITests.cs

示例14: CopyPasteFile

        public void CopyPasteFile() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\HelloWorld.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var programPy = window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server.js");

                    AutomationWrapper.Select(programPy);

                    Keyboard.ControlC();
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server - Copy.js"));

                    AutomationWrapper.Select(programPy);
                    Keyboard.ControlC();
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server - Copy (2).js"));
                }
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:25,代码来源:UITests.cs

示例15: MoveStartupFile

        public void MoveStartupFile() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\MoveStartupFile.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var server = window.WaitForItem("Solution 'MoveStartupFile' (1 project)", "HelloWorld", "server.js");
                    var folder = window.WaitForItem("Solution 'MoveStartupFile' (1 project)", "HelloWorld", "TestDir");

                    AutomationWrapper.Select(server);
                    Keyboard.ControlX();

                    AutomationWrapper.Select(folder);
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'MoveStartupFile' (1 project)", "HelloWorld", "TestDir", "server.js"));

                    Assert.IsTrue(((string)project.Properties.Item("StartupFile").Value).EndsWith("TestDir\\server.js"));
                }
            }
        }
开发者ID:paladique,项目名称:nodejstools,代码行数:23,代码来源:UITests.cs


注:本文中的VisualStudioApp.OpenSolutionExplorer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。