public void Dispose()
 {
     if (commModule != null)
     {
         commModule.Dispose();
         commModule = null;
     }
 }
Ejemplo n.º 2
0
 public AppContext(CommModule commInstance, StreamWebSocket webSocket, ControlChannelTrigger channel, string id)
 {
     WebSocketHandle = webSocket;
     Channel         = channel;
     ChannelId       = id;
     CommInstance    = commInstance;
     messageQueue    = new ConcurrentQueue <string>();
 }
        async void ClientInit()
        {
            commModule = new CommModule();

            // In the client role, we require the application to be on lock screen.
            // Lock screen is required to let in-process RealTimeCommunication related
            // background code to execute.
            if (lockScreenAdded == false)
            {
                BackgroundAccessStatus status = await BackgroundExecutionManager.RequestAccessAsync();
                Diag.DebugPrint("Lock screen status" + status);

                switch (status)
                {
                    case BackgroundAccessStatus.AllowedWithAlwaysOnRealTimeConnectivity:

                        // App is allowed to use RealTimeConnection broker 
                        // functionality even in low power mode.
                        lockScreenAdded = true;
                        break;
                    case BackgroundAccessStatus.AllowedMayUseActiveRealTimeConnectivity:

                        // App is allowed to use RealTimeConnection broker 
                        // functionality but not in low power mode.
                        lockScreenAdded = true;
                        break;
                    case BackgroundAccessStatus.Denied:

                        // App should switch to polling mode (example: poll for email based on time triggers)
                        Diag.DebugPrint("As Lockscreen status was Denied, App should switch to polling mode such as email based on time triggers.");
                        break;
                }
            }

            ClientSettings.Visibility = Visibility.Visible;
            ConnectButton.Visibility = Visibility.Visible;
            return;
        }
Ejemplo n.º 4
0
 public AppContext(CommModule commInstance, StreamWebSocket webSocket, ControlChannelTrigger channel, string id)
 {
     WebSocketHandle = webSocket;
     Channel = channel;
     ChannelId = id;
     CommInstance = commInstance;
     messageQueue = new ConcurrentQueue<string>();
 }