Application Class |
Namespace: GDEx
public abstract class Application : Application
The Application type exposes the following members.
Name | Description | |
---|---|---|
Application |
Creates GD based Application instance. Must be called explicitly from derived class.
|
Name | Description | |
---|---|---|
DebugSettings | Gets an object that declares how the app behaves when run in a debug environment. (Inherited from Application.) | |
Dispatcher |
Access application/windows specific dispatcher.
| |
FocusVisualKind | (Inherited from Application.) | |
Frame |
Shortcut for accessing application root Frame.
| |
RequestedTheme | Gets or sets a value that determines the light-dark preference for the overall theme of an app. (Inherited from Application.) | |
RequiresPointerMode | (Inherited from Application.) | |
Resources | Gets a collection of application-scoped resources, such as styles, templates, and brushes. (Inherited from Application.) |
Name | Description | |
---|---|---|
Exit | Shuts down the app. (Inherited from Application.) | |
HandleGDMessage |
Entry point for GD SDK -> Application communication. All messages sent from GD SDK are handled by this method.
| |
Initialize |
Virtual method called when application can perform Window/Frame related initialization.
When called Window.Current.Content is already initialized to GD Frame and can be accessed by Frame property.
| |
Navigate |
Shortcut method for performing navigation on application root frame.
| |
NavigateToFirstPage |
Abstract method called when application should navigate to the very first screen.
This happens even before authorization process begins.
In most cases application should navigate to splash screen or similar.
| |
OnActivated |
Entry point for handling incoming URI requests. Used i.a. for AuthDelegation commands interchange.
(Overrides ApplicationOnActivated(IActivatedEventArgs).) | |
OnBackgroundActivated | (Inherited from Application.) | |
OnCachedFileUpdaterActivated | Invoked when the application is activated due to an activation contract with ActivationKind as CachedFileUpdater. (Inherited from Application.) | |
OnFileActivated |
Entry point for handling file opening requests. Used i.a. for AppKinetics payload interchange.
(Overrides ApplicationOnFileActivated(FileActivatedEventArgs).) | |
OnFileOpenPickerActivated | Invoked when the application is activated through file-open dialog association. (Inherited from Application.) | |
OnFileSavePickerActivated | Invoked when the application is activated through file-save dialog association. (Inherited from Application.) | |
OnLaunched |
Entry point for ordinary application launch.
(Overrides ApplicationOnLaunched(LaunchActivatedEventArgs).) | |
OnSearchActivated | Invoked when the application is activated through a search association. (Inherited from Application.) | |
OnShareTargetActivated | Invoked when the application is activated through sharing association. (Inherited from Application.) | |
OnWindowCreated |
Stores dispatcher reference for current window context.
(Overrides ApplicationOnWindowCreated(WindowCreatedEventArgs).) |
Name | Description | |
---|---|---|
EnteredBackground | (Inherited from Application.) | |
LeavingBackground | (Inherited from Application.) | |
Resuming | Occurs when the application transitions from Suspended state to Running state. (Inherited from Application.) | |
Suspending | Occurs when the application transitions to Suspended state from some other state. (Inherited from Application.) | |
UnhandledException | Occurs when an exception is raised by application code, forwarded from the native level. Applications can mark the occurrence as handled in event data. (Inherited from Application.) |
For more details and code snippets please refer to Examples section, Build-Time Configuration or Compatibility with SDK for Windows 8.1 section of GDWindows class reference.
Required BlackBerry Dynamics Entitlement ID definition in application manifest:
<Applications> <Application Id="com.gd.based.application" <!-- BlackBerry Dynamics Entitlement ID in reverse-DNS notation --> Executable="$targetnametoken$.exe" EntryPoint="Sample.Windows.App"> (...) </Application> </Applications>
<Applications> <Application Id="com.gd.based.application" Executable="$targetnametoken$.exe" EntryPoint="Sample.Windows.App"> <Extensions> <uap:Extension Category="windows.protocol"> <!-- Protocol name must be set to "gd-sc3" --> <uap:Protocol Name="gd-sc3"> <uap:DisplayName>Sample windows app protocol</uap:DisplayName> </uap:Protocol> </uap:Extension> <uap:Extension Category="windows.protocol"> <!-- Protocol name must be set to "gd-sc3.<gd-app-version>" --> <uap:Protocol Name="gd-sc3.1.0.0.0"> <uap:DisplayName>Sample windows app protocol</uap:DisplayName> </uap:Protocol> </uap:Extension> </Extensions> (...) </Application> </Applications>
Minimal, sample implementation required to use all SDK benefits for App.xaml.cs is:
using System; using Windows.UI.Xaml.Controls; using GDEx; using GD; namespace SampleApp { sealed partial class App : GDEx.Application { public App() { this.InitializeComponent(); } protected override void NavigateToFirstPage(Frame frame, object eventArgs) { // Navigate to very first screen of your application (before authorization process begins). // Typically it will be a splash screen or similar. frame.Navigate(typeof(SplashView), eventArgs); } protected override async void HandleGDMessage(GDAppEvent appEvent) { // Remember to call base class implementation, as some events are processed // automatically inside the base class (e.g. GDAppEventType.GDAppEventReadyToAuthorize). base.HandleGDMessage(appEvent); if (appEvent.type == GDAppEventType.GDAppEventAuthorized) { // When user authorization succeed, you can navigate to main page of your application. await Navigate(typeof(MainPage)); } } } }
<gdex:Application x:Class="SampleApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:gdex="using:GDEx"> </gdex:Application>
You can use JSON file with additional settings, e.g. to enable Enterprise Simulation mode or to change console logger settings. Sample settings.json file can look like this:
{ "GDLibraryMode" : "GDEnterpriseSimulation", "GDConsoleLogger" : [ "GDFilterNone" ] }
namespace SampleApp { sealed partial class App : GDEx.Application { public App() : base(Package.Current.InstalledLocation.Path + @"\settings.json") { this.InitializeComponent(); } } (...) }