C# Class MATLABfromCSharp.MainForm

Inheritance: System.Windows.Forms.Form
Mostrar archivo Open project: osisoft/PI-to-MATLAB-Utility Class Usage Examples

Public Properties

Property Type Description
dataPrefDialog DataPreferences

Public Methods

Method Description
ImportFileMenuItem_Click ( object sender, EventArgs e ) : void
MainForm ( MainControl main ) : System
SaveFileMenuItem_Click ( object sender, EventArgs e ) : void
Status ( string status ) : void

Sets the string to the Status Strip at the bottom of the application.

afmenu_Opening ( object sender, CancelEventArgs e ) : void

Event raised the menu control is opening. Handles the opening of the AFTreeView ContextMenuStrip to override visibility of menu items. TODO: could vary between admin and non-admin users.

getUserVariableName ( string objectName ) : string

Checks Matlab Variable Name textbox for a variable name

importSavedLog ( string path ) : void

Pass the file path from the MainForm to MainControl

passDataPrefChanges ( bool ts, int datapref, string format ) : void

Passes the Data Preferences changed to the Main Control.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Clean up any resources being used.

Private Methods

Method Description
AFTreeViewNode_Selected ( object sender, TreeViewEventArgs e ) : void

When a node is selected, the attribute box updates and the path is saved.

AdvancedDataClick ( object sender, EventArgs e ) : void

Shows the Data Preferences Dialog for user changes.

EnterPressed ( object sender, KeyEventArgs e ) : void
ExportToMatlab_Click ( object sender, EventArgs e ) : void

Evaluates based on the tabPage, which export method to call.

InitializeAttributeListBox ( AFAttributes atts ) : void

Shows the list of Attributes and their values in the AFViewControl.

InitializeComponent ( ) : void

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

MainHasFocus ( object sender, EventArgs e ) : void

Assures that the secondary Forms are hidden when the Main Form is focused on.

MatlabNameCheckedChanged ( object sender, EventArgs e ) : void
PItoMatlabForm_Closing ( object sender, FormClosingEventArgs e ) : void
PItoMatlabForm_Load ( object sender, EventArgs e ) : void
SaveFileDialog ( string filter ) : string

Brings up a SaveFileDialog.

TabIndex_Changed ( object sender, EventArgs e ) : void
afDatabasePicker1_SelectionChange ( object sender, SelectionChangeEventArgs e ) : void

Updates the current AFDatabase and the AFTreeView to match. Clears the AFViewControl of the Event Frames. (Not sure if we want to do this).

afEventFrameFindCtrl_AFEventFrameUpdated ( object sender, CancelEventArgs e ) : void

The FindEventFrameCriteria Dialog updates the event frame to one EventFrame, which is shown in the AFViewController

afEventFrameFindCtrl_DialogButtonPressing ( object sender, CancelEventArgs e ) : void

Uses the AFEventFrameFindControl, but overrides the EventFrameBrowser to FindEventFrames (AFOperations). Opens dialog to select eventframes to be shown in the AFViewControl

afServerPicker_ConnectionChange ( object sender, SelectionChangeEventArgs e ) : void
afTreeViewElements_MenuItemClicked ( object sender, MenuItemClickedEventArgs e ) : void

Handles the afTreeView Menu Item calls, brings up the FindElements Dialog and EventFrame Dialog

avcEventFrames_ItemSelected ( object sender, SelectionChangeEventArgs e ) : void

Updates the Event Attibutes AFViewControl and set the Date Time to that of the EventFrame.

bEFSearch_Click ( object sender, EventArgs e ) : void

Starts a simple Name search using the text from the textbox. Updates the AFViewControl of elements that match the criteria.

bSearchElements_Click ( object sender, EventArgs e ) : void

If it is a new search, the elements that fit the criteria are collected and the first is selected. Else it iterates through the collection of elements and expands to the node.

exportAFData ( ) : void

Export AF Data. Gets the Attribute from the AFViewControl of Element Attributes.

exportEventFrameData ( ) : void

Exports the Event Frame Data, using the AFViewControl to select an EventFrame and EventFrame Attribute.

exportPIData ( ) : void

Export PI Data. Gets items from the AFViewControl of PIPoints.

findTreeNode ( TreeNode node, AFElement element ) : bool

Expands the TreeView along the element path. Iterative process that stops when node is found.

importAFData ( ) : void

Import AF Data into the Asset Framework.

initializeAfServerPicker ( ) : void

Multiple steps. 1) gets PIPoints fo the Server 2) Checks AFSecurity, for admin access and removes ability to import. 3) Initializes Database and EventFrameFindCtrl.

openMatlabMenuItem_Click ( object sender, EventArgs e ) : void
passPIDataRequest ( string server, string pipoint ) : void

Sends a PIData request to MainControl. Uses AFSDK.

radioInformationDirectionChanged ( object sender, EventArgs e ) : void
saveExports ( ) : void

Saves the Exports to a user-specified .txt File.

saveMatlab ( ) : void

TODO: Not Finished. Writes the Matlab code that produces the same data calls.

saveMatlabMenuItem_Click ( object sender, EventArgs e ) : void
tb_MatlabName_Click ( object sender, EventArgs e ) : void
tb_MatlabName_Leave ( object sender, EventArgs e ) : void
viewLogToolStripMenuItem_Click ( object sender, EventArgs e ) : void

Method Details

Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void

ImportFileMenuItem_Click() public method

public ImportFileMenuItem_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

MainForm() public method

public MainForm ( MainControl main ) : System
main MainControl
return System

SaveFileMenuItem_Click() public method

public SaveFileMenuItem_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void

Status() public method

Sets the string to the Status Strip at the bottom of the application.
public Status ( string status ) : void
status string The string shown
return void

afmenu_Opening() public method

Event raised the menu control is opening. Handles the opening of the AFTreeView ContextMenuStrip to override visibility of menu items. TODO: could vary between admin and non-admin users.
public afmenu_Opening ( object sender, CancelEventArgs e ) : void
sender object
e CancelEventArgs
return void

getUserVariableName() public method

Checks Matlab Variable Name textbox for a variable name
public getUserVariableName ( string objectName ) : string
objectName string The attribute name
return string

importSavedLog() public method

Pass the file path from the MainForm to MainControl
public importSavedLog ( string path ) : void
path string The path to the file.
return void

passDataPrefChanges() public method

Passes the Data Preferences changed to the Main Control.
public passDataPrefChanges ( bool ts, int datapref, string format ) : void
ts bool true: provides timestamps along with data
datapref int Based on the GetValues, 0(raw), negative(sampling), positive(profiled sampling)
format string string version of passed data.
return void

Property Details

dataPrefDialog public_oe property

public DataPreferences,MATLABfromCSharp dataPrefDialog
return DataPreferences