Imports System.Data
Imports System.Data.OleDb
Imports cablin.clFuncionesGenericas
Imports cablin
Public Class frmConfiguracionAplicacion
    Inherits System.Windows.Forms.Form
    Private bIdentificacionValida As Boolean
    Private WithEvents tlbBarraGenerica As New ucBarraGenerica
    Friend WithEvents tbPuertoLocal As System.Windows.Forms.textBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents tbRutaDatos As System.Windows.Forms.textBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents tbRutaTemporales As System.Windows.Forms.textBox
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents tbPuertoRemoto As System.Windows.Forms.textBox
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents tbServidorRemoto As System.Windows.Forms.textBox
    Friend WithEvents Label6 As System.Windows.Forms.Label
    Public WithEvents clCab As cablin.clCabLin
    'Friend NombreServicio As String
    'Friend Puerto As String
    'Friend FicheroConfig As String


#Region " Código generado por el Diseñador de Windows Forms "

    Public Sub New()
        MyBase.New()

        'El Diseñador de Windows Forms requiere esta llamada.
        InitializeComponent()

        'Agregar cualquier inicialización después de la llamada a InitializeComponent()

    End Sub

    'Form reemplaza a Dispose para limpiar la lista de componentes.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Requerido por el Diseñador de Windows Forms
    Private components As System.ComponentModel.IContainer

    'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
    'Puede modificarse utilizando el Diseñador de Windows Forms. 
    'No lo modifique con el editor de código.
    Friend WithEvents Estado As System.Windows.Forms.Label
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents tbServidorLocal As System.Windows.Forms.textBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmConfiguracionAplicacion))
        Me.Estado = New System.Windows.Forms.Label()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.tbServidorLocal = New System.Windows.Forms.textBox()
        Me.tbPuertoLocal = New System.Windows.Forms.textBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.tbRutaDatos = New System.Windows.Forms.textBox()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.tbRutaTemporales = New System.Windows.Forms.textBox()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.tbPuertoRemoto = New System.Windows.Forms.textBox()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.tbServidorRemoto = New System.Windows.Forms.textBox()
        Me.Label6 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'Estado
        '
        Me.Estado.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.Estado.ForeColor = System.Drawing.Color.Red
        Me.Estado.Location = New System.Drawing.Point(16, 64)
        Me.Estado.Name = "Estado"
        Me.Estado.Size = New System.Drawing.Size(653, 16)
        Me.Estado.tabIndex = 19
        Me.Estado.text = "Estado:"
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(21, 99)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(138, 16)
        Me.Label1.tabIndex = 28
        Me.Label1.text = "Servidor Local:"
        '
        'tbServidorLocal
        '
        Me.tbServidorLocal.Location = New System.Drawing.Point(173, 95)
        Me.tbServidorLocal.Name = "tbServidorLocal"
        Me.tbServidorLocal.Size = New System.Drawing.Size(196, 20)
        Me.tbServidorLocal.tabIndex = 27
        Me.tbServidorLocal.tag = "IND:1|NBD:N-E:ServidorLocal|USC:1"
        '
        'tbPuertoLocal
        '
        Me.tbPuertoLocal.Location = New System.Drawing.Point(173, 121)
        Me.tbPuertoLocal.Name = "tbPuertoLocal"
        Me.tbPuertoLocal.Size = New System.Drawing.Size(196, 20)
        Me.tbPuertoLocal.tabIndex = 29
        Me.tbPuertoLocal.tag = "IND:2|NBD:N-E:PuertoLocal|USC:1"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(21, 125)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(138, 16)
        Me.Label2.tabIndex = 30
        Me.Label2.text = "Puerto Local:"
        '
        'tbRutaDatos
        '
        Me.tbRutaDatos.Location = New System.Drawing.Point(173, 224)
        Me.tbRutaDatos.Name = "tbRutaDatos"
        Me.tbRutaDatos.Size = New System.Drawing.Size(496, 20)
        Me.tbRutaDatos.tabIndex = 33
        Me.tbRutaDatos.tag = "IND:5|NBD:N-E:RutaDatos|BCO:O|USC:1"
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(21, 229)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(138, 16)
        Me.Label4.tabIndex = 34
        Me.Label4.text = "Ruta Datos:"
        '
        'tbRutaTemporales
        '
        Me.tbRutaTemporales.Location = New System.Drawing.Point(173, 251)
        Me.tbRutaTemporales.Name = "tbRutaTemporales"
        Me.tbRutaTemporales.Size = New System.Drawing.Size(496, 20)
        Me.tbRutaTemporales.tabIndex = 35
        Me.tbRutaTemporales.tag = "IND:6|NBD:N-E:RutaFicherosTemporales|BCO:O|USC:1"
        '
        'Label5
        '
        Me.Label5.Location = New System.Drawing.Point(21, 256)
        Me.Label5.Name = "Label5"
        Me.Label5.Size = New System.Drawing.Size(138, 16)
        Me.Label5.tabIndex = 36
        Me.Label5.text = "Ruta Ficheros Temporales:"
        '
        'tbPuertoRemoto
        '
        Me.tbPuertoRemoto.Location = New System.Drawing.Point(173, 186)
        Me.tbPuertoRemoto.Name = "tbPuertoRemoto"
        Me.tbPuertoRemoto.Size = New System.Drawing.Size(196, 20)
        Me.tbPuertoRemoto.tabIndex = 39
        Me.tbPuertoRemoto.tag = "IND:4|NBD:N-E:PuertoRemoto|BCO:O|USC:1"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(21, 190)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(138, 16)
        Me.Label3.tabIndex = 40
        Me.Label3.text = "Puerto Remoto:"
        '
        'tbServidorRemoto
        '
        Me.tbServidorRemoto.Location = New System.Drawing.Point(173, 160)
        Me.tbServidorRemoto.Name = "tbServidorRemoto"
        Me.tbServidorRemoto.Size = New System.Drawing.Size(196, 20)
        Me.tbServidorRemoto.tabIndex = 37
        Me.tbServidorRemoto.tag = "IND:3|NBD:N-E:ServidorRemoto|USC:1"
        '
        'Label6
        '
        Me.Label6.Location = New System.Drawing.Point(21, 164)
        Me.Label6.Name = "Label6"
        Me.Label6.Size = New System.Drawing.Size(138, 16)
        Me.Label6.tabIndex = 38
        Me.Label6.text = "Servidor Remoto:"
        '
        'frmConfiguracionAplicacion
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.ClientSize = New System.Drawing.Size(681, 345)
        Me.ControlBox = False
        Me.Controls.Add(Me.tbPuertoRemoto)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.tbServidorRemoto)
        Me.Controls.Add(Me.Label6)
        Me.Controls.Add(Me.tbRutaTemporales)
        Me.Controls.Add(Me.Label5)
        Me.Controls.Add(Me.tbRutaDatos)
        Me.Controls.Add(Me.Label4)
        Me.Controls.Add(Me.tbPuertoLocal)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.tbServidorLocal)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.Estado)
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.KeyPreview = True
        Me.MinimizeBox = False
        Me.Name = "frmConfiguracionAplicacion"
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.tag = "APSB:S"
        Me.text = "Configuración de la Aplicación"
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Private Sub frmcambioPin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Call AgregaBarraGenerica(Me, CType(tlbBarraGenerica, Object))
        clCab = New clCabLin(Me, "Instalacion", Nothing)
        Me.tlbBarraGenerica.tlbSiguiente.Enabled = False
        Me.tlbBarraGenerica.tlbSiguiente.Visible = False
        Me.tlbBarraGenerica.tlbAlmacenar.Visible = True
        Me.tlbBarraGenerica.tlbAlmacenar.Enabled = True
        Me.tlbBarraGenerica.tlbLimpiarPantalla.Visible = False
        Me.tlbBarraGenerica.tlbSalir.Enabled = True
        Me.tlbBarraGenerica.tlbEliminaFicha.Visible = False
        clCab.Estado = "Introduzca Datos"

        Call RedibujaBarraGenerica(tlbBarraGenerica.tbGenerico)
    End Sub
    Private Sub clCab_DespuesFPulsado(ByVal Tecla As String) Handles clCab.DespuesFPulsado
        Select Case Tecla
            Case "1"
                Try
                    If Me.tbServidorLocal.text <> "" Then
                        If Me.tbPuertoLocal.text = "" Then
                            Throw New Exception("Si especifica un servidor local, debe especificar el puerto de conexión Local")
                        End If
                    End If
                    If Me.tbPuertoLocal.text <> "" Then
                        If Me.tbServidorLocal.text = "" Then
                            Throw New Exception("Si especifica un puerto local, debe especificar el servidor de conexión Local")
                        End If
                    End If
                    If Me.tbServidorRemoto.text <> "" Then
                        If Me.tbPuertoRemoto.text = "" Then
                            Throw New Exception("Si especifica un servidor remoto, debe especificar el puerto de conexión remoto")
                        End If
                    End If
                    If Me.tbPuertoRemoto.text <> "" Then
                        If Me.tbServidorRemoto.text = "" Then
                            Throw New Exception("Si especifica un puerto remoto, debe especificar el servidor de conexión remoto")
                        End If
                    End If
                    If Me.tbServidorRemoto.text = "" And Me.tbServidorLocal.text = "" Then
                        Throw New Exception("Debe especificar al menos un servidor")
                    End If
                    Me.Close()
                Catch ex As Exception
                    MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error")
                    '    Environment.Exit(0)
                End Try
            Case "8"
                Environment.Exit(0)
        End Select
    End Sub
    Public Shared Sub RedibujaBarraGenerica(ByVal BarraHerramientas As Windows.Forms.ToolBar)
        Try
            Dim butBoton As Windows.Forms.ToolBarButton, iNumbotones As Integer
            For Each butBoton In BarraHerramientas.Buttons
                If butBoton.Visible Then
                    iNumbotones += 1
                End If
            Next
            BarraHerramientas.Width = (BarraHerramientas.ButtonSize.Width * iNumbotones) + 10
            BarraHerramientas.Parent.Width = BarraHerramientas.Width
        Catch ex As Exception
            MsgBox(ex.Message & ". En Redibujabarragenerica" & vbCrLf & ex.StackTrace)
        End Try
    End Sub

    'Private Sub frmSeleccionInstalacion_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
    '    e.Cancel = Not bIdentificacionValida
    'End Sub

    Private Sub frmConfiguracionAplicacion_Shown(sender As Object, e As System.EventArgs) Handles Me.Shown


        tbServidorLocal.Focus()
    End Sub
End Class
