Example #1
0
 private void ResetDataMembers()
 {
     _userID                = null;
     _dataClient            = null;
     _locationDevice        = null;
     _displayConcurrentList = null;
     _zoneConcurrentList    = null;
 }
Example #2
0
        /// <summary>
        /// Updates the DisplayConcurrentList for DisplaySession's 'IsUserExists' flag
        /// </summary>
        /// <returns></returns>
        private async Task UpdateDisplayConcurrentListAsync()
        {
            try
            {
                bool isDataModified = false;
                _displayConcurrentList = await _dataClient?.TransientData?.ObtainDisplayConcurrentListAsync();

                if (_displayConcurrentList != null)
                {
                    // Traverse through each DisplayEndpoints in the Zone
                    foreach (DisplayEndpoint displayEndpoint in _locationDevice.Zone.DisplayEndpoints)
                    {
                        // Process the DisplayEndpoint only if there is one or more than one Notifications associated with it
                        if (displayEndpoint.DisplayEndpointNotifications?.Any() ?? false)
                        {
                            // Retrieve the DisplayEndpoint's respective DisplaySession
                            var displaySession = _displayConcurrentList.ObtainDisplaySession(displayEndpoint.DisplayEndpointID);
                            if (!displaySession?.IsUserExists ?? false)
                            {
                                displaySession.IsUserExists = true;
                                isDataModified = true;
                            }
                        }
                    }
                }

                if (isDataModified)
                {
                    // Save the updated DisplaySessions
                    await _dataClient.TransientData.SaveDisplayConcurrentListAsync();

                    Context.Logger.LogLine("DisplaySessions updated");
                }
            }
            catch (Exception ex)
            {
                Context.Logger.LogLine("DisplayConcurrentList ERROR: " + ex.Message);
            }
        }