本文整理汇总了VB.NET中System.Configuration.Install.UninstallAction枚举的典型用法代码示例。如果您正苦于以下问题:VB.NET UninstallAction枚举的具体用法?VB.NET UninstallAction怎么用?VB.NET UninstallAction使用的例子?那么恭喜您, 这里精选的枚举代码示例或许可以为您提供帮助。
在下文中一共展示了UninstallAction枚举的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: MyUninstallActionClass
' 导入命名空间
Imports System.Diagnostics
Imports System.Collections
Imports System.ComponentModel
Imports System.Configuration.Install
<RunInstaller(True)> _
Public Class MyUninstallActionClass
Inherits Installer
Private myInstaller As New EventLogInstaller()
' Override the 'Install' method.
Public Overrides Sub Install(savedState As IDictionary)
Console.Write("Enter a new log to create (eg: MyLog ): ")
myInstaller.Log = Console.ReadLine()
Console.Write("Enter a source for log (eg: MySource ): ")
myInstaller.Source = Console.ReadLine()
Installers.Add(myInstaller)
MyBase.Install(savedState)
End Sub
' Override the 'Commit' method.
Public Overrides Sub Commit(savedState As IDictionary)
MyBase.Commit(savedState)
End Sub
' Override the 'Rollback' method.
Public Overrides Sub Rollback(savedState As IDictionary)
MyBase.Rollback(savedState)
End Sub
Public Overrides Sub Uninstall(savedState As IDictionary)
Console.Write("Enter a source from log to uninstall(eg: MySource ): ")
myInstaller.Source = Console.ReadLine()
Console.Write("Do you want to uninstall, press 'y' for 'YES' and 'n' for 'NO':")
Dim myUninstall As String = Console.ReadLine()
If myUninstall = "n" Then
' No action to be taken on the resource in the event log.
myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.NoAction
Else
' Remove the resource from the event log.
myInstaller.UninstallAction = System.Configuration.Install.UninstallAction.Remove
End If
Installers.Add(myInstaller)
MyBase.Uninstall(savedState)
End Sub
Public Shared Sub Main()
Console.WriteLine("Syntax for install: installutil.exe "+ _
"UninstallAction_NoAction_Remove_3.exe ")
Console.WriteLine("Syntax for uninstall: installutil.exe /u " + _
"UninstallAction_NoAction_Remove_3.exe ")
End Sub
End Class