public static bool launch(string parentFormTitle) { try { if (isGuiLoaded()) { PublicDI.log.error("There is already a GUI loaded and only one can be loaded"); return(false); } parentFormTitle = ClickOnceDeployment.getFormTitle_forClickOnce(parentFormTitle); //new O2DockPanel(); O2Thread.staThread(() => new O2DockPanel()); var maxTimeToWaitForGuiCreation = 20000; if (O2DockPanel.guiLoaded.WaitOne(maxTimeToWaitForGuiCreation)) { O2AscxGUI.o2GuiWithDockPanel.invokeOnThread(() => O2AscxGUI.o2GuiWithDockPanel.Text = parentFormTitle); return(true); } if (false == DebugMsg.IsDebuggerAttached()) { //PublicDI.log.reportCriticalErrorToO2Developers(null, null, "from O2AscxGUI: GUI was not available after 20 seconds"); PublicDI.log.error("from O2AscxGUI: GUI was not available after 20 seconds"); } return(false); } catch (Exception) { return(false); } }
public void checkForClickOnceUpdates() { try { if (ClickOnceDeployment.isClickOnceDeployment()) { var h2Script = "AutoUpdate - Using Reflection.h2"; showInfo("Checking for ClickOnce updates"); if (h2Script.local().fileExists()) { h2Script.executeFirstMethod(); /* var XRulesWithUpdateCheckScript = XRules_Config.PathTo_XRulesDatabase_fromO2.pathCombine(@"\O2 Utils\AutoUpdate - Using Reflection.h2"); * if (XRulesWithUpdateCheckScript.fileExists().isFalse()) * "[in checkForClickOnceUpdates]: could not find H2 script to execute: {0}".error(XRulesWithUpdateCheckScript); * else * { * XRulesWithUpdateCheckScript.executeH2Script(); * }*/ showInfo("Check for ClickOnce updates completed"); } else { "Could not check for ClickOnce updates because the H2Script did not exist: {0}".error(h2Script); } } } catch (Exception ex) { ex.log("in checkForClickOnceUpdates"); } }
public static void startControl(string scriptToExecute) { // load Execute_Scripts GUI var formTitle = "O2 XRules Database ({0})".format("O2_XRules_Database.exe".assembly().version()); "{0}".info(formTitle); var executeScripts = (ascx_Execute_Scripts)typeof(ascx_Execute_Scripts).showAsForm(formTitle, 240, 200); executeScripts.checkForMSI_andOnFirstRunAndUnzipDefaultScripts(); "LocalScriptsFolder: {0}".debug(PublicDI.config.LocalScriptsFolder); executeScripts.buildGui(); // see if there there is a script to execute //(first via normal process arguments if (scriptToExecute.valid() && scriptToExecute.fileExists()) { executeScripts.runScriptAndCloseGui(scriptToExecute); } else { //.. then via Clickonce invoke scriptToExecute = ClickOnceDeployment.getClickOnceScriptPath(); if (scriptToExecute.fileExists()) { executeScripts.runScriptAndCloseGui(scriptToExecute); } else // ... if there is no script to execute: check for SVN updates and Start the new GUI { if (ClickOnceDeployment.isClickOnceDeployment()) { executeScripts.checkForClickOnceUpdates(); executeScripts.syncO2ViaSvn(); } else { svnSyncComplete.Set(); } svnSyncComplete.WaitOne(); // load new gui var newGuiScript = NEW_GUI_SCRIPT.local(); if (newGuiScript.fileExists()) { executeScripts.welcomeMessage = "New O2 GUI detected, launching it now..."; executeScripts.status(executeScripts.welcomeMessage); { O2Thread.mtaThread(() => { loadNewGui(executeScripts); }); } } } } }
private O2GuiWithDockPanel getO2GuiWithDockPanel() { if (DI.o2GuiWithDockPanel == null) { DI.o2GuiWithDockPanel = new O2GuiWithDockPanel(); DI.o2GuiWithDockPanel.Text = ClickOnceDeployment.getFormTitle_forClickOnce(formName ?? DI.o2GuiWithDockPanel.Text); DI.o2GuiWithDockPanel.Width = (formWidth > 0) ? formWidth : DI.o2GuiWithDockPanel.Width; DI.o2GuiWithDockPanel.Height = (formHeight > 0) ? formHeight : DI.o2GuiWithDockPanel.Height; } return(DI.o2GuiWithDockPanel); }
static void Main(string[] args) { O2CmdApi.typesWithCommands.Add(typeof(Filters.OzasmtFilters)); O2CmdApi.typesWithCommands.Add(typeof(GuiHelpers)); O2CmdApi.typesWithCommands.Add(typeof(Filters.OzasmtLinqUtils)); O2CmdApi.typesWithCommands.Add(typeof(Filters.PublishToCore)); O2CmdApi.typesWithCommands.Add(typeof(Filters.RemoveDuplicateTypeIIs)); if (ClickOnceDeployment.isClickOnceDeployment()) { if (args.Length == 0) { args = new[] { "gui" } } } ; O2CmdExec.execArgs(args); }
public void checkForMSI_andOnFirstRunAndUnzipDefaultScripts() { if (ClickOnceDeployment.isClickOnceDeployment()) { return; } "in checkForMSI_andOnFirstRunAndUnzipDefaultScripts()".info(); //this will only happen on the MSI since the ZipppedScriptsFile is not included in the ClickOnce install var pathToLocalZippedFile = PublicDI.config.CurrentExecutableDirectory.pathCombine(PublicDI.config.ZipppedScriptsFile); var msiScriptsFolder = PublicDI.config.CurrentExecutableDirectory.pathCombine(PublicDI.config.ZipppedScriptsFile.remove(".zip")); if (pathToLocalZippedFile.fileExists()) { if (pathToLocalZippedFile.fileInfo().size() > 10) { "found pathToLocalZippedFile: {0}".info(pathToLocalZippedFile); if (msiScriptsFolder.dirExists()) { Files.renameFolder(msiScriptsFolder, "{0}_old_{1}".format(msiScriptsFolder, 5.randomLetters())); } pathToLocalZippedFile.unzip_File(msiScriptsFolder); Files.deleteFile(pathToLocalZippedFile); } } if (pathToLocalZippedFile.fileExists().isFalse()) { "Creating empty zipped file: {0}".info(pathToLocalZippedFile); "AAA".saveAs(pathToLocalZippedFile); // so that the MSI auto repair function is not triggered } //else // "Did not find pathToLocalZippedFile: {0}".info(pathToLocalZippedFile); if (msiScriptsFolder.dirExists()) { "msiScriptsFolder existed: {0}".info(msiScriptsFolder); PublicDI.config.setLocalScriptsFolder(msiScriptsFolder); //msiExecution = true; } else { "msiScriptsFolder did not exist: {0}".info(msiScriptsFolder); } }
public void ClickOnce_Can_DeployApplication() { // cleanup if (File.Exists(@"C:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\bin\Debug\TestApp.application")) { System.IO.File.Delete(@"C:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\bin\Debug\TestApp.application"); } if (File.Exists(@"C:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\bin\Debug\TestApp.exe.manifest")) { System.IO.File.Delete(@"C:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\bin\Debug\TestApp.exe.manifest"); } if (Directory.Exists(@"C:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\bin\Debug\app.publish")) { Directory.Delete(@"C:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\bin\Debug\app.publish", true); } var workflow = new ClickOnceDeployment(); workflow.OnlineOnly = false; workflow.ApplicationName = "TestApp"; workflow.BinLocation = @"C:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\bin\Debug"; workflow.Version = "1.0.0.1"; workflow.MageFilePath = @"C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\Mage.exe"; workflow.CertFilePath = @"c:\tfs\test2\CustomBuildSource\CustomBuildArtifacts\TestApp\TestApp_TemporaryKey.pfx"; workflow.CertPassword = "******"; workflow.ManifestCertificateThumbprint = "9C6B1A418C9DF9E42F31AE811B659F4773FF6AA3"; workflow.PublishLocation = @"\\dlvrn2010md\builddropfolder\testc1"; workflow.InstallLocation = "http://localhost:8055/Testclickonce2"; workflow.Publisher = "CompanyA"; workflow.TargetFrameworkVersion = "4.0"; // Create the workflow run-time environment var workflowInvoker = new WorkflowInvoker(workflow); var invokeResponse = workflowInvoker.Invoke(); }