private void OnLogOut() { Properties.Settings.Default["Token"] = ""; Properties.Settings.Default.Save(); _authorizationViewModel = null; _authorizationUserControl = new AuthorizationUserControl(); _roomsViewModel = null; _roomsUserContorl = new RoomsUserControl(); InitializeAuthorizationControl(); }
//this method is called by webSockets private void OnAuthorized() { System.Windows.Application.Current.Dispatcher.Invoke( DispatcherPriority.Normal, (Action) delegate { _roomsViewModel = new RoomsViewModel(_httpToken); _roomsUserContorl.DataContext = _roomsViewModel; _roomsViewModel.LogOut += () => OnLogOut(); _contentControl.Content = _roomsUserContorl; }); }