C# Class HueApp.Initializer

Handles inital loading of Hue resources (including the bridge and lights), and displaying an extended splash screen to the user while the app prepares.
Show file Open project: Microsoft/Windows-appsample-huelightcontroller Class Usage Examples

Protected Properties

Property Type Description
rect Windows.Foundation.Rect
rootFrame Windows.UI.Xaml.Controls.Frame
splash Windows.ApplicationModel.Activation.SplashScreen

Public Methods

Method Description
Initializer ( SplashScreen splashscreen ) : HueLibrary

Constructor for the initializer. This displays an extended splash screen and progress ring while the app loads the bridge, lights, and Cortana.

Private Methods

Method Description
Current_SizeChanged ( object sender, WindowSizeChangedEventArgs e ) : void

Fires when the user changes the size of the app window to adjust the image and progress ring positioning.

DispatchAwaitableUITask ( Func task ) : System.Threading.Tasks.Task

Utility method for awaiting calls sent to the UI thread via the dispatcher. Used to display popups on the UI thread from a background thread and wait for user input before proceeding.

FindBridgeAsync ( ) : System.Threading.Tasks.Task

Tries to find the bridge using multiple methods. Note: this is not an exhaustive list of discovery options. For complete guidance, see http://www.developers.meethue.com/documentation/hue-bridge-discovery

FindLightsAsync ( ) : System.Threading.Tasks.Task

Tries to find lights on the network.

Initialize ( SplashScreen sender, object args ) : void

Prepares the app for use by finding the bridge and lights, and initalizing Cortana.

InitializeCortanaAsync ( ) : System.Threading.Tasks.Task

Prepares Cortana for background use.

PrepareBridgeAsync ( int attempts ) : Task

Checks whether the bridge is reachable and the app is authorized to send commands. If the bridge is reachable but the app isn't authorized, it prompts the user to register it.

ReportErrorAsync ( string message ) : System.Threading.Tasks.Task

Displays a popup to the user indicating an error occured.

SaveBridgeToCache ( ) : void

Saves bridge information to the app's local storage so the app can load faster next time.

SetImage ( ) : void

Sets the extended splash screen image. Called on first load and if the app window is resized by the user.

Method Details

Initializer() public method

Constructor for the initializer. This displays an extended splash screen and progress ring while the app loads the bridge, lights, and Cortana.
public Initializer ( SplashScreen splashscreen ) : HueLibrary
splashscreen Windows.ApplicationModel.Activation.SplashScreen
return HueLibrary

Property Details

rect protected property

protected Rect,Windows.Foundation rect
return Windows.Foundation.Rect

rootFrame protected property

protected Frame,Windows.UI.Xaml.Controls rootFrame
return Windows.UI.Xaml.Controls.Frame

splash protected property

protected SplashScreen,Windows.ApplicationModel.Activation splash
return Windows.ApplicationModel.Activation.SplashScreen