private void LogIn(object loginData) { Progress.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(delegate { Progress.IsIndeterminate = true; return(null); }), null); var login = ((LoginData)loginData).Login; var password = ((LoginData)loginData).Password; var data = UserFunctions.GetPrivileges(login, password); Progress.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DispatcherOperationCallback(delegate { Progress.IsIndeterminate = false; return(null); }), null); var fnc = Application.Current.Properties["AfterLogin"] as Action <UserPrivileges>; fnc?.Invoke(data); }