SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
Classes | Public Member Functions | Protected Member Functions | Properties | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SeciControls.ViHost Class Reference
Inheritance diagram for SeciControls.ViHost:
Inheritance graph
Collaboration diagram for SeciControls.ViHost:
Collaboration graph

Classes

class  TitleHandleTuple
 

Public Member Functions

void AddVI (String filename, int x, int y)
 This method captures the VI and inserts it into the MDI using the WinAPI. More...
 
void CascadeVis ()
 
void RemoveAllVIs ()
 
void RemoveVI (String filename)
 
void SetVisible (Boolean visible)
 
void StartTimer (int interval)
 
 ViHost ()
 

Protected Member Functions

override void Dispose (bool disposing)
 Clean up any resources being used. More...
 

Properties

List< string > ViNames [get]
 

Private Member Functions

void _worker_DoWork (object sender, DoWorkEventArgs e)
 
void _worker_RunWorkerCompleted (object sender, RunWorkerCompletedEventArgs e)
 
void bringViToFront (String filename)
 
void cascadeVIsToolStripMenuItem_Click (object sender, EventArgs e)
 
void getVIPosition (string vi, out WinApi.Rect viRect, out int x, out int y)
 
void InitializeComponent ()
 Required method for Designer support - do not modify the contents of this method with the code editor. More...
 
void moveVisToConfigPositions ()
 When the configuration is loaded it is necessary to move the VIs to the positions saved in the configuration. This is only called the first time the tab is selected. More...
 
void positionVi (String filename, int x, int y)
 
void repaintVi (String filename)
 
void timer1_Tick (object sender, EventArgs e)
 This method is called when the timer object "ticks." More...
 
delegate void UpdateGuiDelegate ()
 
void updateHandles ()
 Unfortunately when a VI is started or stopped its window handle changes, so we have to update the stored handle when this happens and recapture the window. This is called every time the timer ticks. More...
 
void work ()
 

Static Private Member Functions

static TitleHandleTuple findViHandle (String viName)
 
static TitleHandleTuple getHandle (String windowTitle)
 Get the window handle of the VI based on the window's title. More...
 

Private Attributes

Dictionary< string, string > _formNames = new Dictionary<string, string>()
 
Boolean _isFirstTime = true
 
Dictionary< string,
TitleHandleTuple
_viNames = new Dictionary<string, TitleHandleTuple>()
 
Boolean _visible = false
 
BackgroundWorker _worker = new BackgroundWorker()
 
System.Windows.Forms.ToolStripMenuItem cascadeVIsToolStripMenuItem
 
System.ComponentModel.IContainer components = null
 Required designer variable. More...
 
System.Windows.Forms.ContextMenuStrip contextMenuStrip1
 
System.Windows.Forms.Panel panel1
 
System.Windows.Forms.Panel sizeMarker
 
System.Windows.Forms.Timer timer1
 

Detailed Description

This control host LabVIEW VIs, Because the VIs are added via the winapi they are effectively ignored by the panel when it calculates whether it needs to show the scrollbars. As a result, there is a small invisible panel that is aligned with the maximum x and y positions of the VIs. This means that if the position of the bottom right-hand corner of a VI exceed the size of the control then scrollbars are added correctly. The member _sensiblePt is used to calculate the correct position of the invisible panel. VIs have different handles when they are running compared to when they are not running; as a result, it is necessary to update the handles every time the timer ticks.

Definition at line 23 of file ViHost.cs.

Constructor & Destructor Documentation

SeciControls.ViHost.ViHost ( )
inline

Definition at line 34 of file ViHost.cs.

References SeciControls.ViHost._worker_DoWork(), SeciControls.ViHost._worker_RunWorkerCompleted(), and SeciControls.ViHost.InitializeComponent().

Here is the call graph for this function:

Member Function Documentation

void SeciControls.ViHost._worker_DoWork ( object  sender,
DoWorkEventArgs  e 
)
inlineprivate

Definition at line 291 of file ViHost.cs.

References SeciControls.ViHost.UpdateGuiDelegate(), and SeciControls.ViHost.work().

Referenced by SeciControls.ViHost.ViHost().

Here is the call graph for this function:

void SeciControls.ViHost._worker_RunWorkerCompleted ( object  sender,
RunWorkerCompletedEventArgs  e 
)
inlineprivate

Definition at line 301 of file ViHost.cs.

Referenced by SeciControls.ViHost.ViHost().

void SeciControls.ViHost.AddVI ( String  filename,
int  x,
int  y 
)
inline

This method captures the VI and inserts it into the MDI using the WinAPI.

Parameters
filenameThe full filepath for the VI
xThe x co-ordinate of the top-left corner of the VI
yThe y co-ordinate of the top-left corner of the VI

Definition at line 47 of file ViHost.cs.

References SeciControls.ViHost._viNames, SeciControls.ViHost.findViHandle(), SeciControls.ViHost.positionVi(), and SeciControls.ViHost.repaintVi().

Here is the call graph for this function:

void SeciControls.ViHost.bringViToFront ( String  filename)
inlineprivate

Definition at line 156 of file ViHost.cs.

Referenced by SeciControls.ViHost.CascadeVis().

void SeciControls.ViHost.CascadeVis ( )
inline

Definition at line 161 of file ViHost.cs.

References SeciControls.ViHost.bringViToFront(), SeciControls.ViHost.positionVi(), and SeciControls.ViHost.ViNames.

Referenced by SeciControls.ViHost.cascadeVIsToolStripMenuItem_Click().

Here is the call graph for this function:

void SeciControls.ViHost.cascadeVIsToolStripMenuItem_Click ( object  sender,
EventArgs  e 
)
inlineprivate

Definition at line 180 of file ViHost.cs.

References SeciControls.ViHost.CascadeVis().

Here is the call graph for this function:

override void SeciControls.ViHost.Dispose ( bool  disposing)
inlineprotected

Clean up any resources being used.

Parameters
disposingtrue if managed resources should be disposed; otherwise, false.

Definition at line 14 of file ViHost.designer.cs.

References SeciControls.ViHost.components.

static TitleHandleTuple SeciControls.ViHost.findViHandle ( String  viName)
inlinestaticprivate

Definition at line 107 of file ViHost.cs.

References SeciControls.ViHost.getHandle().

Referenced by SeciControls.ViHost.AddVI(), and SeciControls.ViHost.updateHandles().

Here is the call graph for this function:

static TitleHandleTuple SeciControls.ViHost.getHandle ( String  windowTitle)
inlinestaticprivate

Get the window handle of the VI based on the window's title.

Parameters
windowTitleThe title of the required window
Returns
HandleNameTuple containing the handle and the full window title

Definition at line 119 of file ViHost.cs.

Referenced by SeciControls.ViHost.findViHandle().

void SeciControls.ViHost.getVIPosition ( string  vi,
out WinApi.Rect  viRect,
out int  x,
out int  y 
)
inlineprivate
void SeciControls.ViHost.InitializeComponent ( )
inlineprivate

Required method for Designer support - do not modify the contents of this method with the code editor.

Definition at line 29 of file ViHost.designer.cs.

Referenced by SeciControls.ViHost.ViHost().

void SeciControls.ViHost.moveVisToConfigPositions ( )
inlineprivate

When the configuration is loaded it is necessary to move the VIs to the positions saved in the configuration. This is only called the first time the tab is selected.

Definition at line 189 of file ViHost.cs.

References SeciControls.ViHost.getVIPosition(), SeciControls.ViHost.positionVi(), and SeciControls.ViHost.ViNames.

Referenced by SeciControls.ViHost.SetVisible().

Here is the call graph for this function:

void SeciControls.ViHost.positionVi ( String  filename,
int  x,
int  y 
)
inlineprivate
void SeciControls.ViHost.RemoveAllVIs ( )
inline

Definition at line 99 of file ViHost.cs.

References SeciControls.ViHost.RemoveVI(), and SeciControls.ViHost.ViNames.

Here is the call graph for this function:

void SeciControls.ViHost.RemoveVI ( String  filename)
inline

Definition at line 80 of file ViHost.cs.

References SeciControls.ViHost._viNames.

Referenced by SeciControls.ViHost.RemoveAllVIs().

void SeciControls.ViHost.repaintVi ( String  filename)
inlineprivate

Definition at line 144 of file ViHost.cs.

Referenced by SeciControls.ViHost.AddVI().

void SeciControls.ViHost.SetVisible ( Boolean  visible)
inline
void SeciControls.ViHost.StartTimer ( int  interval)
inline

Definition at line 388 of file ViHost.cs.

void SeciControls.ViHost.timer1_Tick ( object  sender,
EventArgs  e 
)
inlineprivate

This method is called when the timer object "ticks."

Parameters
senderThe sender
eThe event arguments

Definition at line 274 of file ViHost.cs.

References SeciControls.ViHost._worker.

delegate void SeciControls.ViHost.UpdateGuiDelegate ( )
private
void SeciControls.ViHost.updateHandles ( )
inlineprivate

Unfortunately when a VI is started or stopped its window handle changes, so we have to update the stored handle when this happens and recapture the window. This is called every time the timer ticks.

Definition at line 223 of file ViHost.cs.

References SeciControls.ViHost._viNames, SeciControls.ViHost.findViHandle(), SeciControls.ViHost.positionVi(), and SeciControls.ViHost.ViNames.

Referenced by SeciControls.ViHost.work().

Here is the call graph for this function:

void SeciControls.ViHost.work ( )
inlineprivate

Member Data Documentation

Dictionary<string, string> SeciControls.ViHost._formNames = new Dictionary<string, string>()
private

Definition at line 26 of file ViHost.cs.

Boolean SeciControls.ViHost._isFirstTime = true
private

Definition at line 30 of file ViHost.cs.

Referenced by SeciControls.ViHost.SetVisible().

Dictionary<string, TitleHandleTuple> SeciControls.ViHost._viNames = new Dictionary<string, TitleHandleTuple>()
private
Boolean SeciControls.ViHost._visible = false
private

Definition at line 29 of file ViHost.cs.

Referenced by SeciControls.ViHost.SetVisible(), and SeciControls.ViHost.work().

BackgroundWorker SeciControls.ViHost._worker = new BackgroundWorker()
private

Definition at line 31 of file ViHost.cs.

Referenced by SeciControls.ViHost.timer1_Tick().

System.Windows.Forms.ToolStripMenuItem SeciControls.ViHost.cascadeVIsToolStripMenuItem
private

Definition at line 98 of file ViHost.designer.cs.

System.ComponentModel.IContainer SeciControls.ViHost.components = null
private

Required designer variable.

Definition at line 8 of file ViHost.designer.cs.

Referenced by SeciControls.ViHost.Dispose().

System.Windows.Forms.ContextMenuStrip SeciControls.ViHost.contextMenuStrip1
private

Definition at line 97 of file ViHost.designer.cs.

System.Windows.Forms.Panel SeciControls.ViHost.panel1
private

Definition at line 96 of file ViHost.designer.cs.

System.Windows.Forms.Panel SeciControls.ViHost.sizeMarker
private

Definition at line 100 of file ViHost.designer.cs.

System.Windows.Forms.Timer SeciControls.ViHost.timer1
private

Definition at line 99 of file ViHost.designer.cs.

Property Documentation

List<string> SeciControls.ViHost.ViNames
get

The documentation for this class was generated from the following files: