public static API_VisualStudio_2010 close_Solution(this  API_VisualStudio_2010 vStudio, bool savePreviousSolution)
 {
     vStudio.VS_MainWindow.menu("File").mouse().click()
     .menu("Close Solution").mouse().click();
     vStudio.saveChanges(savePreviousSolution);
     return(vStudio);
 }
        public static API_VisualStudio_2010 open_WebSite(this  API_VisualStudio_2010 vStudio, string folder, bool savePreviousSolution)
        {
            try
            {
                //Menu item
                vStudio.VS_MainWindow.menu("File").click()                //.mouse().click()
                .menu("Open").click()
                .menu("Web Site...").mouse().click();
                var openWebSiteWindow = vStudio.VS_Process.window("Open Web Site");
                //Popup box to chose website to open
                if (openWebSiteWindow.notNull())
                {
                    openWebSiteWindow.textBox("Folder:").set_Text(folder);
                    openWebSiteWindow.label("Folder:").click();
                    openWebSiteWindow.button("Open").mouse().click();

                    vStudio.saveChanges();
                    vStudio.skipTargetOlderVersionRequest();
                }
            }
            catch (Exception ex)
            {
                ex.log("in API_VisualStudio_2010 openWebSite");
            }
            return(vStudio);
        }
        public static API_VisualStudio_2010 save_SolutionAs(this  API_VisualStudio_2010 vStudio, string saveSolutionTo)
        {
            try
            {
                //select 1st node from Solutions so the  menu's are updated
                var solutionExplorer = vStudio.VS_MainWindow.treeView("Solution Explorer");
                if (solutionExplorer.notNull())
                {
                    var treeNodes = solutionExplorer.treeNodes();
                    treeNodes[0].mouse().click();


                    // click on Save solution or SaveAs
                    if (saveSolutionTo.isNull())
                    {
                        vStudio.VS_MainWindow.menu("File").mouse().click()
                        .menus()[8].mouse().click();
                    }
                    else
                    {
                        vStudio.VS_MainWindow.menu("File").mouse().click()
                        .menus()[9].mouse().click();
                    }

                    vStudio.saveChanges(true);
                    vStudio.saveFileAs(saveSolutionTo);
                }
            }
            catch (Exception ex)
            {
                ex.log("in API_VisualStudio_2010 openWebSite");
            }
            return(vStudio);
        }
        public static API_VisualStudio_2010 skipTargetOlderVersionRequest(this  API_VisualStudio_2010 vStudio)
        {
            var targetOlderVersion = vStudio.VS_Process.window("Web Site targeting older .Net Framework Found");

            if (targetOlderVersion.notNull())
            {
                targetOlderVersion.button("No").mouse().click();
            }
            return(vStudio);
        }
        public static API_VisualStudio_2010 show_PropertiesWindow(this API_VisualStudio_2010 vStudio)
        {
            var propertiesWindow = vStudio.VS_MainWindow.panel("Properties");

            if (propertiesWindow.isNull())
            {
                vStudio.VS_MainWindow.menu_Click("View", "Properties Window");
            }
            return(vStudio);
        }
        public static API_VisualStudio_2010 saveChanges(this  API_VisualStudio_2010 vStudio, bool saveChangesValue)
        {
            var confirmSave = vStudio.VS_Process.window("Microsoft Visual Studio");

            if (confirmSave.notNull() && confirmSave.label("\nSave changes to the following items?").notNull())
            {
                confirmSave.clickYes(saveChangesValue);
                vStudio.saveFileAs(saveChangesValue);
            }
            return(vStudio);
        }
Example #7
0
 public static Window window(this API_VisualStudio_2010 visualStudio, string name)
 {
     foreach (var window in visualStudio.windows())
     {
         if (window.Caption == name)
         {
             return(window);
         }
     }
     return(null);
 }
Example #8
0
 public static API_VisualStudio_2010 executeCommand(this API_VisualStudio_2010 visualStudio, string commandName, string parameter = "")
 {
     try
     {
         visualStudio.dte().ExecuteCommand(commandName, parameter);
     }
     catch (Exception ex)
     {
         ex.log("[API_VisualStudio_2010] executeCommand: ");
     }
     return(visualStudio);
 }
Example #9
0
 public static Window window_waitFor(this API_VisualStudio_2010 visualStudio, string name, int nTimes = 5)
 {
     for (int i = 0; i < nTimes; i++)
     {
         var window = visualStudio.window(name);
         if (window.notNull())
         {
             return(window);
         }
         "[window_waitFor] waiting for window with name: {0}".info(name);
     }
     return(null);
 }
        public static API_VisualStudio_2010 clickButton(this  API_VisualStudio_2010 vStudio, string windowName, string buttonName)
        {
            var window = vStudio.VS_Process.window(windowName);

            if (window.notNull())
            {
                var button = window.button(buttonName);
                if (button.notNull())
                {
                    button.mouse().click();
                }
            }
            return(vStudio);
        }
        public static string localWebsiteUrl(this API_VisualStudio_2010 vStudio)
        {
            vStudio.show_PropertiesWindow();
            var propertyGrid = vStudio.VS_MainWindow.panel("Properties").propertyGrid();

            if (propertyGrid.notNull())
            {
                var portNumber  = propertyGrid.properties().value("Port number");
                var virtualPath = propertyGrid.properties().value("Virtual path");
                if (portNumber.valid() && virtualPath.valid())
                {
                    return("http://127.0.0.1:{0}{1}".format(portNumber, virtualPath));
                }
            }
            return(null);
        }
        public static API_VisualStudio_2010 open_Solution(this  API_VisualStudio_2010 vStudio, string solutionPath)
        {
            vStudio.VS_MainWindow.menu("File").click()            //.mouse().click()
            .menu("Open").click()
            .menu("Project/Solution...").mouse().click();

            var openProject = vStudio.VS_Process.window("Open Project");

            if (openProject.notNull())
            {
                openProject.textBox("Object name:").set_Text(solutionPath);
                openProject.button("Open").mouse().click();

                vStudio.saveChanges();
                vStudio.skipTargetOlderVersionRequest();
            }
            return(vStudio);
        }
        public static API_VisualStudio_2010 saveFileAs(this  API_VisualStudio_2010 vStudio, string filePath, bool saveChangesValue)
        {
            var saveFileAs = vStudio.VS_Process.window("Save File As");

            if (saveFileAs.notNull())
            {
                if (saveChangesValue)
                {
                    if (filePath.valid())
                    {
                        saveFileAs.textBox("Object name:").set_Text(filePath);
                    }
                    saveFileAs.button("Save").mouse().click();
                    vStudio.clickButton("Microsoft Visual Studio", "Yes");
                }
                else
                {
                    saveFileAs.button("Cancel").mouse().click();
                }
            }
            return(vStudio);
        }
 public static API_VisualStudio_2010 save_Solution(this  API_VisualStudio_2010 vStudio)
 {
     return(vStudio.save_SolutionAs(null));
 }
Example #15
0
 public static Command command(this API_VisualStudio_2010 visualStudio, string name)
 {
     return(visualStudio.commands()
            .where ((command) => command.Name == name)
            .first());
 }
Example #16
0
 public static API_VisualStudio_2010 addInManager(this API_VisualStudio_2010 visualStudio)
 {
     return(visualStudio.executeCommand("Tools.AddinManager"));
 }
Example #17
0
 public static List <Window> windows(this API_VisualStudio_2010 visualStudio)
 {
     return((from Window window in visualStudio.dte().Windows
             select window).toList());
 }
Example #18
0
 public static Panel new_Panel(this API_VisualStudio_2010 visualStudio, string caption = "New Panel", int width = -1, int height = -1)
 {
     return(visualStudio.VsAddIn.add_WinForm_Panel(caption, width, height));
 }
Example #19
0
 public static DTE2 dte(this API_VisualStudio_2010 visualStudio)
 {
     return((DTE2)visualStudio.VsAddIn.VS_Dte);
 }
 public static API_VisualStudio_2010 close_Solution(this  API_VisualStudio_2010 vStudio)
 {
     return(vStudio.close_Solution(true));
 }
Example #21
0
 public static CommandBarPopup add_TopMenu(this API_VisualStudio_2010 visualStudio, string caption)
 {
     return(visualStudio.VsAddIn.add_TopMenu(caption));
 }
Example #22
0
 public static List <Command> commands(this API_VisualStudio_2010 visualStudio)
 {
     return((from Command command in visualStudio.dte().Commands
             select command).toList());
 }
 public static API_VisualStudio_2010 saveFileAs(this  API_VisualStudio_2010 vStudio, string filePath)
 {
     return(vStudio.saveFileAs(filePath, true));
 }
 public static API_VisualStudio_2010 close_VisualStudio(this API_VisualStudio_2010 vStudio)
 {
     vStudio.VS_MainWindow.menu_Click("File", "Exit");
     return(vStudio);
 }
 public static API_VisualStudio_2010 startDebugging(this API_VisualStudio_2010 vStudio)
 {
     vStudio.VS_MainWindow.menu_Click("Debug", "Start Debugging");
     vStudio.GUI.button_Click("Debugging Not Enabled", "OK");
     return(vStudio);
 }
 public static API_VisualStudio_2010 run(this API_VisualStudio_2010 vStudio)
 {
     return(vStudio.startDebugging());
 }
 public static API_VisualStudio_2010 saveChanges(this  API_VisualStudio_2010 vStudio)
 {
     return(vStudio.saveChanges(true));
 }
 public static API_VisualStudio_2010 saveFileAs(this  API_VisualStudio_2010 vStudio, bool saveChangesValue)
 {
     return(vStudio.saveFileAs(null, saveChangesValue));
 }