Example #1
0
        public void Initialize(IPAddress currentAlternateIp)
        {
            __sessionKeeper = AppState.Instance();
            __HostIPs.SetCurAlternateHost(currentAlternateIp);

            // reset alternate host on logout
            __sessionKeeper.OnSessionChanged += (SessionInfo sessionInfo) =>
            {
                if (!__sessionKeeper.IsLoggedIn())
                {
                    ResetCurAlternateHost();
                }
            };

            // forward event
            __HostIPs.AlternateHostChanged += (IPAddress ip) =>
            {
                AlternateHostChanged(ip);
            };

            __HostIPs.AlternateHostsListUpdated += () =>
            {
                AlternateHostsListUpdated();
            };
        }
 /// <summary> Request account check in background </summary>
 public void RequestStatusCheck()
 {
     Task.Run(async() =>
     {
         try
         {
             if (!__SessionKeeper.IsLoggedIn())
             {
                 return; // User not loged-in () no registered sesion - nonthing to check
             }
             await __Service.AccountStatus();
         }
         catch (Exception ex)
         {
             Logging.Info($"{ex}");
         }
     });
 }