2011-08-11 89 views
3

我需要創建一個Wix安裝程序,這將允許我有一個對話框,用戶可以在其中輸入序列號,然後我需要保存它們輸入到Windows註冊表中的序列號。如何爲.NET項目創建自定義的Wix安裝程序?

另外,如果他們沒有輸入序列號,則需要禁用下一個按鈕,以便在他們不輸入序列號時不能繼續安裝。

回答

2

維克斯不支持像你想在未來的一個關鍵事件按鈕必須在用戶輸入密鑰時啓用。最佳選擇是提供下一個按鈕並調用自定義操作來檢查密鑰是否正確,如果出現錯誤提示錯誤信息。

<Dialog Id="UserRegistrationDlg" Width="370" Height="270" Title="[ProductName] [Setup]" NoMinimize="yes"> 
    <Control Id="OrganizationLabel" Type="Text" X="45" Y="80" Width="100" Height="15" TabSkip="no" Text="&amp;Organization:" /> 
    <Control Id="OrganizationEdit" Type="Edit" X="45" Y="95" Width="220" Height="18" Property="COMPANYNAME" Text="{80}" /> 
    <Control Id="CDKeyLabel" Type="Text" X="45" Y="125" Width="50" Height="10" TabSkip="no"> 
    <Text>License &amp;Key:</Text> 
    </Control> 
    <Control Id="CDKeyEdit" Type="MaskedEdit" X="45" Y="140" Width="250" Height="16" Property="PIDKEY" Text="[PIDTemplate]" /> 

    <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back"> 
    <Publish Event="NewDialog" Value="[WixUI_UserRegistrationDlg_Back]">1</Publish> 
    </Control> 

    <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next"> 
    <Publish Event="ValidateProductID" Value="0">0</Publish> 
    <Publish Event="DoAction" Value="CheckingPID">1</Publish> 
    <Publish Event="SpawnDialog" Value="InvalidPidDlg">PIDACCEPTED = "0"</Publish> 
    <Publish Event="NewDialog" Value="[WixUI_UserRegistrationDlg_Next]">PIDACCEPTED = "1"</Publish> 
    </Control> 

    <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel"> 
    <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish> 
    </Control> 
</Dialog> 

<Dialog Id="InvalidPidDlg" Width="260" Height="85" Title="[ProductName] [Setup]" NoMinimize="yes"> 
    <Control Id="Return" Type="PushButton" X="100" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="Ok"> 
    <Publish Event="EndDialog" Value="Return">1</Publish> 
    </Control> 
    <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" TabSkip="no"> 
    <Text>[USERERRMSG]</Text> 
    </Control> 
</Dialog> 

InvlaidPidDlg將顯示錯誤消息。從自定義操作您需要設置'USERERRMSG'的值

1

看看this後這也解釋瞭如何在維克斯基於創建自定義對話框安裝

相關問題