Option Explicit On
Imports System.Linq
Imports System.Collections.Generic
Namespace Eval
   Public Class frmEval : Inherits System.Windows.Forms.Form
      Private Dim _disposed As Boolean = False
      <System.Diagnostics.DebuggerNonUserCode()> _
      Public Sub New()
         MyBase.New()
         'This call is required by the Windows Form Designer.
         InitializeComponent()
         'Add any initialization after the InitializeComponent() call
         If (DesignMode) Then Exit Sub

      End Sub
      'Form overrides dispose to clean up the component list.
      <System.Diagnostics.DebuggerNonUserCode()> _
      Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
         If _disposed Then
            Return
         End If
         If Disposing Then
            If Not components Is Nothing Then
               components.Dispose()
            End If
         End If
         _disposed = True
         MyBase.Dispose(Disposing)
      End Sub
      'Pretty short, Ha ?
      Dim cEval As New Evaluator
      Private Sub cmdEval_Click(ByVal sender As Object, ByVal e As EventArgs)


         If (modPlayWave.CanPlayWaves()) Then
            modPlayWave.PlayWave(gmRTL.Core.App.DefInstance.Path & IIf((gmRTL.Core.App.DefInstance.Path).EndsWith("\"),"","\") & "Sounds\pff.Wav")
         End If
         Dim Result As Double = 0.0
         Result = cEval.Evaluate(Text1.Text,True)
         If (cEval.error_migname = Evaluator.EvalError.ERR_NONE) Then
            txtResult.Text = Convert.ToString(Result)
         Else
            txtResult.Text = cEval.ErrorString
         End If

      End Sub
      Private Sub Text1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
         If (modPlayWave.CanPlayWaves()) Then
            modPlayWave.PlayWave(gmRTL.Core.App.DefInstance.Path & IIf((gmRTL.Core.App.DefInstance.Path).EndsWith("\"),"","\") & "Sounds\flip.wav")
         End If
      End Sub
   End Class
End Namespace
