'  
'   Rebex Sample Code License
' 
'   Copyright 2026, REBEX CR s.r.o.
'   All rights reserved.
'   https://www.rebex.net/
' 
'   Permission to use, copy, modify, and/or distribute this software for any
'   purpose with or without fee is hereby granted.
' 
'   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
'   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
'   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
'   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
'   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
'   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
'   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
'   OTHER DEALINGS IN THE SOFTWARE.
' 

Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms

''' <summary>
''' Renaming form.
''' </summary>
Public Class NewNameForm
    Inherits System.Windows.Forms.Form
    ''' <summary>
    ''' Required designer variable.
    ''' </summary>
    Private components As System.ComponentModel.Container = Nothing

    Private label1 As System.Windows.Forms.Label
    Private tbName As System.Windows.Forms.TextBox
    Private btnOk As System.Windows.Forms.Button
    Private btnCancel As System.Windows.Forms.Button

    ''' <summary>
    ''' Gets or sets the name.
    ''' </summary>
    <Browsable(False)>
    <DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
    Public Property FileName() As String
        Get
            Return tbName.Text
        End Get
        Set
            tbName.Text = Value
            tbName.Focus()
            tbName.[Select]()
        End Set
    End Property

    ''' <summary>
    ''' Initialize the form.
    ''' </summary>
    Public Sub New()
        '
        ' Required for Windows Form Designer support
        '
        InitializeComponent()
    End Sub

    ''' <summary>
    ''' Clean up any resources being used.
    ''' </summary>
    Protected Overrides Sub Dispose(disposing As Boolean)
        If disposing Then
            If components IsNot Nothing Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    #Region "Windows Form Designer generated code"
    ''' <summary>
    ''' Required method for Designer support - do not modify
    ''' the contents of this method with the code editor.
    ''' </summary>
    Private Sub InitializeComponent()
        Me.label1 = New System.Windows.Forms.Label()
        Me.tbName = New System.Windows.Forms.TextBox()
        Me.btnOk = New System.Windows.Forms.Button()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        ' 
        ' label1
        ' 
        Me.label1.Location = New System.Drawing.Point(8, 8)
        Me.label1.Name = "label1"
        Me.label1.TabIndex = 0
        Me.label1.Text = "New name:"
        ' 
        ' tbName
        ' 
        Me.tbName.Location = New System.Drawing.Point(8, 32)
        Me.tbName.Name = "tbName"
        Me.tbName.Size = New System.Drawing.Size(160, 20)
        Me.tbName.TabIndex = 1
        Me.tbName.Text = "New name"
        ' 
        ' btnOk
        ' 
        Me.btnOk.Location = New System.Drawing.Point(8, 56)
        Me.btnOk.Name = "btnOk"
        Me.btnOk.TabIndex = 2
        Me.btnOk.Text = "&OK"
        AddHandler Me.btnOk.Click, New System.EventHandler(AddressOf Me.btnOk_Click)
        ' 
        ' btnCancel
        ' 
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(94, 56)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.TabIndex = 3
        Me.btnCancel.Text = "&Cancel"
        AddHandler Me.btnCancel.Click, New System.EventHandler(AddressOf Me.btnCancel_Click)
        ' 
        ' NewNameForm
        ' 
        Me.AcceptButton = Me.btnOk
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(176, 86)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnOk)
        Me.Controls.Add(Me.tbName)
        Me.Controls.Add(Me.label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
        Me.KeyPreview = True
        Me.Name = "NewNameForm"
        Me.ShowInTaskbar = False
        Me.Text = "New Name"
        Me.ResumeLayout(False)

    End Sub
    #End Region

    ''' <summary>
    ''' Handles the click on the Ok button.
    ''' </summary>
    Private Sub btnOk_Click(sender As Object, e As System.EventArgs)
        Me.DialogResult = DialogResult.OK
        Close()
    End Sub

    ''' <summary>
    ''' Handles the click on the Cancel button.
    ''' </summary>
    Private Sub btnCancel_Click(sender As Object, e As System.EventArgs)
        Close()
    End Sub
End Class
