Пример #1
0
        public static DialogLogin Dialog()
        {
            var  win = new DialogLogin();
            bool?res = win.ShowDialog();

            return(res == true ? win : null);
        }
Пример #2
0
        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);
        }