public void btnSetRPath_Click(object sender, EventArgs e) { frmInstallR frmR = new frmInstallR(); frmR.ShowDialog(this); if (frmR.getRPathResult == HydroR.frmInstallR.buttonType.OK) { pathToR = frmR.getPathToR; } }
//Put R into a panel in hydroDesktop so that it is built in private bool SetupRPanel() { bool foundPath = false; while (!foundPath) { //test to see if the process starts with the current path try { // MessageBox.Show(pathToR); if (pathToR == "") { p = Process.Start("Rgui", "--sdi"); } else { p = Process.Start(@pathToR + @"\Rgui.exe", "--sdi");//--no-save"); } p.WaitForInputIdle(); pID = p.Id; setRParent(); RIsRunning = true; return(true); } catch (Exception e) { //if R does not start with the current path, open an openfiledialog and have the //user find the path to the R executables if (e.Message.Contains("cannot find the file specified")) { frmInstallR frmR = new frmInstallR(); frmR.ShowDialog(this); if (frmR.getRPathResult == HydroR.frmInstallR.buttonType.OK) { pathToR = frmR.getPathToR; } else { //resize to original panel size spcEditor.Panel2Collapsed = true; spcEditor.SplitterDistance = (spcEditor.Height - 20); //stop ciculating to make sure the path is correct foundPath = true; //stop the rest of the code from trying to start R; RIsRunning = false; return(false); } } } } return(false); }
//this will launch the R settings public void btnSettings_Click(object sender, EventArgs e) { frmInstallR frmR = new frmInstallR(true); frmR.getPathToR = pathToR; frmR.ShowDialog(this); if (frmR.getRPathResult == HydroR.frmInstallR.buttonType.OK) { string newPathToR = frmR.getPathToR; if (newPathToR != pathToR) { pathToR = newPathToR; //startR(); } } }