1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
''' <summary>
''' Interaction logic for UserAccess.xaml
''' </summary>
Public Partial Class UserAccess
Inherits UserControl
Event MainMenuButtonClicked(Index As Integer)
Public Shared ReadOnly CommandEscapeButton As New RoutedCommand()
Public Shared ReadOnly CommandValidateButton As New RoutedCommand()
Private Password As String = ""
Private Declare Function Wow64DisableWow64FsRedirection Lib "Kernel32" (ByRef OldValue As Integer) As Boolean
Private Declare Function Wow64RevertWow64FsRedirection Lib "Kernel32" (OldValue As Integer) As Boolean
'Declare Function Wow64DisableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
'Declare Function Wow64EnableWow64FsRedirection Lib "kernel32" (ByRef oldvalue As Long) As Boolean
Public Sub New()
InitializeComponent()
PassWordA.Focus()
'UserAccessGrid.Focus()
'AddHandler UserAccessGrid.KeyDown, AddressOf UserAccessKeyDownEventHandler
'AddHandler PassWordA.KeyDown, AddressOf MainWindowKeyDownEventHandler
'AddHandler PassWordB.KeyDown, AddressOf MainWindowKeyDownEventHandler
'AddHandler PassWordC.KeyDown, AddressOf MainWindowKeyDownEventHandler
'AddHandler PassWordD.KeyDown, AddressOf MainWindowKeyDownEventHandler
End Sub
Private Sub PassWordA_TextChanged(sender As Object, e As EventArgs) Handles PassWordA.TextChanged
PassWordB.Focus()
PassWordB.SelectAll()
End Sub
Private Sub PassWordB_TextChanged(sender As Object, e As EventArgs) Handles PassWordB.TextChanged
PassWordC.Focus()
PassWordC.SelectAll()
End Sub
Private Sub PassWordC_TextChanged(sender As Object, e As EventArgs) Handles PassWordC.TextChanged
PassWordD.Focus()
PassWordD.SelectAll()
End Sub
Private Sub PassWordD_TextChanged(sender As Object, e As EventArgs) Handles PassWordD.TextChanged
PassWordA.Focus()
PassWordA.SelectAll()
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim Redir64 As Integer
Wow64DisableWow64FsRedirection(Redir64)
System.Diagnostics.Process.Start(Environment.GetFolderPath(Environment.SpecialFolder.System) & "\osk.exe")
Wow64RevertWow64FsRedirection(Redir64)
End Sub
'Private osk As String = "C:\Windows\System32\osk.exe"
'Private Sub Keyboard_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Loaded
'Dim old As Long
'If Environment.Is64BitOperatingSystem Then
'If Wow64DisableWow64FsRedirection(old) Then
'System.Diagnostics.Process.Start(osk)
'Wow64EnableWow64FsRedirection(old)
'End If
'Else
'System.Diagnostics.Process.Start(osk)
'End If
'End Sub
'# Region "Event Handler"
Private Sub CommandBinding_Escape (ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
RaiseEvent MainMenuButtonClicked(0)
End Sub
Private Sub CommandBinding_Validate (ByVal sender As Object, ByVal e As ExecutedRoutedEventArgs)
Password = PassWordA.Text + PassWordB.Text + PassWordC.Text + PassWordD.Text 'TODO
If Password = "1234" Then
RaiseEvent MainMenuButtonClicked(1)
Else
MessageBox.Show("Wrong Password")
End If
End Sub
'Private Sub UserAccessKeyDownEventHandler (ByVal sender As Object, ByVal e As KeyEventArgs)
'Password = Password & e.Key
'Password = Password
'End Sub
'Private Sub MainWindowKeyDownEventHandler (ByVal sender As Object, ByVal e As KeyEventArgs)
'Password = Password & e.Key
'Password = Password
'End Sub
'# End Region
End Class |
Partager