示例#1
0
        public EoiDataUser(FileSystemDataUser user)
        {
            _fileSystemUser = user;

            if (_fileSystemUser.TokenResponse != null)
            {
                var token = WebDataInterface.RefreshAccessToken(_fileSystemUser.TokenResponse.refresh_token);
                if (token != null)
                {
                    if (this.Id == 0)
                    {
                        Authenticate(token);
                    }

                    _fileSystemUser.TokenResponse = token;
                    FileSystemDataInterface.ExportUsers();
                }
            }

            if (_fileSystemUser != null && _fileSystemUser.TokenResponse != null)
            {
                CorporationWebInterface.RegisterUser(_fileSystemUser.Name);
            }

            this.Name = user.Name;
        }
示例#2
0
        public static bool IsVersionValid(string version)
        {
            if (string.IsNullOrWhiteSpace(version))
            {
                return(false);
            }

            return(WebDataInterface.IsVersionValid(version));
        }
        private void Timer_Tick(object sender, EventArgs e)
        {
            _code = WebDataInterface.GetAuthenticationCode(_guid);
            if (!string.IsNullOrWhiteSpace(_code))
            {
                if (_dispatcherTimer != null)
                {
                    _dispatcherTimer.Stop();
                    _dispatcherTimer = null;
                }

                WebDataInterface.GetUserAccessToken(_code);
            }
        }
示例#4
0
        internal void CheckAccessToken()
        {
            if (_fileSystemUser.TokenResponse != null)
            {
                var difference = DateTime.Now - _fileSystemUser.TokenResponse.Timestamp;
                if (difference.TotalMinutes >= 15)
                {
                    var token = WebDataInterface.RefreshAccessToken(_fileSystemUser.TokenResponse.refresh_token);
                    if (token != null)
                    {
                        if (this.Id == 0)
                        {
                            Authenticate(token);
                        }

                        _fileSystemUser.TokenResponse = token;
                        FileSystemDataInterface.ExportUsers();
                    }
                }
            }
        }