Wix:在安装和卸载时打开不同的URL

时间:2017-02-09 12:24:55

标签: wix

我尝试根据安装和卸载应用时打开不同的网址。目前,此安装程序在卸载时会打开两个URL,但在安装时不会打开任何内容。

<Property Id="InstallURL">$(var.HomepageURL)install?ver=$(var.VersionNumber)</Property>
<Property Id="UninstallURL">$(var.HomepageURL)uninstall?ver=$(var.VersionNumber)</Property>

<CustomAction Id="SetOpenInstallURL" Property="WixShellExecTarget" Value="[InstallURL]" />
<CustomAction Id="SetOpenUninstallURL" Property="WixShellExecTarget" Value="[UninstallURL]" />

<CustomAction Id="OpenInstallURL" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore" />
<CustomAction Id="OpenUninstallURL" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" Return="ignore" />

<InstallExecuteSequence>
    <!-- Launch webpage during install -->
    <Custom Action='SetOpenInstallURL' After='InstallFinalize'><![CDATA[Installed]]></Custom>
    <Custom Action="OpenInstallURL" After="SetOpenInstallURL"></Custom>
</InstallExecuteSequence>

<InstallExecuteSequence>
    <!-- Launch webpage during full uninstall, but not upgrade -->
    <Custom Action="SetOpenUninstallURL" After="InstallFinalize"><![CDATA[REMOVE ~= "ALL" AND NOT UPGRADINGPRODUCTCODE]]></Custom>
    <Custom Action="OpenUninstallURL" After="SetOpenUninstallURL"></Custom>
</InstallExecuteSequence>

1 个答案:

答案 0 :(得分:0)

https://gist.github.com/raspi/7072ecdb43d929901e3d228893cfa124

检查msi日志后的另一次尝试
public class MyScrollViewRenderer : ScrollViewRenderer
{
    CGPoint offset;

    protected override void OnElementChanged(VisualElementChangedEventArgs e)
    {
        base.OnElementChanged(e);

        UIScrollView sv = NativeView as UIScrollView;
        sv.Scrolled += (sender, evt) => {
            // Checking if sv.ContentOffset is not 0,0
            // because the ScrollView resets the ContentOffset to 0,0 when rotation starts
            // even if the ScrollView had been scrolled (I believe this is likely the cause for the bug).
            // so you only want to set offset variable if the ScrollView is scrolled away from 0,0
            // and I do not want to reset offset to 0,0 when the rotation starts, as it would overwrite my saved offset.
            if (sv.ContentOffset.X != 0 || sv.ContentOffset.Y != 0)
                offset = sv.ContentOffset;

        };
        // Subscribe to the oreintation changed event.
        NSNotificationCenter.DefaultCenter.AddObserver(this, new Selector("handleRotation"), new NSString("UIDeviceOrientationDidChangeNotification"), null );
    }

    [Export("handleRotation")]
    void HandleRotation()
    {
        if (offset.X != 0 || offset.Y != 0) {
            UIScrollView sv = NativeView as UIScrollView;
            // Reset the ScrollView offset from the last saved offset.
            sv.ContentOffset = offset;
        }
    }
}