|
Imports BV.Controls
Imports MidRange
Imports BV.Core
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Drawing
Imports System.Collections
Imports System.Collections.Generic
Imports GraphicsObjects
Imports BV.TopLevel.Parsing
'toolbar que permite interactuar entre functiones y un Visor
Public Class FuncYVisorToolBar
Inherits FunctionToolbar
Protected intArrVisors As List(Of Visor2DGoV)
Protected htbl As Dictionary(Of [Function], BasicSystemCalc)
Protected intVisor As VisorXYAdvanced
Protected SysCalc As AutoSystemCalc
Protected GoV As GraphOfVisorComplexS
Protected BvTlBarBtnRemGoV As BVToolBarButton
Protected BvTlBarBtnAddFn2Visor As BVToolBarButton
Public Event VisorAdding(ByVal sender As Object, ByVal e As EventArgs)
Public Event VisorRemoving(ByVal sender As Object, ByVal e As EventArgs)
Public Sub New(ByVal MainToolBar As BVToolBar)
MyBase.New(MainToolBar)
intArrVisors = New List(Of Visor2DGoV)
htbl = New Dictionary(Of [Function], BasicSystemCalc)
ImgLst.Images.Add(New Icon([GetType], "AddFunct2GoV.ico"))
ImgLst.Images.Add(New Icon([GetType], "RemFunct2GoV.ico"))
'ImgLst.Images.Add(New Icon([GetType], "RemoveParam.ico"))
End Sub
Public Overrides Sub InitializeToolbar()
MyBase.InitializeToolbar()
Dim BvTlBarBtn As BVToolBarButton
'Band = New BVToolBarBand
'Band.ImageList = ImgLst
'Band.Visible = False
BvTlBarBtn = New BV.Controls.BVToolBarButton
BvTlBarBtn.Style = ToolBarButtonStyle.Separator
BvTlBarBtn.Name = "BvTlBarBtnSep2"
Me.Band.Buttons.Add(BvTlBarBtn)
BvTlBarBtnAddFn2Visor = New BV.Controls.BVToolBarButton
BvTlBarBtnAddFn2Visor.ImageIndex = 7
BvTlBarBtnAddFn2Visor.Name = "BvTlBarBtnAddFunction2Visor"
'BvTlBarBtnAddFn2Visor.Style = ToolBarButtonStyle.DropDownButton
BvTlBarBtnAddFn2Visor.ToolTipText = "Add Selected Function to Visor"
BvTlBarBtnAddFn2Visor.Enabled = False
Me.Band.Buttons.Add(BvTlBarBtnAddFn2Visor, AddressOf AddFunctionToVisor)
BvTlBarBtnRemGoV = New BV.Controls.BVToolBarButton
BvTlBarBtnRemGoV.ImageIndex = 8
BvTlBarBtnRemGoV.Name = "BvTlBarBtnRemoveFunctionFromVisor"
BvTlBarBtnRemGoV.ToolTipText = "Remove Selected Function from Visor"
BvTlBarBtnRemGoV.Enabled = False
Me.Band.Buttons.Add(BvTlBarBtnRemGoV, AddressOf RemoveFunctionFromVisor)
'Me.TlBar.Bands.Add(Band)
End Sub
#Region "Properties"
<Browsable(False)> _
Public Property SystemCalc() As AutoSystemCalc
Get
Return Me.SysCalc
End Get
Set(ByVal Value As AutoSystemCalc)
Me.SysCalc = Value
End Set
End Property
<Browsable(False)> _
Public ReadOnly Property Visors() As Visor2DGoV()
Get
Return Me.intArrVisors.ToArray()
End Get
End Property
<Browsable(False)> _
Public Property SelectedGraph() As GraphOfVisorSimple
Get
Return Me.GoV
End Get
Set(ByVal Value As GraphOfVisorSimple)
Me.GoV = Value
BvTlBarBtnRemGoV.Enabled = (Not GoV Is Nothing)
End Set
End Property
<Browsable(False)> _
Public Property SelectedVisor() As VisorXYAdvanced
Get
Return Me.intVisor
End Get
Set(ByVal Value As VisorXYAdvanced)
Me.intVisor = Value
Me.BvTlBarBtnRemGoV.Enabled = (Not Value Is Nothing)
End Set
End Property
<Browsable(False)> _
Public Overrides Property SelectedFunction() As [Function]
Get
Return FunctionManager.CurrentFunction
End Get
Set(ByVal Value As [Function])
FunctionManager.CurrentFunction = Value
'if me.intVisor.Contains(
If Value Is Nothing Then
Exit Property
End If
If Me.htbl.ContainsKey(Value) Then
Me.BvTlBarBtnAddFn2Visor.Enabled = False
Me.BvTlBarBtnDeleteFn.Enabled = False
Else
Me.BvTlBarBtnAddFn2Visor.Enabled = True
Me.BvTlBarBtnDeleteFn.Enabled = True
End If
End Set
End Property
#End Region
#Region "Internal Add & Remove"
Public Sub AddFunctionToVisor()
If Not FunctionManager.CurrentFunction Is Nothing Then
Me.Add(FunctionManager.CurrentFunction)
End If
End Sub
Public Sub RemoveFunctionFromVisor()
If Not FunctionManager.CurrentFunction Is Nothing Then
Me.Remove(FunctionManager.CurrentFunction)
End If
End Sub
#End Region
#Region "External Add & Remove"
Public Overloads Sub Add(ByVal Visor As VisorXYAdvanced)
If Not Me.intArrVisors.Contains(Visor) Then
Me.intArrVisors.Add(Visor)
End If
Me.intVisor = Visor
End Sub
Public Overloads Function Add(ByVal F As [Function]) As GraphOfVisorSimple
If Not Me.htbl.ContainsKey(F) Then
Me.SysCalc = New AutoSystemCalc(F)
Me.htbl.Add(F, Me.SysCalc)
Me.intVisor.Add(Me.SysCalc)
GoV = intVisor.CurrentGoV
GoV.LineType = TypeOfVisorLine.Solid
GoV.Show = EGraphShowOne.Real
GoV.BriefDescription = F.Name
RaiseEvent VisorAdding(Me, New EventArgs)
Return GoV
End If
Return Nothing
End Function
Public Overloads Sub Remove(ByVal F As [Function])
If Me.htbl.ContainsKey(F) Then
Me.SysCalc = Me.htbl.Item(F)
Me.intVisor.Remove(Me.SysCalc)
Me.htbl.Remove(F)
Me.SysCalc = Nothing
RaiseEvent VisorRemoving(Me, New EventArgs)
End If
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.