private async void InitializeUserInfo()
        {
            bool online = await SoftwareUserSession.IsOnlineAsync();

            bool softwareSessionFileExists = SoftwareCoUtil.softwareSessionFileExists();
            bool jwtExists       = SoftwareCoUtil.jwtExists();
            bool initializedUser = false;

            if (!softwareSessionFileExists || !jwtExists)
            {
                string result = await SoftwareUserSession.CreateAnonymousUserAsync(online);

                if (result != null)
                {
                    initializedUser = true;
                }
            }

            SoftwareUserSession.UserStatus status = await SoftwareUserSession.GetUserStatusAsync(true);

            SoftwareLoginCommand.UpdateEnabledState(status);

            if (initializedUser)
            {
                LaunchLoginPrompt();
            }

            if (online)
            {
                fetchSessionSummaryInfoAsync();

                // send heartbeat
                SoftwareUserSession.SendHeartbeat("INITIALIZED");
            }
        }
Beispiel #2
0
 public static async void UpdateEnabledState(SoftwareUserSession.UserStatus userStatus)
 {
     if (menuItem != null)
     {
         if (userStatus.loggedIn)
         {
             menuItem.Enabled = true;
         }
         else
         {
             menuItem.Enabled = false;
         }
     }
 }
 public async void UpdateUserStatus(Object stateInfo)
 {
     SoftwareUserSession.UserStatus status = await SoftwareUserSession.GetUserStatusAsync(false);
 }