public static DialogLogin Dialog() { var win = new DialogLogin(); bool?res = win.ShowDialog(); return(res == true ? win : null); }
public async Task <bool> Login() { Mastonet.Entities.Auth auth; if (auth_client?.AuthToken == null) { var d = DialogLogin.Dialog(); if (d?.DialogResult != true) { return(false); } var instance = d.instance; var id = d.id; var pw = d.password; this.instance = instance; auth_client = new AuthenticationClient(instance); await LoadAppAsync(); auth = await auth_client.ConnectWithPassword(id, pw); } else { auth = auth_client.AuthToken; } if (app != null && auth != null) { client = new MastodonClient(app, auth); } else { throw new System.Security.SecurityException("Login Failed"); } return(true); }