private void Reauth() { if (!this.isLoggedIn) { SessionManager sm = new SessionManager(1928531, Convert.ToInt32(ApiPerms.Audio | ApiPerms.ExtendedMessages | ApiPerms.ExtendedWall | ApiPerms.Friends | ApiPerms.Offers | ApiPerms.Photos | ApiPerms.Questions | ApiPerms.SendNotify | ApiPerms.SidebarLink | ApiPerms.UserNotes | ApiPerms.UserStatus | ApiPerms.Video | ApiPerms.WallPublisher | ApiPerms.Wiki)); //sm.Log += new SessionManagerLogHandler(sm_Log); this.sessionInfo = sm.GetSession(); if (this.sessionInfo != null) { this.isLoggedIn = true; } } if (this.isLoggedIn) { manager = new ApiManager(this.sessionInfo); //manager.Log += new ApiManagerLogHandler(manager_Log); //manager.DebugMode = true; manager.Timeout = 10000; this.FriendList.Enabled = true; this.Text = this.appTitle + ": Authorization success!"; this.friendFactory = new FriendsFactory(this.manager); this.photoFactory = new PhotosFactory(this.manager); this.photoList = new List<PhotoEntryFull>(); this.albumList = new List<AlbumEntry>(); this.userIdCheck = new Regex("([\\d])+$"); this.GetFriendList(); } }
// Функция «Перелогиниться» private void Reauth() { // Выполняется если пользователь незалогинен if (!_isLoggedIn) { // Соединяемся с VK API, передаем ему ключ приложения и необходимые нам разрешения SessionManager sm = new SessionManager(2369574, Convert.ToInt32(ApiPerms.UserStatus | ApiPerms.WallPublisher)); _sessionInfo = sm.GetSession(); if (_sessionInfo != null) { _isLoggedIn = true; } Reauth(); } // Выполняется если пользователь залогинен if (_isLoggedIn) { _manager = new ApiManager(_sessionInfo) {Timeout = 10000}; Text = AppTitle + ": Авторизован!"; templateForStatus.Text = _templatestatus; checkiTunes(); GetStatus(); } }