Beispiel #1
0
        public void Authorize(bool clearCookies)
        {
            _eventAggregator.GetEvent <AuthBarEvents.AuthorizeRequest>().Publish();
            //var accessToken = App.Container.GetInstance<AccessToken>();
            //var authWindow = new AuthView(accessToken, clearCookies);

            if (clearCookies)
            {
                VkAuthorization.ClearCookies();
            }

            var authWindow = new AuthView();//App.Container.GetInstance<AuthView>();

            authWindow.Action = AuthAction.Authorize;
            authWindow.ShowDialog();

            //_regionManager.RequestNavigate(RegionNames.MainRegion, $"VkAuthorization?clearcookies={clearCookies}");
        }
Beispiel #2
0
        //todo: деавторизация не работает!
        public void Deauthorize()
        {
            _eventAggregator.GetEvent <AuthBarEvents.LogOutRequest>().Publish();

            IsAuthorized = false;
            UserName     = string.Empty;
            SetUpAvatar(DEFAULT_AVATAR);

            _vkApi.Token.Set(new AccessToken());

            var authWindow = new AuthView();//App.Container.GetInstance<AuthView>();

            authWindow.Action = AuthAction.Deauthorize;
            authWindow.ShowDialog();

            VkAuthorization.ClearAllCookies();
            //App.SuppressWininetBehavior();

            _eventAggregator.GetEvent <AuthBarEvents.LogOutCompleted>().Publish();
        }