You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

95 lines
3.4 KiB

Imports System.ComponentModel
Public Class frmLVNCRSMain
Private Sub frmLVNCRSMain_Load(sender As Object, e As EventArgs) Handles Me.Load
txtLVNCSupportID.Text = String.Empty
txtLVNCSupportPasswd.Text = String.Empty
tsButtonRunAs.Image = Nothing
tsLabelSrvStatus.Image = Nothing
tsLabelSrvStatus.Text = "Подготовка..."
End Sub
Private Sub frmLVNCRSMain_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Me.Show()
Me.Refresh()
If Svc.Init() Then
tsLabelSrvStatus.Text = String.Empty
Svc.CheckProxy()
If Svc.bProxyStatus = 1 Then
tsLabelSrvStatus.Image = My.Resources.online
txtLVNCSupportID.Text = Format(Convert.ToInt32(Svc.sSupportID), "### ### ##0")
txtLVNCSupportPasswd.Text = Svc.sSupportPasswd
Svc.StartVNC()
Else
tsLabelSrvStatus.Image = My.Resources.offline
tsLabelSrvStatus.Text = "Не готов! Проверьте подключение к сети."
End If
tCheckTimer.Enabled = True
Else
MsgBox("ОЙ! Что-то пошло не так...", MsgBoxStyle.Critical)
Application.Exit()
End If
End Sub
Private Sub tsButtonRunAs_Click(sender As Object, e As EventArgs) Handles tsButtonRunAs.Click
'Dim sLogin As String = "locadm"
'Dim sPasswd As String = "dbkrf-bujkrf"
'Dim secPasswd As New Security.SecureString
'
'For i As Integer = 0 To sPasswd.Length - 1
' secPasswd.AppendChar(sPasswd.ElementAt(i))
'Next
'
'Dim startInfo As New ProcessStartInfo
'With startInfo
' .Arguments = "/Q /C start " & Application.ExecutablePath
' .FileName = Environment.GetEnvironmentVariable("ComSpec")
' .Password = secPasswd
' .UserName = sLogin
' .UseShellExecute = False
' .WorkingDirectory = Environment.CurrentDirectory
' .WindowStyle = ProcessWindowStyle.Hidden
'End With
'
'Try
' Dim p As Process = Process.Start(startInfo)
'Catch ex As System.ComponentModel.Win32Exception
' Return
'End Try
'
'Application.Exit()
End Sub
Private Sub tCheckTimer_Tick(sender As Object, e As EventArgs) Handles tCheckTimer.Tick
Dim bProxyOldStatus As Byte = Svc.bProxyStatus
Svc.CheckProxy()
If Svc.bProxyStatus = 1 Then
tsLabelSrvStatus.Image = My.Resources.online
tsLabelSrvStatus.Text = String.Empty
txtLVNCSupportID.Text = Format(Convert.ToInt32(Svc.sSupportID), "### ### ##0")
txtLVNCSupportPasswd.Text = Svc.sSupportPasswd
Else
tsLabelSrvStatus.Image = My.Resources.offline
If bProxyOldStatus = 1 Then
tsLabelSrvStatus.Text = "Ошибка! Проверьте подключение к сети."
Else
tsLabelSrvStatus.Text = "Не готов! Проверьте подключение к сети."
End If
End If
End Sub
Private Sub frmLVNCRSMain_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
tsLabelSrvStatus.Text = "Завершение работы..."
Svc.StopVNC()
End Sub
End Class