Squirrel.Update.AnimatedGifWindow.ShowWindow C# (CSharp) Method

ShowWindow() public static method

public static ShowWindow ( System.TimeSpan initialDelay, CancellationToken token, Squirrel.Update.ProgressSource progressSource ) : void
initialDelay System.TimeSpan
token System.Threading.CancellationToken
progressSource Squirrel.Update.ProgressSource
return void
        public static void ShowWindow(TimeSpan initialDelay, CancellationToken token, ProgressSource progressSource)
        {
        }
    }

Usage Example

Beispiel #1
0
        int executeCommandLine(string[] args)
        {
            var animatedGifWindowToken = new CancellationTokenSource();

            using (Disposable.Create(() => animatedGifWindowToken.Cancel())) {
                this.Log().Info("Starting Squirrel Updater: " + String.Join(" ", args));

                if (args.Any(x => x.StartsWith("/squirrel", StringComparison.OrdinalIgnoreCase)))
                {
                    // NB: We're marked as Squirrel-aware, but we don't want to do
                    // anything in response to these events
                    return(0);
                }

                bool silentInstall = false;
                var  updateAction  = default(UpdateAction);

                string target            = default(string);
                string releaseDir        = default(string);
                string packagesDir       = default(string);
                string bootstrapperExe   = default(string);
                string backgroundGif     = default(string);
                string signingParameters = default(string);
                string baseUrl           = default(string);
                string processStart      = default(string);
                string processStartArgs  = default(string);
                string setupIcon         = default(string);
                string icon         = default(string);
                string shortcutArgs = default(string);
                bool   shouldWait   = false;
                bool   noMsi        = (Environment.OSVersion.Platform != PlatformID.Win32NT); // NB: WiX doesn't work under Mono / Wine

                opts = new OptionSet()
                {
                    "Usage: Squirrel.exe command [OPTS]",
                    "Manages Squirrel packages",
                    "",
                    "Commands",
                    { "install=", "Install the app whose package is in the specified directory", v => { updateAction = UpdateAction.Install; target = v; } },
                    { "uninstall", "Uninstall the app the same dir as Update.exe", v => updateAction = UpdateAction.Uninstall },
                    { "download=", "Download the releases specified by the URL and write new results to stdout as JSON", v => { updateAction = UpdateAction.Download; target = v; } },
                    { "checkForUpdate=", "Check for one available update and writes new results to stdout as JSON", v => { updateAction = UpdateAction.CheckForUpdate; target = v; } },
                    { "update=", "Update the application to the latest remote version specified by URL", v => { updateAction = UpdateAction.Update; target = v; } },
                    { "releasify=", "Update or generate a releases directory with a given NuGet package", v => { updateAction = UpdateAction.Releasify; target = v; } },
                    { "createShortcut=", "Create a shortcut for the given executable name", v => { updateAction = UpdateAction.Shortcut; target = v; } },
                    { "removeShortcut=", "Remove a shortcut for the given executable name", v => { updateAction = UpdateAction.Deshortcut; target = v; } },
                    { "updateSelf=", "Copy the currently executing Update.exe into the default location", v => { updateAction = UpdateAction.UpdateSelf; target = v; } },
                    { "processStart=", "Start an executable in the latest version of the app package", v => { updateAction = UpdateAction.ProcessStart; processStart = v; }, true },
                    { "processStartAndWait=", "Start an executable in the latest version of the app package", v => { updateAction = UpdateAction.ProcessStart; processStart = v; shouldWait = true; }, true },
                    "",
                    "Options:",
                    { "h|?|help", "Display Help and exit", _ => {} },
                    { "r=|releaseDir=", "Path to a release directory to use with releasify", v => releaseDir = v },
                    { "p=|packagesDir=", "Path to the NuGet Packages directory for C# apps", v => packagesDir = v },
                    { "bootstrapperExe=", "Path to the Setup.exe to use as a template", v => bootstrapperExe = v },
                    { "g=|loadingGif=", "Path to an animated GIF to be displayed during installation", v => backgroundGif = v },
                    { "i=|icon", "Path to an ICO file that will be used for icon shortcuts", v => icon = v },
                    { "setupIcon=", "Path to an ICO file that will be used for the Setup executable's icon", v => setupIcon = v },
                    { "n=|signWithParams=", "Sign the installer via SignTool.exe with the parameters given", v => signingParameters = v },
                    { "s|silent", "Silent install", _ => silentInstall = true },
                    { "b=|baseUrl=", "Provides a base URL to prefix the RELEASES file packages with", v => baseUrl = v, true },
                    { "a=|process-start-args=", "Arguments that will be used when starting executable", v => processStartArgs = v, true },
                    { "l=|shortcut-locations=", "Comma-separated string of shortcut locations, e.g. 'Desktop,StartMenu'", v => shortcutArgs = v },
                    { "no-msi", "Don't generate an MSI package", v => noMsi = true },
                };

                opts.Parse(args);

                // NB: setupIcon and icon are just aliases for compatibility
                // reasons, because of a dumb breaking rename I made in 1.0.1
                setupIcon = setupIcon ?? icon;

                if (updateAction == UpdateAction.Unset)
                {
                    ShowHelp();
                    return(-1);
                }

                switch (updateAction)
                {
#if !MONO
                case UpdateAction.Install:
                    var progressSource = new ProgressSource();
                    if (!silentInstall)
                    {
                        AnimatedGifWindow.ShowWindow(TimeSpan.FromSeconds(4), animatedGifWindowToken.Token, progressSource);
                    }

                    Install(silentInstall, progressSource, Path.GetFullPath(target)).Wait();
                    animatedGifWindowToken.Cancel();
                    break;

                case UpdateAction.Uninstall:
                    Uninstall().Wait();
                    break;

                case UpdateAction.Download:
                    Console.WriteLine(Download(target).Result);
                    break;

                case UpdateAction.Update:
                    Update(target).Wait();
                    break;

                case UpdateAction.CheckForUpdate:
                    Console.WriteLine(CheckForUpdate(target).Result);
                    break;

                case UpdateAction.UpdateSelf:
                    UpdateSelf().Wait();
                    break;

                case UpdateAction.Shortcut:
                    Shortcut(target, shortcutArgs, processStartArgs, setupIcon);
                    break;

                case UpdateAction.Deshortcut:
                    Deshortcut(target, shortcutArgs);
                    break;

                case UpdateAction.ProcessStart:
                    ProcessStart(processStart, processStartArgs, shouldWait);
                    break;
#endif
                case UpdateAction.Releasify:
                    Releasify(target, releaseDir, packagesDir, bootstrapperExe, backgroundGif, signingParameters, baseUrl, setupIcon, !noMsi);
                    break;
                }
            }

            return(0);
        }
All Usage Examples Of Squirrel.Update.AnimatedGifWindow::ShowWindow