private static void loadNewGui(ascx_Execute_Scripts executeScripts) { try { /* var cached_O2Main_WPF_GUI = PublicDI.config.CurrentExecutableDirectory.pathCombine(NEW_GUI_SCRIPT + ".cached.h2"); * var cached_O2Main_WPF_GUI_Dll = PublicDI.config.CurrentExecutableDirectory.pathCombine(NEW_GUI_SCRIPT + ".cached.Dll"); * if (cached_O2Main_WPF_GUI.fileExists().isFalse() || * cached_O2Main_WPF_GUI.fileContents() != NEW_GUI_SCRIPT.local().fileContents()) * { * Files.deleteFile(cached_O2Main_WPF_GUI); * Files.deleteFile(cached_O2Main_WPF_GUI_Dll); * Files.Copy(NEW_GUI_SCRIPT.local(), cached_O2Main_WPF_GUI); * var assembly = cached_O2Main_WPF_GUI.compile_H2Script(); * var dllLocation = assembly.Location; * Files.Copy(dllLocation, cached_O2Main_WPF_GUI_Dll); * //we need to make this or the 2nd time around the dynamic compiled references will not be found * foreach (var referencedAssembly in assembly.GetReferencedAssemblies().toList()) * { * var localPath = "{0}\\{1}.dll".format("".o2Temp2Dir(), referencedAssembly.Name); * if (localPath.fileExists()) * // if (referencedAssembly.E.Location.starts()) * Files.Copy(localPath, PublicDI.config.CurrentExecutableDirectory); * } * } * if (cached_O2Main_WPF_GUI_Dll.fileExists()) * { * "Found local copy of precompiled {0} as {1}, so executing it".info(NEW_GUI_SCRIPT, cached_O2Main_WPF_GUI_Dll); * cached_O2Main_WPF_GUI_Dll.assembly().executeFirstMethod(); * } * else * { */ var newGui = NEW_GUI_SCRIPT.compile_H2Script(); if (newGui.notNull()) { newGui.executeFirstMethod(); } else { executeScripts.status("There was an error compiling the new GUI!"); } // } var currentWinForms = executeScripts.applicationWinForms(); if (currentWinForms.size() == 1) { // if ("The new GUI could not be launched, do you want download the latest version?".askUserQuestion()) // openBrowserWithDownloadLink(); } else { executeScripts.close(); } } catch (Exception ex) { ex.log("in ascx_ExecuteScripts.loadNewGui()"); } }
private static void loadNewGui(ascx_Execute_Scripts executeScripts) { try { /* var cached_O2Main_WPF_GUI = PublicDI.config.CurrentExecutableDirectory.pathCombine(NEW_GUI_SCRIPT + ".cached.h2"); var cached_O2Main_WPF_GUI_Dll = PublicDI.config.CurrentExecutableDirectory.pathCombine(NEW_GUI_SCRIPT + ".cached.Dll"); if (cached_O2Main_WPF_GUI.fileExists().isFalse() || cached_O2Main_WPF_GUI.fileContents() != NEW_GUI_SCRIPT.local().fileContents()) { Files.deleteFile(cached_O2Main_WPF_GUI); Files.deleteFile(cached_O2Main_WPF_GUI_Dll); Files.Copy(NEW_GUI_SCRIPT.local(), cached_O2Main_WPF_GUI); var assembly = cached_O2Main_WPF_GUI.compile_H2Script(); var dllLocation = assembly.Location; Files.Copy(dllLocation, cached_O2Main_WPF_GUI_Dll); //we need to make this or the 2nd time around the dynamic compiled references will not be found foreach (var referencedAssembly in assembly.GetReferencedAssemblies().toList()) { var localPath = "{0}\\{1}.dll".format("".o2Temp2Dir(), referencedAssembly.Name); if (localPath.fileExists()) // if (referencedAssembly.E.Location.starts()) Files.Copy(localPath, PublicDI.config.CurrentExecutableDirectory); } } if (cached_O2Main_WPF_GUI_Dll.fileExists()) { "Found local copy of precompiled {0} as {1}, so executing it".info(NEW_GUI_SCRIPT, cached_O2Main_WPF_GUI_Dll); cached_O2Main_WPF_GUI_Dll.assembly().executeFirstMethod(); } else { */ var newGui = NEW_GUI_SCRIPT.compile_H2Script(); if (newGui.notNull()) { newGui.executeFirstMethod(); } else executeScripts.status("There was an error compiling the new GUI!"); // } var currentWinForms = executeScripts.applicationWinForms(); if (currentWinForms.size() == 1) { // if ("The new GUI could not be launched, do you want download the latest version?".askUserQuestion()) // openBrowserWithDownloadLink(); } else executeScripts.close(); } catch (Exception ex) { ex.log("in ascx_ExecuteScripts.loadNewGui()"); } }