Imports Stax.AppFramework
Imports Stax.UI

Public Class CmdlScriptEditor
    Inherits ExtendedForm

#Region " Designer "

    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
    Friend WithEvents SmartTagProvider As Stax.UI.Design.SmartTagProvider
    Friend WithEvents bOK As System.Windows.Forms.Button
    Friend WithEvents bCancel As System.Windows.Forms.Button
    Friend WithEvents CmdlScriptControl As StaxRip.CmdlScriptControl
    Friend WithEvents bHelp As System.Windows.Forms.Button

    Private components As System.ComponentModel.IContainer

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.SmartTagProvider = New Stax.UI.Design.SmartTagProvider
        Me.bOK = New System.Windows.Forms.Button
        Me.bCancel = New System.Windows.Forms.Button
        Me.CmdlScriptControl = New StaxRip.CmdlScriptControl
        Me.bHelp = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'bOK
        '
        Me.bOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.bOK.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.bOK.Location = New System.Drawing.Point(195, 332)
        Me.bOK.Name = "bOK"
        Me.bOK.Size = New System.Drawing.Size(75, 24)
        Me.bOK.TabIndex = 1
        Me.bOK.Text = "OK"
        '
        'bCancel
        '
        Me.bCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.bCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.bCancel.Location = New System.Drawing.Point(276, 332)
        Me.bCancel.Name = "bCancel"
        Me.bCancel.Size = New System.Drawing.Size(75, 24)
        Me.bCancel.TabIndex = 2
        Me.bCancel.Text = "Cancel"
        '
        'CmdlScriptControl
        '
        Me.CmdlScriptControl.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.CmdlScriptControl.Location = New System.Drawing.Point(12, 12)
        Me.CmdlScriptControl.Name = "CmdlScriptControl"
        Me.CmdlScriptControl.Size = New System.Drawing.Size(420, 314)
        Me.CmdlScriptControl.TabIndex = 0
        Me.CmdlScriptControl.Text = "Text"
        '
        'bHelp
        '
        Me.bHelp.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.bHelp.Location = New System.Drawing.Point(357, 332)
        Me.bHelp.Name = "bHelp"
        Me.bHelp.Size = New System.Drawing.Size(75, 24)
        Me.bHelp.TabIndex = 3
        Me.bHelp.Text = "Help"
        Me.bHelp.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
        Me.bHelp.UseVisualStyleBackColor = True
        '
        'CmdlScriptEditor
        '
        Me.ClientSize = New System.Drawing.Size(444, 368)
        Me.Controls.Add(Me.bHelp)
        Me.Controls.Add(Me.CmdlScriptControl)
        Me.Controls.Add(Me.bCancel)
        Me.Controls.Add(Me.bOK)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.HelpButton = True
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "CmdlScriptEditor"
        Me.ShowIcon = False
        Me.ShowInTaskbar = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
        Me.Text = "Text"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private HelpText As String

    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub

    Public Sub SetCmdlDefaults()
        Text = "Command Line Editor"
        HelpText = "The Command Line Editor allows the convenient editing of command lines."
        CmdlScriptControl.SetCmdlDefaults()
        Size = New Size(800, 250)
    End Sub

    Public Sub SetScriptDefaults()
        Text = "Script Editor"
        HelpText = "The Script Editor allows the convenient editing of scripts."
        CmdlScriptControl.SetScriptDefaults()
        Size = New Size(450, 400)
    End Sub

    Private Sub bHelp_Click(ByVal sender As Object, ByVal e As EventArgs) Handles bHelp.Click
        Dim f As New HelpForm()
        f.Document.WriteStart(Text)
        f.Document.WriteParagraph(HelpText)
        f.Document.WriteTips(CmdlScriptControl.TipProvider.GetTips)
        f.Document.WriteTable("Macros", Macro.GetTips)
        f.Show()
    End Sub

    Private Sub CLIScriptEditor_ActivatedFirstTime() Handles Me.ActivatedFirstTime
        If Not s.StringList.Contains(Me.GetType.FullName) Then
            bHelp.PerformClick()
            s.StringList.Add(Me.GetType.FullName)
        End If
    End Sub
End Class