|
Imports System.Drawing
Imports System.Windows.Forms
Imports System.ComponentModel
Imports BV.Core
'Imports IMidRang
Imports MidRange
Imports IMidRange
Public Class GraphOfVisorSerial
Inherits GraphOfVisorSimple
'Implements IBlockInputSerial
'para la interfaz serie
Protected intClearOnComplete As Boolean
Protected intRefreshAt As Integer
Protected intRefreshCounter As Integer
Protected intWindowWidth As Long
#Region "Constructor"
Public Sub New(ByVal ParentVisor As IVisorBase, ByVal Pen1 As Pen, ByVal TypeOfComplexValue As SubGraphType)
MyBase.New(ParentVisor, Pen1, TypeOfComplexValue)
End Sub
Protected Overrides Sub Initialize(ByVal UsedPen As Pen, ByVal ParentVisor As IVisorBase)
Me.intBriefDesc = "Graph Of Visor"
'Me.intDescription = "Graph Of Visor"
Me.intName = "GraphOfVisor"
Me.intIcon = New Icon([GetType], "GoV.ico")
intVisible = True
intAutoShow = True
intLineType = TypeOfVisorLine.Solid
intAutoScale = AutoScaleTypes.Y
intClearOnComplete = True
intWindowWidth = 100
intRefreshAt = 10
MyBase.Initialize(UsedPen, ParentVisor)
'intArrayLinesR.Capacity = 10
End Sub
#End Region
#Region "Serial properties"
<Browsable(False)> _
Public Property ClearOnComplete() As Boolean 'Implements IBlockInputSerial.ClearOnComplete
Get
Return intClearOnComplete
End Get
Set(ByVal Value As Boolean)
intClearOnComplete = Value
End Set
End Property
<Browsable(False)> _
Public Property WindowWidth() As Long 'Implements IBlockInputSerial.WindowWidth
Get
Return intWindowWidth
End Get
Set(ByVal Value As Long)
If Value > 0 Then
intWindowWidth = Value
Else
OnSendMessage(Me, New MessageEventArgs("Windows must be greater as 0", MessageEventArgs.EMessageType.[Error]))
End If
End Set
End Property
<Browsable(False)> _
Public Property RefreshAt() As Integer 'Implements IBlockInputSerial.RefreshAt
Get
Return intRefreshAt
End Get
Set(ByVal Value As Integer)
If Value >= 0 Then
If Value <= Me.intWindowWidth Then
intRefreshAt = Value
Else
intRefreshAt = intWindowWidth
End If
Else
OnSendMessage(Me, New MessageEventArgs("Refresh Number must be greater as 0", MessageEventArgs.EMessageType.Warning))
End If
End Set
End Property
#End Region
#Region "Mannaged Events"
Private Sub MannageSerialData()
Dim data() As Object
If ArrayData.Count > 0 Then
'para 2 datos o mas
data = ArrayData.Item(ArrayData.Count - 1)
ReDim Preserve data(data.GetUpperBound(0) + 1)
data(data.GetUpperBound(0)) = CType(ptrObject, IOutput).Data
If intArrayLinesR.Count > 0 Then
intArrayLinesR.RemoveAt(intArrayLinesR.Count - 1) 'borro el ultimo
End If
ArrayData.Add(data)
Else
'primer dato
ReDim data(0)
data(0) = CType(ptrObject, IOutput).Data
ArrayData.Add(data)
End If
UpdatePoints(data) 'actualizo el array de lineas
If Me.intRefreshAt <= intRefreshCounter Then
RaiseDataChanged(Me, New EventArgs)
intRefreshCounter = 0
End If
intRefreshCounter = intRefreshCounter + 1
End Sub
Protected Overrides Sub MannageDataChanged(ByVal sender As Object, ByVal e As EventArgs)
If TypeOf ptrObject Is IOutput Then
MyBase.MannageDataChanged(sender, e)
ElseIf TypeOf ptrObject Is IOutput Then
MannageSerialData()
Else
Stop 'error
OnSendMessage(Me, New MessageEventArgs("Unsupported data Type", MessageEventArgs.EMessageType.[Error]))
End If
'UpdatePoints()
End Sub
#End Region
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.