📄 listdialog.vb
字号:
'Filename : ListDialog.vb
'Part of : Application installer VB.NET example
'Description : Main dialog of VBInstaller.NET example application
'Version : 3.2
'
'This example is only to be used with PC Connectivity API version 3.2.
'Compability ("as is") with future versions is not quaranteed.
'
'Copyright (c) 2007 Nokia Corporation.
'
'This material, including but not limited to documentation and any related
'computer programs, is protected by intellectual property rights of Nokia
'Corporation and/or its licensors.
'All rights are reserved. Reproducing, modifying, translating, or
'distributing any or all of this material requires the prior written consent
'of Nokia Corporation. Nokia Corporation retains the right to make changes
'to this material at any time without notice. A copyright license is hereby
'granted to download and print a copy of this material for personal use only.
'No other license to any other intellectual property rights is granted. The
'material is provided "as is" without warranty of any kind, either express or
'implied, including without limitation, any warranty of non-infringement,
'merchantability and fitness for a particular purpose. In no event shall
'Nokia Corporation be liable for any direct, indirect, special, incidental,
'or consequential loss or damages, including but not limited to, lost profits
'or revenue,loss of use, cost of substitute program, or loss of data or
'equipment arising out of the use or inability to use the material, even if
'Nokia Corporation has been advised of the likelihood of such damages occurring.
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Public Class ListDialog
Public strSerialNumber As String
Public strAppUID() As String
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub ApplicationList_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ApplicationList.SelectedIndexChanged
End Sub
Private Sub CommandUninstall_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CommandUninstall.Click
Dim iSelIndex As Integer
Dim strSAppName As String
Dim strSAppUID As String
Dim iResult As Integer
Dim pFSCallBack As FSNotifyCallbackDelegate
iSelIndex = ApplicationList.SelectedIndex()
If iSelIndex >= 0 Then
Dim iDeviceID As Integer
Dim iMedia As Integer
iMedia = API_MEDIA_ALL
' Create FS connection
iResult = CONAOpenFS(strSerialNumber, iMedia, hFSHandle, iDeviceID)
If iResult <> CONA_OK Then
ShowErrorMessage("CONAOpenFS", iResult)
Else
CommandUninstall.Enabled = False
OK_Button.Enabled = False
' Register file system notification callback function
pFSCallBack = AddressOf FSNotifyCallback
iResult = CONARegisterFSNotifyCallback(hFSHandle, API_REGISTER, pFSCallBack)
If iResult <> CONA_OK Then
ShowErrorMessage("CONARegisterFSNotifyCallback", iResult)
End If
' Use main window progress bar
MainForm.labelWait.Visible = False
MainForm.ProgressBar1.Visible = True
Cursor = Cursors.WaitCursor
' Uninstall selected item
strSAppName = ApplicationList.Items(iSelIndex)
strSAppUID = strAppUID(iSelIndex)
iResult = UnInstallApplication(strSAppName, strSAppUID)
If iResult = CONA_OK Then
ApplicationList.Items.RemoveAt(iSelIndex)
End If
OK_Button.Enabled = True
CommandUninstall.Enabled = True
' Clean up
Cursor = Cursors.Default
MainForm.labelWait.Visible = False
MainForm.ProgressBar1.Value = 0
MainForm.ProgressBar1.Visible = False
' Unregister file system notification callback function
iResult = CONARegisterFSNotifyCallback(hFSHandle, API_UNREGISTER, pFSCallBack)
If iResult <> CONA_OK Then
ShowErrorMessage("CONARegisterFSNotifyCallback", iResult)
End If
' Close file system
iResult = CONACloseFS(hFSHandle)
If iResult <> CONA_OK Then
ShowErrorMessage("CONACloseFS", iResult)
End If
End If
End If
End Sub
Private Sub ListDialog_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
If bAppUninstallSupported Then
CommandUninstall.Enabled = True
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -