private void buttonLogin_Click(object sender, RoutedEventArgs e) { var w = new WindowLogin(); w.OnLoggedIn += (s, args) => { api = args.Api; SaveAccount(GetUserKeyFilePath(), "user.anon.dat"); Invoke(() => { CancelTransfers(); w.Close(); buttonLogin.Visibility = System.Windows.Visibility.Collapsed; buttonLogout.Visibility = System.Windows.Visibility.Visible; Title = title + " - " + api.User.Email; }); InitialLoadNodes(); }; w.ShowDialog(); }