C# Class RemoteLedMatrix.MainPage

Main page of the RemoteLedMatrix application. Contains the actual controls for the led matrix, as well as the settings bar and instance.
Inheritance: Windows.UI.Xaml.Controls.Page
Show file Open project: ms-iot/LEDMatrix

Public Properties

Property Type Description
CurrentConnection RemoteLedMatrix.Helpers.Connection
Instance MainPage
IsInSettings bool
_isPreviewing bool

Public Methods

Method Description
CheckAlwaysRunning ( bool force = null ) : void

Tries to keep the machine from locking/sleeping by periodically making a DisplayRequest

Connect ( Connection selectedConnection ) : System.Threading.Tasks.Task

Connects to a remote device over firmata

Disconnect ( ) : void

Disconnects the current connection and cleans up any related objects

MainPage ( ) : System
PopulateList ( ) : void

Populates the list of connections in the settings UI

RefreshConnections ( ) : Task

Refreshes the connections from the available device sources

Protected Methods

Method Description
OnNavigatedTo ( NavigationEventArgs e ) : void
OnNavigatingFrom ( NavigatingCancelEventArgs e ) : void

Private Methods

Method Description
Application_Resuming ( object sender, object o ) : void
Application_Suspending ( object sender, SuspendingEventArgs e ) : void
CaptureTimerTick ( object sender, object e ) : void

Performs a capture every timer tick, to provide continuous streaming

CleanupCameraAsync ( ) : System.Threading.Tasks.Task

Cleans up the camera resources (after stopping the preview if necessary) and unregisters from MediaCapture events

ConvertDisplayOrientationToDegrees ( DisplayOrientations orientation ) : int

Converts the given orientation of the app on the screen to the corresponding rotation in degrees

DisplayInformation_OrientationChanged ( DisplayInformation sender, object args ) : void

This event will fire when the page is rotated

Display_Tapped ( object sender, TappedRoutedEventArgs e ) : void

Display button tapped event handler

FindCameraDeviceByPanelAsync ( Windows.Devices.Enumeration.Panel desiredPanel ) : Task

Queries the available video capture devices to try and find one mounted on the desired panel

GetPreviewFrameAsSoftwareBitmapAsync ( ) : System.Threading.Tasks.Task

Gets the current preview frame as a SoftwareBitmap, displays its properties in a TextBlock, and can optionally display the image in the UI and/or save it to disk as a jpg

GetPreviewFrameButton_Tapped ( object sender, TappedRoutedEventArgs e ) : void
InitializeCameraAsync ( ) : System.Threading.Tasks.Task

Initializes the MediaCapture, registers events, gets camera device information for mirroring and rotating, and starts preview

MediaCapture_Failed ( MediaCapture sender, MediaCaptureFailedEventArgs errorEventArgs ) : void
OnConnectionEstablished ( ) : void

OnConnectionFailed ( string message ) : void

Handler for failed connection event, logs and displays a UI message

OnConnectionLost ( string message ) : void

Handler for lost connection event, logs and displays a UI message

PreviewButton_Checked ( object sender, RoutedEventArgs e ) : void
PreviewButton_Click ( object sender, RoutedEventArgs e ) : void

Handler for clicking the preview button

PreviewButton_Unchecked ( object sender, RoutedEventArgs e ) : void
SetPreviewRotationAsync ( ) : System.Threading.Tasks.Task

Gets the current orientation of the UI in relation to the device and applies a corrective rotation to the preview

SettingButton_Click ( object sender, RoutedEventArgs e ) : void

Handler for clicking the setting button

StartPreviewAsync ( ) : System.Threading.Tasks.Task

Starts the preview and adjusts it for for rotation and mirroring after making a request to keep the screen on and unlocks the UI

StopPreviewAsync ( ) : System.Threading.Tasks.Task

Stops the preview and deactivates a display request, to allow the screen to go into power saving modes, and locks the UI

TestButton_Click ( object sender, RoutedEventArgs e ) : void

Handler for clicking the test button

Method Details

CheckAlwaysRunning() public method

Tries to keep the machine from locking/sleeping by periodically making a DisplayRequest
public CheckAlwaysRunning ( bool force = null ) : void
force bool Forces the request, even if AlwaysRunning isn't set
return void

Connect() public method

Connects to a remote device over firmata
public Connect ( Connection selectedConnection ) : System.Threading.Tasks.Task
selectedConnection RemoteLedMatrix.Helpers.Connection Connection to connect to
return System.Threading.Tasks.Task

Disconnect() public method

Disconnects the current connection and cleans up any related objects
public Disconnect ( ) : void
return void

MainPage() public method

public MainPage ( ) : System
return System

OnNavigatedTo() protected method

protected OnNavigatedTo ( NavigationEventArgs e ) : void
e Windows.UI.Xaml.Navigation.NavigationEventArgs
return void

OnNavigatingFrom() protected method

protected OnNavigatingFrom ( NavigatingCancelEventArgs e ) : void
e Windows.UI.Xaml.Navigation.NavigatingCancelEventArgs
return void

PopulateList() public method

Populates the list of connections in the settings UI
public PopulateList ( ) : void
return void

RefreshConnections() public method

Refreshes the connections from the available device sources
public RefreshConnections ( ) : Task
return Task

Property Details

CurrentConnection public property

public Connection,RemoteLedMatrix.Helpers CurrentConnection
return RemoteLedMatrix.Helpers.Connection

Instance public static property

public static MainPage Instance
return MainPage

IsInSettings public property

public bool IsInSettings
return bool

_isPreviewing public property

public bool _isPreviewing
return bool